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

Fixed scrobbles view

This commit is contained in:
Krateng 2021-01-12 18:47:18 +01:00
parent a42ed56d2d
commit c4a9c6dc0f
2 changed files with 8 additions and 3 deletions

View File

@ -57,6 +57,11 @@ def get_scrobbles_external(**keys):
ckeys = {**k_filter, **k_time, **k_amount} ckeys = {**k_filter, **k_time, **k_amount}
result = get_scrobbles(**ckeys) result = get_scrobbles(**ckeys)
offset = (k_amount.get('page') * k_amount.get('perpage')) if k_amount.get('perpage') is not math.inf else 0
result = result[offset:]
if k_amount.get('perpage') is not math.inf: result = result[:k_amount.get('perpage')]
return {"list":result} return {"list":result}

View File

@ -269,9 +269,9 @@ def api_key_correct(request):
def get_scrobbles(**keys): def get_scrobbles(**keys):
r = db_query(**{k:keys[k] for k in keys if k in ["artist","artists","title","since","to","within","timerange","associated","track"]}) r = db_query(**{k:keys[k] for k in keys if k in ["artist","artists","title","since","to","within","timerange","associated","track"]})
offset = (keys.get('page') * keys.get('perpage')) if keys.get('perpage') is not math.inf else 0 #offset = (keys.get('page') * keys.get('perpage')) if keys.get('perpage') is not math.inf else 0
r = r[offset:] #r = r[offset:]
if keys.get('perpage') is not math.inf: r = r[:keys.get('perpage')] #if keys.get('perpage') is not math.inf: r = r[:keys.get('perpage')]
return r return r