Simplify user delete loop

This commit is contained in:
JonnyWong16 2020-04-10 13:27:26 -07:00
parent faac6b11c2
commit 104e2929df
No known key found for this signature in database
GPG key ID: B1F1F9807184697A
2 changed files with 5 additions and 5 deletions

View file

@ -673,11 +673,10 @@ class Users(object):
# Get the user_ids corresponding to the row_ids # Get the user_ids corresponding to the row_ids
result = monitor_db.select('SELECT user_id FROM users ' result = monitor_db.select('SELECT user_id FROM users '
'WHERE id IN ({})'.format(','.join(['?'] * len(row_ids))), row_ids) 'WHERE id IN ({})'.format(','.join(['?'] * len(row_ids))), row_ids)
user_ids = [user['user_id'] for user in result]
success = [] success = []
for user_id in user_ids: for user in result:
success.append(self.delete(user_id=user_id, purge_only=purge_only)) success.append(self.delete(user_id=user['user_id'], purge_only=purge_only))
return all(success) return all(success)
elif str(user_id).isdigit(): elif str(user_id).isdigit():

View file

@ -1072,7 +1072,7 @@ class WebInterface(object):
"duration": 2998290, "duration": 2998290,
"friendly_name": "Jon Snow", "friendly_name": "Jon Snow",
"guid": "com.plexapp.agents.thetvdb://121361/6/1?lang=en", "guid": "com.plexapp.agents.thetvdb://121361/6/1?lang=en",
"id": 1121, "history_row_id": 1121,
"ip_address": "xxx.xxx.xxx.xxx", "ip_address": "xxx.xxx.xxx.xxx",
"is_active": 1, "is_active": 1,
"keep_history": "Checked", "keep_history": "Checked",
@ -1088,6 +1088,7 @@ class WebInterface(object):
"player": "Plex Web (Chrome)", "player": "Plex Web (Chrome)",
"plays": 487, "plays": 487,
"rating_key": 153037, "rating_key": 153037,
"row_id": 1,
"thumb": "/library/metadata/153036/thumb/1462175062", "thumb": "/library/metadata/153036/thumb/1462175062",
"transcode_decision": "transcode", "transcode_decision": "transcode",
"user_id": 133788, "user_id": 133788,
@ -1290,7 +1291,7 @@ class WebInterface(object):
"data": "data":
[{"friendly_name": "Jon Snow", [{"friendly_name": "Jon Snow",
"guid": "com.plexapp.agents.thetvdb://121361/6/1?lang=en", "guid": "com.plexapp.agents.thetvdb://121361/6/1?lang=en",
"id": 1121, "history_row_id": 1121,
"ip_address": "xxx.xxx.xxx.xxx", "ip_address": "xxx.xxx.xxx.xxx",
"last_played": "Game of Thrones - The Red Woman", "last_played": "Game of Thrones - The Red Woman",
"last_seen": 1462591869, "last_seen": 1462591869,