Skip to content

Commit

Permalink
Return unique results
Browse files Browse the repository at this point in the history
It's easier to do here.
Go is stupid and doesn't have support for sets natively.
It also doesn't have a method to get all the keys of a map. Gotta write that yourself.
  • Loading branch information
Earlopain committed Feb 9, 2024
1 parent 702d66e commit 4e620d2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def ids():
if sha256(auth_string).hexdigest() != auth:
abort(403)
cur = get_db().cursor()
cur.execute('SELECT discord_id FROM discord_names WHERE user_id = ?', (id,))
cur.execute('SELECT DISTINCT discord_id FROM discord_names WHERE user_id = ?', (id,))
results = cur.fetchall()
results = [x[0] for x in results]
return jsonify(ids=results)
Expand All @@ -101,7 +101,7 @@ def e6ids():
if sha256(auth_string).hexdigest() != auth:
abort(403)
cur = get_db().cursor()
cur.execute('SELECT user_id FROM discord_names WHERE discord_id = ?', (id,))
cur.execute('SELECT DISTINCT user_id FROM discord_names WHERE discord_id = ?', (id,))
results = cur.fetchall()
results = [x[0] for x in results]
return jsonify(ids=results)
Expand Down

0 comments on commit 4e620d2

Please sign in to comment.