@@ -117,7 +117,7 @@ def get(self, url_tag):
117117 except APIError as e :
118118 return {"success" : False , "message" : e .message , "count" : 0 }, 500
119119
120- def post (self , url_tag ):
120+ def post (self , url_tag ): # pylint: disable=unused-argument
121121 """Add or update a user to the scoreboard for an existing game."""
122122 req = request .get_json ()
123123 check_auth (req , req ["user_id" ])
@@ -141,21 +141,21 @@ def post(self, url_tag):
141141 if len (res .data ) > 0 :
142142 # TODO if user has previous submission, update it
143143 return {"success" : True , "data" : res .data , "count" : len (res .data )}
144- else :
145- # if user has no previous submission, insert new row
146- res = (
147- supabase .table ("scoreboard_games_profiles" )
148- .insert (
149- {
150- "game_id" : game_id ,
151- "user_id" : user_id ,
152- "details" : details ,
153- }
154- )
155- .execute ()
144+
145+ # if user has no previous submission, insert new row
146+ res = (
147+ supabase .table ("scoreboard_games_profiles" )
148+ .insert (
149+ {
150+ "game_id" : game_id ,
151+ "user_id" : user_id ,
152+ "details" : details ,
153+ }
156154 )
155+ .execute ()
156+ )
157157
158- return {"success" : True , "data" : res .data , "count" : len (res .data )}
158+ return {"success" : True , "data" : res .data , "count" : len (res .data )}
159159
160160 except APIError as e :
161161 return {
@@ -187,7 +187,7 @@ def get(self, url_tag):
187187 except APIError as e :
188188 return {"success" : False , "message" : e .message , "count" : 0 }, 500
189189
190- def post (self , url_tag ):
190+ def post (self , url_tag ): # pylint: disable=unused-argument
191191 """Create a new rating/comment for an existing game."""
192192 req = request .get_json ()
193193 check_auth (req , req ["user_id" ])
@@ -215,22 +215,22 @@ def post(self, url_tag):
215215 "success" : False ,
216216 "message" : "You have already left a rating/comment for this game." ,
217217 }
218- else :
219- # if user has no previous rating/comment, insert new row
220- res = (
221- supabase .table ("ratings" )
222- .insert (
223- {
224- "game_id" : game_id ,
225- "user_id" : user_id ,
226- "rating" : rating ,
227- "comment" : comment ,
228- }
229- )
230- .execute ()
218+
219+ # if user has no previous rating/comment, insert new row
220+ res = (
221+ supabase .table ("ratings" )
222+ .insert (
223+ {
224+ "game_id" : game_id ,
225+ "user_id" : user_id ,
226+ "rating" : rating ,
227+ "comment" : comment ,
228+ }
231229 )
230+ .execute ()
231+ )
232232
233- return {"success" : True , "data" : res .data , "count" : len (res .data )}
233+ return {"success" : True , "data" : res .data , "count" : len (res .data )}
234234
235235 except APIError as e :
236236 return {
0 commit comments