User Submission History and User Stats#131
Conversation
User Submission History and User Stats
|
We have moved to |
|
I was thinking to have stats for individual users (similar to profiles in online judges), I think here we have stats for all the users. @theSage21 what do you think about this? How should we progress? We can have this these type of stats for the contest/question though |
Updated to include new db changes and user specific data
Updated Code
Updated to check user session cookie, get count from already read database and directly convert to list
|
I have updated the code as per the review comments. |
|
Oh right. You're deleting sessions instead of deactivation. Forgot
I've lost touch with this codebase. I'll schedule some time tomorrow to
work on this
…On Fri 24 May, 2019, 19:27 Rishabh Kalakoti, ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In server.py
<#131 (comment)>:
> @@ -146,6 +143,20 @@ def dashboard():
contests = Contest.select().order_by(Contest.start_time)
return bottle.template("dashboard.html", contests=contests)
***@***.***("/stats")
***@***.***_required
+def statistics():
+ sub_history_temp = Submission.select(Contest.code, ContestProblems.question, Submission.time, Submission.is_correct)\
+ .where(Session.token == bottle.request.get_cookie("s_id"))\
+ .join(ContestProblems, on=(Submission.contestProblem == ContestProblems.id)) \
+ .join(Session, on=(Submission.user == Session.user))\
Adding a session as foreign key to submission doesn't look right to me.
Eg.
User logged in. Made a submission with session Id = 12345. Logged out.
(That session entry would be deleted from the database on logging out).
So, when we search for that session while calculating stats, it won't be
available anymore.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#131?email_source=notifications&email_token=AB2WHULWPCTVB6WZZ632R6DPW7X35A5CNFSM4HPGGX2KYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOBZUOMDQ#discussion_r287371122>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AB2WHUKNQICI5WZM2DKZFVTPW7X35ANCNFSM4HPGGX2A>
.
|
|
Ok so I should be getting the user ID from bottle and using that to reference the records right? I don't know exactly how. I'll figure it out tomorrow. |
|
Maybe use something like: |
Updated to handle statsitics even if the session changes
|
I have deployed the code with the changes that Rishabh suggested. |
Updated as per @rishabhKalakoti and @ theSage21 comments
|
Updated the code as per the comments given above, @rishabhKalakoti and @theSage21 |
theSage21
left a comment
There was a problem hiding this comment.
This looks good to go. Can you please run it through https://github.com/python/black
Formatted code
|
I have formatted the code using Black |
User Submission History and User Stats (PyJaipur#131)
User Submission History and User Stats (PyJaipur#131)


User Submission History and User Stats