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

add lboard api and fix lboard #2

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
2 changes: 1 addition & 1 deletion static/css/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ td{
.list .item .pos {
font-weight: 900;
position: absolute;
left: -2rem;
left: -3.5rem;
text-align: center;
font-size: 1.5rem;
width: 1.5rem;
Expand Down
19 changes: 15 additions & 4 deletions static/css/footer.css
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ section {
}
.footerft #cont {
position: relative;
top: -45px;
top: -20px;
right: 190px;
width: 150px;
height: auto;
Expand All @@ -95,6 +95,10 @@ section {
width: 300px;
margin: auto;
}

.footerft #cont {
top: -40px;
}
}
@media screen and (min-width: 968px) {
.footer_center p {
Expand All @@ -104,14 +108,21 @@ section {
}
}
#logo-img {
width: 35px;
height: 35px;
width: 45px;
height: 45px;
margin: auto;
margin-top: -16px;
}

#arhn-img {
width: 50px;
height: 50px;
margin: auto;
margin-top: -16px;
}

.social_links {
margin-top: 10px;
margin-top: 25px;
}

.fab {
Expand Down
Binary file added static/img/aarohan-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 5 additions & 4 deletions templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
</a>
{%if user.is_authenticated%}
<div class="navbar-brand" style="color:gray;font-family:'Capriola',sans-serif;">
Your Score : <span style="font-weight:bold;color:rgb(8, 119, 8)">{{player.score}} points</span>
Score : <span style="font-weight:bold;color:rgb(8, 119, 8)">{{player.score}} points</span>
</div>
{%endif%}
</div>
Expand Down Expand Up @@ -110,11 +110,12 @@
<div id="container_ft">
<div id="cont">
<div class="footer_center">
<p style="color:white;">&copy; 2020. <strong>Developed by</strong> The GNU Linux Users' Group, NIT Durgapur</p>
<div class="social_links">
<p style="color:white; font-family: 'Squada One'"> Developed by GNU/Linux Users' Group for Aarohan '21</p>
<div class="social_links mt-2">
<a target="__blank" href="https://www.facebook.com/nitdgplug"><i class="fab fa-facebook"></i></a>
<a href="https://www.instagram.com/nitdgplug/" target="_blank"><i class="fab fa-instagram"></i></a>
<a target="__blank" href="https://nitdgplug.org/"><img id="logo-img" src="/static/img/glugLogo.png" alt="Aarohanlogo"></a>
<a target="__blank" href="https://nitdgplug.org/"><img id="logo-img" src="/static/img/glugLogo.png" alt="GLUG Logo"></a>
<a target="__blank" href="https://nitdgplug.org/"><img id="arhn-img" src="/static/img/aarohan-logo.png" alt="Aarohan Logo"></a>
<a href="https://www.linkedin.com/company/lugnitdgp" target="_blank"><i class="fab fa-linkedin"></i></a>
<a href="https://github.com/lugnitdgp" target="_blank"><i class="fab fa-github"></i></a>
</div>
Expand Down
4 changes: 2 additions & 2 deletions templates/index_page.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
Online Treasure
Hunt</h1> -->
<!-- <p style="font-family: 'Capriola', sans-serif;font-size:18px;color:#d3d3d3" class="lead">The exhilaration is
back! Aarohan 2020, brings you another thrilling edition of the Online Trueasure Hunt! Wondering what you need
back! Aarohan 2021, brings you another thrilling edition of the Online Trueasure Hunt! Wondering what you need
to
loot the chest? Patience, a few mugs of coffee, resonably fast internet speed and the most important of all, The
Art
Expand Down Expand Up @@ -47,7 +47,7 @@ <h2 style="color:#1B809E;font-weight:bold;font-size:30px;text-align: center;font
<div class="sidebox border-shadow center">
<h1 class="oth">Online Treasure Hunt</h1>
<p class="lead">The exhilaration is
back! Aarohan 2020, brings you another thrilling edition of the Online Trueasure Hunt! Wondering what you need
back! Aarohan 2021, brings you another thrilling edition of the Online Treasure Hunt! Wondering what you need
to
loot the chest? Patience, a few mugs of coffee, resonably fast internet speed and the most important of all, The
Art
Expand Down
97 changes: 44 additions & 53 deletions templates/lboard.html
Original file line number Diff line number Diff line change
@@ -1,78 +1,69 @@
{%extends 'base.html'%}

{%block content%}
{% extends 'base.html' %} {% block content %}
<div class="row">
<h1 class="text-center" style="color: white; font-family: 'Squada One', cursive; font-size: 5rem;">Leaderboard</h1>
<br>
<h1
class="text-center"
style="color: white; font-family: 'Squada One', cursive; font-size: 5rem"
>
Leaderboard
</h1>
<br />
{% if hide %}
<h4 class="alert alert-warning text-center" style="color: black;">Leaderboard will be active from 10.30 PM, 8th Feb.
<h4
class="text-center"
style="color: white; font-family: 'Squada One', cursive; font-size: 5rem"
>
Leaderboard will be active from 9:00 PM, 2nd April 2021.
</h4>
{% else %}
<div class="col-lg-8 col-lg-offset-2">
{% if players %}
<div class="top3">
<div class="two item">
<div class="pos">
{{ second.rank }}
</div>
<div class="pic" style="background-image: url('{{ second.profile_url }}')"></div>
<div class="name">
{{ second.name }}
</div>
<div class="score">
{{ second.score }}
</div>
<div class="pos">{{ second.rank }}</div>
<div
class="pic"
style="background-image: url('{{ second.profile_url }}')"
></div>
<div class="name">{{ second.name }}</div>
<div class="score">{{ second.score }}</div>
</div>

<div class="one item">
<div class="pos">
{{ first.rank }}
</div>
<div class="pic" style="background-image: url('{{ first.profile_url }}')"></div>
<div class="name">
{{ first.name }}
</div>
<div class="score">
{{ first.score }}
</div>
<div class="pos">{{ first.rank }}</div>
<div
class="pic"
style="background-image: url('{{ first.profile_url }}')"
></div>
<div class="name">{{ first.name }}</div>
<div class="score">{{ first.score }}</div>
</div>

<div class="three item">
<div class="pos">
3
</div>
<div class="pic" style="background-image: url('{{ third.profile_url }}')"></div>
<div class="name">
{{ third.name }}
</div>
<div class="score">
{{ third.score }}
</div>
<div class="pos">3</div>
<div
class="pic"
style="background-image: url('{{ third.profile_url }}')"
></div>
<div class="name">{{ third.name }}</div>
<div class="score">{{ third.score }}</div>
</div>
</div>

</div>
{% if players %}
<div class="list">
{% for player in players %}
<div class="item">
<div class="pos">
{{ player.rank }}
</div>
<div class="pic" style="background-image: url('{{ player.profile_url }}')">
</div>
<div class="name">
{{ player.name }}
</div>
<div class="score">
{{ player.score }}
</div>
<div class="pos">{{ player.rank }}</div>
<div
class="pic"
style="background-image: url('{{ player.profile_url }}')"
></div>
<div class="name">{{ player.name }}</div>
<div class="score">{{ player.score }}</div>
</div>
{% endfor %}
</div>
{% else %}
<strong>There are no players present.</strong>
{% endif %}
</div>
{% endif %}
{% endif %} {% endif %}
</div>
{%endblock%}
{% endblock %}
2 changes: 1 addition & 1 deletion templates/timer.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

{%block content%}
<div class="time-cont">
<h1 class="text-center timer-header">Goes live on 1st April 2021 at 12.00pm</h1>
<h1 class="text-center timer-header">Goes live on 2nd April 2021 @ 9:00 PM</h1>
<p class="opentime" hidden>{{time}}</p>
<div class="container-t container">
<div class="row timer-row">
Expand Down
5 changes: 3 additions & 2 deletions templates/win.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
{%block content%}
<div class="container">
<div class="row d-flex justify-content-center">
<h1 class="congo"> Congratulations!
You have found all the treasures.</h1>
<!-- <h1 class="congo"> Congratulations! You have found all the treasures.</h1> -->
<h2 class="congo"> Thank You for participating in Online Treaure Hunt.</h2>
<h3 class="congo"> See you again next year!</h3>
<div style="width:300px; height:300px;margin:auto">
<div class="text-center">
<figure class="swing">
Expand Down
11 changes: 7 additions & 4 deletions treasure/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ def index(request):
return render(request, 'timer.html', {'time': config.time})

player = models.player.objects.get(user_id=request.user.pk)
if player.current_level > numlevel:
return render(request, 'win.html', {'player': player})
if player.current_level <= lastlevel:
level = models.level.objects.get(l_number=player.current_level)
return render(request, 'level.html', {'player': player, 'level': level})
Expand Down Expand Up @@ -98,7 +100,7 @@ def answer(request):

elif ans == "":
if request.method == "POST":
messages.error(request, "Please enter answer!")
messages.error(request, "Please enter an answer!")
return render(request, 'level.html', {'player': player, 'level': level})

else:
Expand Down Expand Up @@ -128,7 +130,7 @@ def lboard(request):
players = players[3:]
else:
players = []

print(first, second, third)
if request.user.is_authenticated:
return render(request, 'lboard.html', {'players': players, 'player': player, 'first': first, 'second': second, 'third': third, 'hide': False})
else:
Expand All @@ -153,9 +155,10 @@ def lboard_api(request):
leaderboard = list()
for pl in p:
leaderboard.append({
'rank': pl.rank,
'name': pl.name,
'value': str(pl.score),
'email': pl.user.email
'email': pl.user.email,
'score': pl.score,
})

return JsonResponse(leaderboard, safe=False)