mirror of
https://github.com/krateng/maloja.git
synced 2023-08-10 21:12:55 +03:00
Added link between pulse and performance views
This commit is contained in:
parent
b1d012c7b0
commit
5a575b9457
@ -482,7 +482,7 @@ def get_top_tracks(**keys):
|
||||
rngs = ranges(**{k:keys[k] for k in keys if k in ["since","to","within","timerange","step","stepn","trail"]})
|
||||
results = []
|
||||
|
||||
for (a,b) in rngs:
|
||||
for rng in rngs:
|
||||
try:
|
||||
res = db_aggregate(timerange=rng,by="TRACK")[0]
|
||||
results.append({"range":rng,"track":res["track"],"scrobbles":res["scrobbles"]})
|
||||
|
@ -13,7 +13,7 @@
|
||||
<div style="background-image:url('KEY_IMAGEURL')"></div>
|
||||
</td>
|
||||
<td class="text">
|
||||
<h1>KEY_PULSEDETAILS Performance</h1><br/>
|
||||
<h1>KEY_PULSEDETAILS Performance</h1>KEY_PULSE_LINK<br/>
|
||||
<span>KEY_LIMITS</span>
|
||||
<!--<p class="stats">KEY_SCROBBLES Scrobbles</p>-->
|
||||
<br/><br/>
|
||||
|
@ -5,12 +5,18 @@ import database
|
||||
def instructions(keys):
|
||||
from utilities import getArtistImage, getTrackImage
|
||||
from htmlgenerators import artistLink, artistLinks, trackLink, scrobblesLink
|
||||
from urihandler import compose_querystring, uri_to_internal
|
||||
from urihandler import compose_querystring, uri_to_internal, internal_to_uri
|
||||
from htmlmodules import module_performance, module_filterselection
|
||||
from malojatime import range_desc, delimit_desc
|
||||
|
||||
filterkeys, timekeys, delimitkeys, _ = uri_to_internal(keys)
|
||||
|
||||
#equivalent pulse chart
|
||||
pulselink_keys = internal_to_uri({**filterkeys,**timekeys,**delimitkeys})
|
||||
pulselink = "/pulse?" + compose_querystring(pulselink_keys)
|
||||
|
||||
pulselink = "<a href=\"" + pulselink + "\"><span>View Pulse</span></a>"
|
||||
|
||||
|
||||
# describe the scope (and creating a key for the relevant artist or track)
|
||||
limitstring = ""
|
||||
@ -50,7 +56,9 @@ def instructions(keys):
|
||||
|
||||
html_performance = module_performance(**filterkeys,**timekeys,**delimitkeys)
|
||||
|
||||
replace = {"KEY_PERFORMANCE_TABLE":html_performance,
|
||||
replace = {
|
||||
"KEY_PULSE_LINK":pulselink,
|
||||
"KEY_PERFORMANCE_TABLE":html_performance,
|
||||
"KEY_IMAGEURL":imgurl,
|
||||
"KEY_LIMITS":limitstring,
|
||||
"KEY_PULSEDETAILS":delimitstring,
|
||||
|
@ -13,7 +13,7 @@
|
||||
<div style="background-image:url('KEY_IMAGEURL')"></div>
|
||||
</td>
|
||||
<td class="text">
|
||||
<h1>KEY_PULSEDETAILS Pulse</h1><br/>
|
||||
<h1>KEY_PULSEDETAILS Pulse</h1>KEY_RANKINGS_LINK<br/>
|
||||
<span>KEY_LIMITS</span>
|
||||
<!--<p class="stats">KEY_SCROBBLES Scrobbles</p>-->
|
||||
<br/><br/>
|
||||
|
@ -5,12 +5,21 @@ import database
|
||||
def instructions(keys):
|
||||
from utilities import getArtistImage, getTrackImage
|
||||
from htmlgenerators import artistLink, artistLinks, trackLink, scrobblesLink
|
||||
from urihandler import compose_querystring, uri_to_internal
|
||||
from urihandler import compose_querystring, uri_to_internal, internal_to_uri
|
||||
from htmlmodules import module_pulse, module_filterselection
|
||||
from malojatime import range_desc, delimit_desc
|
||||
|
||||
filterkeys, timekeys, delimitkeys, _ = uri_to_internal(keys)
|
||||
|
||||
#equivalent performance chart if we're not looking at the overall pulse
|
||||
if len(filterkeys) != 0:
|
||||
performancelink_keys = internal_to_uri({**filterkeys,**timekeys,**delimitkeys})
|
||||
performancelink = "/performance?" + compose_querystring(performancelink_keys)
|
||||
|
||||
performancelink = "<a href=\"" + performancelink + "\"><span>View Rankings</span></a>"
|
||||
else:
|
||||
performancelink = ""
|
||||
|
||||
|
||||
# describe the scope (and creating a key for the relevant artist or track)
|
||||
limitstring = ""
|
||||
@ -50,6 +59,13 @@ def instructions(keys):
|
||||
|
||||
html_pulse = module_pulse(**filterkeys,**timekeys,**delimitkeys)
|
||||
|
||||
replace = {"KEY_PULSE_TABLE":html_pulse,"KEY_IMAGEURL":imgurl,"KEY_LIMITS":limitstring,"KEY_PULSEDETAILS":delimitstring,"KEY_FILTERSELECTOR":html_filterselector}
|
||||
replace = {
|
||||
"KEY_RANKINGS_LINK":performancelink,
|
||||
"KEY_PULSE_TABLE":html_pulse,
|
||||
"KEY_IMAGEURL":imgurl,
|
||||
"KEY_LIMITS":limitstring,
|
||||
"KEY_PULSEDETAILS":delimitstring,
|
||||
"KEY_FILTERSELECTOR":html_filterselector
|
||||
}
|
||||
|
||||
return (replace,pushresources)
|
||||
|
Loading…
Reference in New Issue
Block a user