Skip to content

Commit

Permalink
Fix to pull
Browse files Browse the repository at this point in the history
  • Loading branch information
VemAak committed Oct 23, 2024
1 parent 0faf8ae commit 1bd0eb3
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 5 deletions.
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
exclude: 'static/.*'
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v5.0.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: check-merge-conflict
- id: check-added-large-files
- repo: https://github.com/psf/black
rev: 24.3.0
rev: 24.10.0
hooks:
- id: black
- repo: https://github.com/PyCQA/isort
rev: 5.13.2
hooks:
- id: isort
- repo: https://github.com/PyCQA/flake8
rev: 7.0.0
rev: 7.1.1
hooks:
- id: flake8
7 changes: 6 additions & 1 deletion nablapps/core/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from nablapps.blog.models import BlogPost

from ..accounts.models import FysmatClass
from ..events.models import Event
from ..events.models import Event, EventRegistration
from ..nabladet.models import Nablad
from ..nablaforum.models import Channel, Message, Thread
from ..news.models import FrontPageNews
Expand Down Expand Up @@ -67,6 +67,11 @@ def get_context_data(self, **kwargs):
context["logged_in"] = True if self.request.user.is_authenticated else False
# Uncomment when fadderperiode to display new student popup.
# context["newuser_popup"] = False if self.request.user.is_authenticated else True

# TODO: fiks SQL query
context["bedpres_leaderboard"] = EventRegistration.objects.raw(
"""SELECT COUNT(attendance_registration), username from EventRegistration JOIN users WHERE EventRegistration.userId = users.id JOIN event where EventRegistration.eventId = event.id WHERE EventRegistration.date > "2024 - 08 - 10" AND EventRegistration.date < "2025 - 06 - 20" AND event.is_bedpres GROUP BY userId LIMIT 10"""
)
return context

def _add_news(self, context):
Expand Down
4 changes: 4 additions & 0 deletions static/css/front_page.css
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,10 @@
grid-area: poll;
}

.leaderboard {
grid-area: leaderboard;
}

.latest-podcast {
grid-area: latest-podcast;
}
Expand Down
11 changes: 10 additions & 1 deletion templates/front_page.html
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,16 @@ <h5 class="nabla-frontpage-header">
<div class="leaderboard d-flex flex-column">
<h5 class="nabla-frontpage-header">
Bedpres leaderboard
</h5>
</h5> <!-- Ren kok fra code_golf.html -->
<table style="width:100%">
<tr><th>Bruker</th><th>Antall Bedpres</th></tr>
{% for t in bedpres_leaderboard %}
<tr>
<td>{{t.user.get_full_name}}</td>
<td>{{t.length}}</td> <!-- TODO: hva skal stå her istedenfor length???, Funker dette egentlig? -->
</tr>
{% endfor %}
</table>
</div>

<div class="latest-nablad d-flex flex-column">
Expand Down

0 comments on commit 1bd0eb3

Please sign in to comment.