diff options
author | mahesh | 2016-05-02 17:57:45 +0530 |
---|---|---|
committer | mahesh | 2016-05-04 11:52:01 +0530 |
commit | f3379350276ecd73f4856c4fca006ffb1e857066 (patch) | |
tree | 32262ee290a8d6430245a3758164c131e2b0b072 /yaksh/views.py | |
parent | 7ada338fa018affd304be25c1c0efb935213e4b5 (diff) | |
download | online_test-f3379350276ecd73f4856c4fca006ffb1e857066.tar.gz online_test-f3379350276ecd73f4856c4fca006ffb1e857066.tar.bz2 online_test-f3379350276ecd73f4856c4fca006ffb1e857066.zip |
removed get_user_data
Diffstat (limited to 'yaksh/views.py')
-rw-r--r-- | yaksh/views.py | 29 |
1 files changed, 6 insertions, 23 deletions
diff --git a/yaksh/views.py b/yaksh/views.py index e01c224..587ca57 100644 --- a/yaksh/views.py +++ b/yaksh/views.py @@ -761,26 +761,6 @@ def monitor(request, questionpaper_id=None): return my_render_to_response('yaksh/monitor.html', context, context_instance=ci) -def get_user_data(user_id, questionpaper_id=None, attempt_number = None): - """For a given username, this returns a dictionary of important data - related to the user including all the user's answers submitted. - """ - user = User.objects.get(id=user_id) - papers = AnswerPaper.objects.filter(user=user) - if questionpaper_id and attempt_number is not None: - papers = papers.filter(question_paper_id=questionpaper_id, attempt_number = attempt_number) - if attempt_number == None: - papers = papers.filter(question_paper_id=questionpaper_id).order_by("-attempt_number") - - data = {} - profile = user.profile if hasattr(user, 'profile') else None - data['user'] = user - data['profile'] = profile - data['papers'] = papers - data['questionpaperid'] = questionpaper_id - return data - - @login_required def show_all_users(request): @@ -850,7 +830,8 @@ def user_data(request, user_id, questionpaper_id=None): current_user = request.user if not current_user.is_authenticated() or not is_moderator(current_user): raise Http404('You are not allowed to view this page!') - data = get_user_data(user_id, questionpaper_id) + user = User.objects.get(id=user_id) + data = AnswerPaper.objects.get_user_data(user, questionpaper_id) context = {'data': data} return my_render_to_response('yaksh/user_data.html', context, @@ -928,8 +909,10 @@ def grade_user(request, quiz_id=None, user_id=None, attempt_number=None): attempt_number = attempts[0].attempt_number except IndexError: raise Http404('No attempts for paper') - - data = get_user_data(user_id, questionpaper_id, attempt_number) + user = User.objects.get(id=user_id) + data = AnswerPaper.objects.get_user_data(user,questionpaper_id, + attempt_number + ) context = {'data': data,"quiz_id": quiz_id, "users": user_details, "attempts": attempts,"user_id":user_id |