Closed jaymeklein closed 3 months ago
Yeah, you can keep that change. By, "After adding the return statement to the Database.get method, the endpoint properly returned the requested data", do you mean changing the following section of code in backend/database/database.py
:
From:
def get(self, path):
""" Get data from database """
self.db.get(path)
To:
def get(self, path):
""" Get data from database """
return self.db.get(path)
Or do you mean splitting line 126 into two lines as you mentioned before?
First option. The change on line 126 was just for debugging purposes.
The change that actually solved the problem was the return
statement on these lines, as you said:
return self.db.get(path)
Should i mention this issue on my future api-testing PR? Or should i open a PR just for this change?
You can mention it in the future PR... there's probably less need to make a PR for that one thing just yet
I was starting to test the
/api/get-flashcard
endpoint, which is returningNone
regardless of given data: Valid data json:And this is is the current data in
data.json
:This is the
path
argument passed inDatabase.get
method:/users/1/flashcards/109048371178679571656833207928626960824600184952382683242495299362286693266526
The
LocalDatabase.get
method returns the expected data:But when it comes to the
Database.get
method, his return is alwaysNone
.I changed the line 126 from
return jsonify(db.get("/users/" + user_id + "/flashcards/" + flashcard_id))
in two different lines, just for purpose of debugging:Does the
data
value fromdb.get
shouldn't be the same asLocalDatabase.get
?After adding the
return
statement to theDatabase.get
method, the endpoint properly returned the requested data.Should i keep this change for the next commit?