-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question status #136
base: master
Are you sure you want to change the base?
Question status #136
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
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 |
question=number, user=user, status='Attempted' | ||
) | ||
except Exception as e: | ||
bottle.abort(500, str(e)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be better to merge the two try catch blocks into one.
status = TextField() | ||
|
||
class Meta: | ||
database = db |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can add an index for the database here.
else: | ||
return bottle.template( | ||
"question.html", question_number=number, contest=code, question=statement, question_status='Submitted' | ||
) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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])
)
Thank You for your contribution to the PyJudge