added a method for returning a list of IDs of places a user has visited

This commit is contained in:
ellie 2022-10-29 23:43:10 +01:00
parent 6428e984a6
commit a0618b058e

View file

@ -168,4 +168,16 @@ class DB:
def deleteUser(self, ID):
cursor = self.conn.cursor()
cursor.execute('DELETE FROM users WHERE ID = ?', ID)
cursor.commit()
cursor.commit()
def getUserLocations(self, ID):
array_locations = []
cursor = self.conn.cursor()
cursor.execute('SELECT * FROM places_visited WHERE userID = ?', ID)
result = cursor.fetchall()
for x in result:
array_locations.append(x[2])
return array_locations
#should return a list of IDs of places the user has visited