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

Feat: Added Card for level Wise issue solved #179

Merged
merged 1 commit into from
Oct 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions user_profile/templates/user_profile/issue_card.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<div class='d-flex justify-content-center gap-3 my-3'>
<div class='px-5 py-3 fs-3 bg-white' style='width: 200px; border-radius: 7px;'>
<h5>Total Issues Solved:</h5>
<p>
<strong>{{ totalProblemsSolved }}</strong>
</p>
</div>
<div class='d-flex flex-column px-5 py-3 bg-white gap-3' style='border-radius: 7px;'>
<div class='nav-item badge badge-pill badge-primary' role='presentation'>
<a class='nav-link' style='border-radius: 7px;' id='easy-tab' role='tab' aria-controls='easy-tab' aria-selected='true'>
<div class='text-center fs-6'>
<b>Easy Problems :</b>
<span>{{ easyProblems }}</span>
</div>
</a>
</div>
<div class='nav-item badge badge-pill badge-warning' role='presentation'>
<a class='nav-link' style='border-radius: 7px;' id='medium-tab' role='tab' aria-controls='medium-tab' aria-selected='false'>
<div class='text-center fs-6'>
<b>Medium Problems :</b>
<span>{{ mediumProblems }}</span>
</div>
</a>
</div>
<div class='nav-item badge badge-pill badge-danger' role='presentation'>
<a class='nav-link' style='border-radius: 7px;' id='hard-tab' role='tab' aria-controls='hard-tab' aria-selected='false'>
<div class='text-center fs-6'>
<b>Hard Problems :</b>
<span>{{ hardProblems }}</span>
</div>
</a>
</div>
</div>
</div>
1 change: 1 addition & 0 deletions user_profile/templates/user_profile/profile.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

{% 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
11 changes: 10 additions & 1 deletion user_profile/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ def profile(request, username):
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()
totalProblemsSolved = PullRequest.objects.filter(contributor=user, state=1).count()

pr_form = PRSubmissionForm()
judge_form = PRJudgeForm()

Expand All @@ -74,7 +79,11 @@ 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,
"totalProblemsSolved": totalProblemsSolved,
}
return render(request, 'user_profile/profile.html', context=context)
else:
Expand Down
Loading