File tree 2 files changed +5
-2
lines changed
2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -88,8 +88,9 @@ def test_get_listens(self):
88
88
# make sure that artist msid, release msid and recording msid are present in data
89
89
self .assertTrue (is_valid_uuid (data ['listens' ][0 ]['recording_msid' ]))
90
90
91
- # check for latest listen timestamp
91
+ # check for latest and oldest listen timestamp
92
92
self .assertEqual (data ['latest_listen_ts' ], ts )
93
+ self .assertEqual (data ['oldest_listen_ts' ], ts )
93
94
94
95
# request with min_ts should work
95
96
response = self .client .get (
@@ -102,6 +103,7 @@ def test_get_listens(self):
102
103
self .assert200 (response )
103
104
self .assertListEqual (response .json ['payload' ]['listens' ], [])
104
105
self .assertEqual (response .json ['payload' ]['latest_listen_ts' ], ts )
106
+ self .assertEqual (response .json ['payload' ]['oldest_listen_ts' ], ts )
105
107
106
108
# test request with both max_ts and min_ts is working
107
109
url = url_for ('api_v1.get_listens' ,
Original file line number Diff line number Diff line change @@ -161,7 +161,7 @@ def get_listens(user_name):
161
161
if min_ts and max_ts and min_ts >= max_ts :
162
162
raise APIBadRequest ("min_ts should be less than max_ts" )
163
163
164
- listens , _ , max_ts_per_user = timescale_connection ._ts .fetch_listens (
164
+ listens , min_ts_per_user , max_ts_per_user = timescale_connection ._ts .fetch_listens (
165
165
user ,
166
166
limit = count ,
167
167
from_ts = datetime .utcfromtimestamp (min_ts ) if min_ts else None ,
@@ -176,6 +176,7 @@ def get_listens(user_name):
176
176
'count' : len (listen_data ),
177
177
'listens' : listen_data ,
178
178
'latest_listen_ts' : int (max_ts_per_user .timestamp ()),
179
+ 'oldest_listen_ts' : int (min_ts_per_user .timestamp ()),
179
180
}})
180
181
181
182
You can’t perform that action at this time.
0 commit comments