1
0
mirror of https://github.com/krateng/maloja.git synced 2023-08-10 21:12:55 +03:00

Pulse / performance range selector now also for tracks

This commit is contained in:
Krateng 2019-05-01 11:20:40 +02:00
parent 360bc97610
commit a908a5e6a3
2 changed files with 45 additions and 4 deletions

View File

@ -4,6 +4,7 @@
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<title>Maloja - KEY_TRACKTITLE</title> <title>Maloja - KEY_TRACKTITLE</title>
<script src="javascript/rangeselect.js" async></script>
</head> </head>
<body> <body>
@ -29,11 +30,31 @@
<tr> <tr>
<td> <td>
<h2><a href='/pulse?KEY_SCROBBLELINK&step=year&trail=1'>Pulse</a></h2> <h2><a href='/pulse?KEY_SCROBBLELINK&step=year&trail=1'>Pulse</a></h2>
KEY_PULSE <span onclick="showRange('pulse','days')" class="stat_selector_pulse selector_pulse_days">7 days</span>
| <span onclick="showRange('pulse','weeks')" class="stat_selector_pulse selector_pulse_weeks">12 weeks</span>
| <span onclick="showRange('pulse','months')" class="stat_selector_pulse selector_pulse_months" style="opacity:0.5;">12 months</span>
| <span onclick="showRange('pulse','years')" class="stat_selector_pulse selector_pulse_years">10 years</span>
<br/><br/>
<span class="stat_module_pulse pulse_months">KEY_PULSE_MONTHS</span>
<span class="stat_module_pulse pulse_days" style="display:none;">KEY_PULSE_DAYS</span>
<span class="stat_module_pulse pulse_years" style="display:none;">KEY_PULSE_YEARS</span>
<span class="stat_module_pulse pulse_weeks" style="display:none;">KEY_PULSE_WEEKS</span>
</td> </td>
<td> <td>
<h2><a href='/performance?KEY_SCROBBLELINK&step=year&trail=1'>Performance</a></h2> <h2><a href='/performance?KEY_SCROBBLELINK&step=year&trail=1'>Performance</a></h2>
KEY_PERFORMANCE <span onclick="showRange('pulse','days')" class="stat_selector_pulse selector_pulse_days">7 days</span>
| <span onclick="showRange('pulse','weeks')" class="stat_selector_pulse selector_pulse_weeks">12 weeks</span>
| <span onclick="showRange('pulse','months')" class="stat_selector_pulse selector_pulse_months" style="opacity:0.5;">12 months</span>
| <span onclick="showRange('pulse','years')" class="stat_selector_pulse selector_pulse_years">10 years</span>
<br/><br/>
<span class="stat_module_pulse pulse_months">KEY_PERFORMANCE_MONTHS</span>
<span class="stat_module_pulse pulse_days" style="display:none;">KEY_PERFORMANCE_DAYS</span>
<span class="stat_module_pulse pulse_years" style="display:none;">KEY_PERFORMANCE_YEARS</span>
<span class="stat_module_pulse pulse_weeks" style="display:none;">KEY_PERFORMANCE_WEEKS</span>
</td> </td>
</tr> </tr>
</table> </table>

View File

@ -1,5 +1,6 @@
import urllib import urllib
import database import database
from malojatime import today,thisweek,thismonth,thisyear
def instructions(keys): def instructions(keys):
@ -40,6 +41,17 @@ def instructions(keys):
html_pulse = module_pulse(track=track,step="year",stepn=1,trail=1) html_pulse = module_pulse(track=track,step="year",stepn=1,trail=1)
html_performance = module_performance(track=track,step="year",stepn=1,trail=1) html_performance = module_performance(track=track,step="year",stepn=1,trail=1)
# pulse and rankings
html_pulse_days = module_pulse(track=track,max_=7,since=today().next(-6),step="day",trail=1)
html_pulse_weeks = module_pulse(track=track,max_=12,since=thisweek().next(-11),step="week",trail=1)
html_pulse_months = module_pulse(track=track,max_=12,since=thismonth().next(-11),step="month",trail=1)
html_pulse_years = module_pulse(track=track,max_=10,since=thisyear().next(-9),step="year",trail=1)
html_performance_days = module_performance(track=track,max_=7,since=today().next(-6),step="day",trail=1)
html_performance_weeks = module_performance(track=track,max_=12,since=thisweek().next(-11),step="week",trail=1)
html_performance_months = module_performance(track=track,max_=12,since=thismonth().next(-11),step="month",trail=1)
html_performance_years = module_performance(track=track,max_=10,since=thisyear().next(-9),step="year",trail=1)
replace = { replace = {
"KEY_TRACKTITLE":track.get("title"), "KEY_TRACKTITLE":track.get("title"),
@ -50,8 +62,16 @@ def instructions(keys):
"KEY_SCROBBLELINK":compose_querystring(keys), "KEY_SCROBBLELINK":compose_querystring(keys),
"KEY_MEDALS":html_medals, "KEY_MEDALS":html_medals,
"KEY_SCROBBLELIST":html_scrobbles, "KEY_SCROBBLELIST":html_scrobbles,
"KEY_PULSE":html_pulse, # pulse
"KEY_PERFORMANCE":html_performance "KEY_PULSE_MONTHS":html_pulse_months,
"KEY_PULSE_YEARS":html_pulse_years,
"KEY_PULSE_DAYS":html_pulse_days,
"KEY_PULSE_WEEKS":html_pulse_weeks,
# performance
"KEY_PERFORMANCE_MONTHS":html_performance_months,
"KEY_PERFORMANCE_YEARS":html_performance_years,
"KEY_PERFORMANCE_DAYS":html_performance_days,
"KEY_PERFORMANCE_WEEKS":html_performance_weeks,
} }
return (replace,pushresources) return (replace,pushresources)