Take a look at this post from last spring and see if it explains why you
are getting so many values:
https://groups.google.com/d/msg/weewx-user/JQSSKweeam8/2mIWO96PBgAJ

You may want to restructure your code to use a later binding. The function
get_extension_list() is where you stage things, but it is usually not where
you hit the database. As an example, the class cheetahgenerator.Stats
creates a TimeBinder object in get_extension_list, but it doesn't actually
hit the database until Cheetah starts asking for attributes of TimeBinder
(such as "week", "month", etc.)

Hope this explains things.

-tk

On Mon, Nov 12, 2018 at 2:08 PM Pat O'Brien <[email protected]> wrote:

> It's part of the Belchertown skin. You can find the SLE and the all_stats
> copy/paste from your documentation here
> <https://github.com/poblabs/weewx-belchertown/blob/master/bin/user/belchertown.py#L304>.
> Then the $alltimel.rain.sum was here
> <https://github.com/poblabs/weewx-belchertown/blob/9e2a16151493e70df78bde5be9acc219caebe705/skins/Belchertown/records/index.html.tmpl#L179>,
> but I've since removed it
> <https://github.com/poblabs/weewx-belchertown/blob/master/skins/Belchertown/records/index.html.tmpl#L178>
> since a recent commit to get the data from the database instead.
>
> Hope this helps?
>
>
> On Monday, November 12, 2018 at 4:55:54 PM UTC-5, Tom Keffer wrote:
>>
>> Hi, Pat
>>
>> I'd have to see the exact instrumented code to comment. Could you post?
>>
>> -tk
>>
>> On Mon, Nov 12, 2018 at 6:04 AM Pat O'Brien <[email protected]> wrote:
>>
>>> Hi there, I'm using the all_stats code found in the Customization Guide
>>> <http://www.weewx.com/docs/customizing.htm#defining_new_tags> and
>>> noticed a potential error. Full code snippet:
>>>
>>>  all_stats = TimespanBinder(timespan,
>>>      db_lookup,
>>>      formatter=self.generator.formatter,
>>>      converter=self.generator.converter,
>>>      skin_dict=self.generator.skin_dict)
>>>
>>>  search_list_extension = {'alltime' : all_stats
>>>
>>> When using the $alltime.rain.sum it was returning a lot of results,
>>> which only 1 was accurate. I'm not sure why so I wanted to ask here.
>>>
>>> Within the SLE Python I ran:
>>>
>>> print all_stats.rain.sum
>>>
>>> it returns:
>>>
>>> 120.70 in
>>> 50.84 in
>>> 120.70 in
>>> 120.70 in
>>> 3.75 in
>>> 120.70 in
>>> 120.70 in
>>> 120.70 in
>>> 120.70 in
>>> 120.70 in
>>> 120.70 in
>>> 120.70 in
>>> 120.70 in
>>>
>>> The correct answer here is 50.84. Do you know why all of the other
>>> results would show up? Is this a TimespanBinder limitation issue (like what
>>> I saw early on in Belchertown's creation)?
>>>
>>>

Reply via email to