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

Update: Conflict resolve and card update #184

Closed
wants to merge 5 commits into from
Closed
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
65 changes: 8 additions & 57 deletions home/templates/home/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -66,36 +66,7 @@
background: #1C2331 !important;
}
}

</style>
<script>
document.addEventListener("DOMContentLoaded", function () {
const pastOrganisersSection = document.getElementById("pastorganizers");
if (pastOrganisersSection) {
const yearLinks = pastOrganisersSection.querySelectorAll('[id="year"]');
const organisersSections = pastOrganisersSection.querySelectorAll(".row");
organisersSections.forEach((section) => {
section.style.display = "none";
});

yearLinks.forEach((yearLink) => {
yearLink.addEventListener("click", function (e) {
e.preventDefault();
const selectedYear = this.getAttribute("data-year");
organisersSections.forEach((section) => {
if (section.getAttribute("data-year") === selectedYear) {
section.style.display = "block";
section.style.display="flex";
} else {
section.style.display = "none";
}
});
});
});
}
});

</script>
</head>

<body>
Expand Down Expand Up @@ -441,13 +412,8 @@ <h5 class="card-title">LDK</h5>
<section id="pastorganizers" class="pt-5 pb-5 shadow-sm">
<h2 class="h2 mb-5 text-center display-5 font-weight-bold">Past organizers</h2>
<div class="container">
<button id="year" type="button" class="btn btn-outline-dark w-100" data-year="2024">
<div class="mx-auto px-6 md:px-12 w-100">
<h2 class="text-3xl text-center text-gray-800 md:text-4xl font-bold">Team 2024</h2>
</div>
</button>
<div class="row mx-1" data-year="2024">
<div class="col-xs-12 col-sm-12 col-md-6 col-lg-3 mb-3 d-flex align-items-stretch justify-content-center">
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-6 col-lg-3 mb-3 d-flex align-items-stretch justify-content-center">
<div class="card justify-content-center align-items-center">
<img src="{% static 'img/profile/shank.jpg' %}" class="card-img-top w-100" alt="Card Image"
style="max-height: 250px; object-fit: cover;">
Expand Down Expand Up @@ -504,14 +470,9 @@ <h5 class="card-title">Amit Kumar</h5>
</div>
</div>
</div>
</div>
</div>
<div class="container">
<button id="year" type="button" class="btn btn-outline-dark w-100" data-year="2023">
<div class="mx-auto px-6 md:px-12 w-100">
<h2 class="text-3xl text-center text-gray-800 md:text-4xl font-bold">Team 2023</h2>
</div>
</button>
<div class="row mx-1" data-year="2023">
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-6 col-lg-4 mb-3 d-flex align-items-stretch justify-content-center">
<div class="card justify-content-center align-items-center">
<img src="{% static 'img/profile/ss.jpg' %}" class="card-img-top w-100" alt="Card Image"
Expand Down Expand Up @@ -555,7 +516,7 @@ <h5 class="card-title">Lovedeep Singh Kamal</h5>
</div>
</div>
</div>
<div class="row justify-content-center" data-year="2023">
<div class="row justify-content-center">
<div class="col-xs-12 col-sm-12 col-md-6 col-lg-4 mb-3 d-flex align-items-stretch justify-content-center">
<div class="card justify-content-center align-items-center">
<img src="{% static 'img/profile/sy.jpeg' %}" class="card-img-top w-100" alt="Card Image"
Expand Down Expand Up @@ -585,12 +546,7 @@ <h5 class="card-title">Divyansh Upadhyay</h5>
</div>
</div>
</div>
<button id="year" type="button" class="btn btn-outline-dark w-100" data-year="2022">
<div class="mx-auto px-6 md:px-12 w-100">
<h2 class="text-3xl text-center text-gray-800 md:text-4xl font-bold">Team 2022</h2>
</div>
</button>
<div class="row mx-1" data-year="2022">
<div class="row">

<div class="col-xs-12 col-sm-12 col-md-6 col-lg-3 mb-3 d-flex align-items-stretch justify-content-center">
<div class="card justify-content-center align-items-center">
Expand Down Expand Up @@ -655,12 +611,7 @@ <h5 class="card-title">Ankit Sangwan</h5>
</div>
</div>
<div class="container">
<button id="year" type="button" class="btn btn-outline-dark w-100" data-year="2021">
<div class="mx-auto px-6 md:px-12 w-100">
<h2 class="text-3xl text-center text-gray-800 md:text-4xl font-bold ">Team 2021-Below</h2>
</div>
</button>
<div class="row mx-1" data-year="2021">
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-6 col-lg-3 mb-3 d-flex align-items-stretch justify-content-center">
<div class="card justify-content-center align-items-center">
<img src="{% static 'img/profile/abhey.png' %}" class="card-img-top" alt="Card Image"
Expand Down Expand Up @@ -890,4 +841,4 @@ <h3 class="dark-grey-text text-center">

</body>

</html>
</html>
30 changes: 30 additions & 0 deletions user_profile/templates/user_profile/issue_card.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@



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

2 changes: 2 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,8 @@

{% 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
12 changes: 11 additions & 1 deletion user_profile/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ 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 +79,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
Loading