I think you're right that the function can be simplified. Commit de738ca
<https://github.com/weewx/weewx/commit/de738ca8057ec651bea6e03aa10f19c2ed8d6914>
.


On Sat, Feb 24, 2024 at 12:30 PM Karen K <kk4468...@gmail.com> wrote:

> I guess PR #929 is an entirely different topic.
>
> It seams to me, that the if condition in
> weewx.tags.ObservationBinder.has_data is useless, because what happens
> afterwards is almost the same in both cases.
>
> May be, the intension for that function was like that really:
>
>     @property
>     def has_data(self):
>         db_manager = self.db_lookup(self.data_binding)
>         # First see if the type exists in the database.
>         if db_manager.exists(self.obs_type):
>             # Yes. Is it non-null?
>             val = bool(db_manager.has_data(self.obs_type, self.timespan))
>         else:
>             # Nope. Try the xtypes system.
>             val = weewx.xtypes.has_data(self.obs_type, self.timespan,
> db_manager)
>         return val
>
> See the changed line with yellow background. There could be a connection
> to the performance issues some people experience I guess. Unfortunately I
> still have no 5.0 installation working to do tests.
>
> --
> You received this message because you are subscribed to the Google Groups
> "weewx-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to weewx-user+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/weewx-user/0cddb249-fefb-4179-84c3-d9fff8e70bc6n%40googlegroups.com
> <https://groups.google.com/d/msgid/weewx-user/0cddb249-fefb-4179-84c3-d9fff8e70bc6n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/CAPq0zEAXCtAgB48Fs4_yVPdMRXzzBQH2%3Dy5objVA6qeqoMe18A%40mail.gmail.com.

Reply via email to