File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -304,15 +304,22 @@ class SatisfactionRatings(Stream):
304
304
305
305
def sync (self , state ):
306
306
bookmark = self .get_bookmark (state )
307
-
308
- satisfaction_ratings = self .client .satisfaction_ratings ()
307
+ bookmark_epoch = int (bookmark .strftime ('%s' ))
308
+ # We substract a second here because the API seems to compare
309
+ # start_time with a >, but we typically prefer a >= behavior.
310
+ # Also, the start_time query parameter filters based off of
311
+ # created_at, but we found during testing that
312
+ # satisfaction_ratings are immutable, and any updates actually
313
+ # create a new satisfaction rating, so that updated_at always
314
+ # equals created_at
315
+ satisfaction_ratings = self .client .satisfaction_ratings (start_time = (bookmark_epoch - 1 ))
309
316
for satisfaction_rating in satisfaction_ratings :
310
317
if utils .strptime_with_tz (satisfaction_rating .updated_at ) >= bookmark :
311
318
# NB: We don't trust that the records come back ordered by
312
319
# updated_at (we've observed out-of-order records),
313
320
# so we can't save state until we've seen all records
314
321
self .update_bookmark (state , satisfaction_rating .updated_at )
315
- yield (self .stream , satisfaction_rating )
322
+ yield (self .stream , satisfaction_rating )
316
323
317
324
class Groups (Stream ):
318
325
name = "groups"
You can’t perform that action at this time.
0 commit comments