Skip to content

Commit

Permalink
Update: Added very-easy problem list
Browse files Browse the repository at this point in the history
  • Loading branch information
VishalMinj committed Oct 20, 2024
1 parent 883e928 commit 1fc632f
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 1 deletion.
27 changes: 27 additions & 0 deletions user_profile/templates/user_profile/issue_card.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<div class='d-flex justify-content-center gap-3 mb-4 flex-wrap'>
<div class='px-5 py-3 fs-1 bg-white align-content-center' style='width: 200px; border-radius: 7px;'> <!-- Left column for total problems -->
<h5>Total Issues Solved:</h5>
<p>

<div>{{ totalProblemsSolved }}</div>
</p>
</div>

<div class='d-flex flex-column p-3 bg-white' style='border-radius: 7px; height: 100%;'>
<div class="d-flex flex-column flex-grow-1 gap-1 ">
<div class="w-100 badge badge-pill flex-grow-1 align-content-center" style="background-color: #33b5e5; padding: .75rem 3rem;">
<div class="box fs-6">Very-easy Issue.: {{ veasyProblems }}</div>
</div>
<div class="w-100 badge badge-pill flex-grow-1 align-content-center" style="background-color: #00b74a; padding: .75rem 3rem;">
<div class="box fs-6">Easy Issue: {{ easyProblems }}</div>
</div>
<div class="w-100 badge badge-pill flex-grow-1 align-content-center" style="background-color: #ffa900; padding: .75rem 3rem;">
<div class="box fs-6">Medium Issue: {{ mediumProblems }}</div>
</div>
<div class="w-100 badge badge-pill flex-grow-1 align-content-center" style="background-color: #ff3547; padding: .75rem 3rem;">
<div class="box fs-6">Hard Issue: {{ hardProblems }}</div>
</div>
</div>
</div>
</div>

3 changes: 3 additions & 0 deletions user_profile/templates/user_profile/profile.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@

{% if user.is_authenticated %}
{% include "user_profile/profile-card.html" %}
{% include "user_profile/issue_card.html" %}



{% comment %}
In Django templates you can use the "get_FOO_display()" method, that will return the readable alias
Expand Down
13 changes: 12 additions & 1 deletion user_profile/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ def profile(request, username):
pending_pr_requests_for_mentor = pr_requests_for_mentor.filter(state=3).order_by("submitted_at")
pr_requests_for_mentor = chain(pending_pr_requests_for_mentor,
accepted_pr_requests_for_mentor, rejected_pr_requests_for_mentor)
easyProblems=PullRequest.objects.filter(contributor=user,issue__level=1,state=1).count()
mediumProblems=PullRequest.objects.filter(contributor=user,issue__level=2,state=1).count()
hardProblems=PullRequest.objects.filter(contributor=user,issue__level=3,state=1).count()
veasyProblems=PullRequest.objects.filter(contributor=user,issue__level=4,state=1).count()
totalProblemsSolved = PullRequest.objects.filter(contributor=user, state=1).count()


pr_form = PRSubmissionForm()
judge_form = PRJudgeForm()
Expand All @@ -74,7 +80,12 @@ def profile(request, username):
"assignment_requests_for_mentor": assignment_requests_for_mentor,
'pr_form': pr_form,
"judge_form": judge_form,
"native_profile": native_profile
"native_profile": native_profile,
"easyProblems": easyProblems,
"mediumProblems": mediumProblems,
"hardProblems": hardProblems,
"veasyProblems": veasyProblems,
"totalProblemsSolved": totalProblemsSolved,
}
return render(request, 'user_profile/profile.html', context=context)
else:
Expand Down

0 comments on commit 1fc632f

Please sign in to comment.