Open
Conversation
User Submission History and User Stats
use sqlite as database (PyJaipur#126)
Updated to latest code
User Submission History and User Stats (PyJaipur#131)
Updating Code in Fork
Removing redundant code
Added table to store Question status for specific user and display it
Contributor
Author
Member
|
I'm sorry. I've been away for so long that I don't remember the details of this project. I'll take a look when I have free time |
rishabhKalakoti
suggested changes
Aug 8, 2019
| question=number, user=user, status='Attempted' | ||
| ) | ||
| except Exception as e: | ||
| bottle.abort(500, str(e)) |
Contributor
There was a problem hiding this comment.
I think it would be better to merge the two try catch blocks into one.
| status = TextField() | ||
|
|
||
| class Meta: | ||
| database = db |
Contributor
There was a problem hiding this comment.
We can add an index for the database here.
| return bottle.template( | ||
| "question.html", question_number=number, contest=code, question=statement, question_status='Submitted' | ||
| ) | ||
|
|
Contributor
There was a problem hiding this comment.
It would be better to directly return the question_status extracted from the query. Also, right now the status shows Submitted/ Not Submitted, it would be better to instead use Accepted/ Wrong Answer/ Unattempted.
Contributor
There was a problem hiding this comment.
We can also avoid the if-else block by using something like:
question_status = QuestionStatus.select(QuestionStatus.status).where(
(QuestionStatus.question == number) & (QuestionStatus.user == user)
).dicts().get()
return bottle.template(
"question.html", question_number=number, contest=code, question=statement,
question_status= ((question_status[status]==Null)?"Unattempted":question_status[status])
)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Thank You for your contribution to the PyJudge