Skip to content

Commit

Permalink
Updated stat tables: responsice display and yearly display. GH-215
Browse files Browse the repository at this point in the history
  • Loading branch information
Daveiano committed Feb 21, 2024
1 parent 2441124 commit 2e77ed1
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 31 deletions.
1 change: 1 addition & 0 deletions skins/weewx-wdc/includes/climatological-days.inc
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@
id="panel-$stat_table"
role="tabpanel"
aria-labelledby="tab-$stat_table"
class="climatological-day-table"
hidden
>
#set global $stat_table_obs = $DisplayOptions['stat_tables'][$stat_table]['observation']
Expand Down
64 changes: 33 additions & 31 deletions skins/weewx-wdc/includes/stat-table.inc
Original file line number Diff line number Diff line change
Expand Up @@ -111,43 +111,45 @@
</bx-structured-list-cell>
</bx-structured-list-row>
#end for
<bx-structured-list-row>
<bx-structured-list-cell>
$gettext($agg.capitalize())
</bx-structured-list-cell>
#if $context == 'alltime'
<bx-structured-list-row>
<bx-structured-list-cell>
$gettext($agg.capitalize())
</bx-structured-list-cell>

#for $month in range(1, 13)
#if $per_month[$month]
<bx-structured-list-cell data-testid="agg-month-$month-$agg-$stat_table_obs">
#for $month in range(1, 13)
#if $per_month[$month]
<bx-structured-list-cell data-testid="agg-month-$month-$agg-$stat_table_obs">
#if $agg == 'max'
$format_raw_value($max($per_month[$month]), $stat_table_obs)
#elif $agg == 'min'
$format_raw_value($min($per_month[$month]), $stat_table_obs)
#elif $agg == 'sum'
$format_raw_value($sum($per_month[$month]), $stat_table_obs)
#elif $agg == 'avg'
$format_raw_value($sum($per_month[$month])/$len($per_month[$month]), $stat_table_obs)
#end if
</bx-structured-list-cell>
#else
<bx-structured-list-cell>-</bx-structured-list-cell>
#end if
#end for

<bx-structured-list-cell>
<strong data-testid="total-$agg-$stat_table_obs">
#if $agg == 'max'
$format_raw_value($max($per_month[$month]), $stat_table_obs)
$format_raw_value($max($per_all), $stat_table_obs)
#elif $agg == 'min'
$format_raw_value($min($per_month[$month]), $stat_table_obs)
$format_raw_value($min($per_all), $stat_table_obs)
#elif $agg == 'sum'
$format_raw_value($sum($per_month[$month]), $stat_table_obs)
$format_raw_value($sum($per_all), $stat_table_obs)
#elif $agg == 'avg'
$format_raw_value($sum($per_month[$month])/$len($per_month[$month]), $stat_table_obs)
$format_raw_value($sum($per_all)/$len($per_all), $stat_table_obs)
#end if
</bx-structured-list-cell>
#else
<bx-structured-list-cell>-</bx-structured-list-cell>
#end if
#end for

<bx-structured-list-cell>
<strong data-testid="total-$agg-$stat_table_obs">
#if $agg == 'max'
$format_raw_value($max($per_all), $stat_table_obs)
#elif $agg == 'min'
$format_raw_value($min($per_all), $stat_table_obs)
#elif $agg == 'sum'
$format_raw_value($sum($per_all), $stat_table_obs)
#elif $agg == 'avg'
$format_raw_value($sum($per_all)/$len($per_all), $stat_table_obs)
#end if
</strong>
</bx-structured-list-cell>
</bx-structured-list-row>
</strong>
</bx-structured-list-cell>
</bx-structured-list-row>
#end if
</bx-structured-list-body>
</bx-structured-list>
#end for

0 comments on commit 2e77ed1

Please sign in to comment.