Skip to content
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

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Conversation

rsvarma95
Copy link
Contributor

Thank You for your contribution to the PyJudge

  • I am going to add the question-status feature ( Unfinished Open PR )

User Submission History and User Stats
Updated to latest code
User Submission History and User Stats (PyJaipur#131)
Removing redundant code
Added table to store Question status for specific user and display it
@rsvarma95
Copy link
Contributor Author

I added the functionality to display the status of the question
image

@theSage21
Copy link
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

question=number, user=user, status='Attempted'
)
except Exception as e:
bottle.abort(500, str(e))
Copy link
Contributor

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
Copy link
Contributor

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'
)

Copy link
Contributor

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.

Copy link
Contributor

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])
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants