Skip to content

Commit

Permalink
Updated rainRate aggregate type to max.
Browse files Browse the repository at this point in the history
  • Loading branch information
Daveiano committed May 14, 2022
1 parent 93f634e commit d720009
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
4 changes: 3 additions & 1 deletion bin/user/diagram_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ def get_aggregate_type(self, observation):
if observation == 'ET' or observation == 'rain':
return 'sum'

if observation == 'UV' or observation == 'windGust':
if (observation == 'UV' or
observation == 'windGust' or
observation == 'rainRate'):
return 'max'

return 'avg'
Expand Down
15 changes: 15 additions & 0 deletions bin/user/stats_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,21 @@ def get_show_only_sum(self, observation):
if observation in show_only_sum:
return True

def get_show_only_max(self, observation):
"""
Returns if the max stats should be shown.
Args:
observation (string): The observation
Returns:
bool: Show or hide max stat.
"""
show_only_max = ["rainRate"]

if observation in show_only_max:
return True

def get_labels(self, prop, precision):
"""
Returns a label.
Expand Down
8 changes: 7 additions & 1 deletion skins/weewx-wdc/includes/stat-tile.inc
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,24 @@
#else
#if $get_show_only_sum($partial_obs)
$getattr($get_time_span_from_attr($precision, $day, $week, $month, $year, $alltime), $partial_obs).sum
#else if $get_show_only_max($partial_obs)
$getattr($get_time_span_from_attr($precision, $day, $week, $month, $year, $alltime), $partial_obs).max
#else
$getattr($get_time_span_from_attr($precision, $day, $week, $month, $year, $alltime), $partial_obs).avg
#end if
#end if
<!--prettier-ignore-->
#if $precision != 'day' and not $get_show_only_sum($partial_obs)
#if $precision != 'day' and not $get_show_only_sum($partial_obs) and not $get_show_only_max($partial_obs)
<span>$gettext("Avg")</span>
#end if
<!--prettier-ignore-->
#if $precision != 'day' and $get_show_only_sum($partial_obs)
<span>$gettext("Total")</span>
#end if
<!--prettier-ignore-->
#if $precision != 'day' and $get_show_only_max($partial_obs)
<span>$gettext("Max")</span>
#end if
</span>
</p>
</div>
Expand Down

0 comments on commit d720009

Please sign in to comment.