diff --git a/bartenders/admin.py b/bartenders/admin.py
index 018a2b6..2f3683f 100644
--- a/bartenders/admin.py
+++ b/bartenders/admin.py
@@ -5,6 +5,7 @@
from django.contrib import admin, messages
from django.contrib.auth import get_user_model
from django.http import HttpResponseRedirect
+from django.template.response import TemplateResponse
from django.urls import reverse
from django.utils import timezone
from django.utils.safestring import mark_safe
@@ -223,3 +224,40 @@ def change_view(self, request, object_id, form_url="", extra_context=None):
@admin.register(Poll)
class PollAdmin(admin.ModelAdmin):
pass
+
+
+@custom_admin_view("bartenders", "Bartender shift streaks")
+def streaks_view(admin, request):
+ shifts = BartenderShift.objects.all().filter(end_datetime__lte=timezone.now())
+ shift_streaks = []
+ for shift in shifts:
+ shift_streaks.append(shift.streak())
+ sorted_shift_streaks = sorted(shift_streaks, key=lambda x: x[0], reverse=True)
+ sorted_shift_streaks_short = []
+ for shift in sorted_shift_streaks:
+ found = False
+ for sorted_shift in sorted_shift_streaks_short:
+ if shift[1] == sorted_shift[1]:
+ found = True
+ break
+ if not found:
+ sorted_shift_streaks_short.append(shift)
+
+ current_shift = shifts.filter(
+ start_datetime__lte=timezone.now() + datetime.timedelta(days=2),
+ end_datetime__gte=timezone.now() - datetime.timedelta(days=5),
+ )
+ shift_placement = 0
+ for i, shift in enumerate(sorted_shift_streaks):
+ if shift[2] == current_shift[0].end_datetime:
+ shift_placement = i + 1
+ break
+
+ context = dict(
+ # Include common variables for rendering the admin template.
+ admin.admin_site.each_context(request),
+ # Anything else you want in the context...
+ shift_streaks=sorted_shift_streaks_short,
+ shift_placement=shift_placement,
+ )
+ return TemplateResponse(request, "streak_admin.html", context)
diff --git a/bartenders/templates/streak_admin.html b/bartenders/templates/streak_admin.html
new file mode 100644
index 0000000..e9bc77a
--- /dev/null
+++ b/bartenders/templates/streak_admin.html
@@ -0,0 +1,26 @@
+{% extends "admin/base_site.html" %}
+{% load i18n %}
+{% load static %}
+{% load bootstrap_icons %}
+{% block content %}
+
+ {% if shift_streaks %}
+
+
+ {% translate "Placering" %} |
+ {% translate "Streak" %} |
+ {% translate "Start - Slut" %} |
+
+
+ {% for streak, start_date, end_date in shift_streaks %}
+
+ {{ forloop.counter }} |
+ {{ streak}}{% if forloop.counter == shift_placement %}{% bs_icon 'fire' size='0.8em' %}{% endif%} |
+ {{ start_date| date:"d M, Y" }} - {{ end_date| date:"d M, Y" }} |
+
+ {% endfor %}
+
+
+ {% endif %}
+
+{% endblock %}
diff --git a/locale/da/LC_MESSAGES/django.po b/locale/da/LC_MESSAGES/django.po
index 02e5cf5..7883dc2 100644
--- a/locale/da/LC_MESSAGES/django.po
+++ b/locale/da/LC_MESSAGES/django.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2024-12-30 13:04+0100\n"
+"POT-Creation-Date: 2024-12-30 13:27+0100\n"
"PO-Revision-Date: 2024-12-23 21:27+0050\n"
"Last-Translator: \n"
"Language-Team: LANGUAGE \n"
@@ -362,6 +362,18 @@ msgstr ""
msgid "Bartendertilmeldingen er lukket."
msgstr ""
+#: bartenders/templates/streak_admin.html:10
+msgid "Placering"
+msgstr ""
+
+#: bartenders/templates/streak_admin.html:11
+msgid "Streak"
+msgstr ""
+
+#: bartenders/templates/streak_admin.html:12
+msgid "Start - Slut"
+msgstr ""
+
#: bartenders/views.py:69
msgid "Din ansøgning er blevet indsendt."
msgstr ""
diff --git a/locale/en/LC_MESSAGES/django.mo b/locale/en/LC_MESSAGES/django.mo
index 773e7f6..2054964 100644
Binary files a/locale/en/LC_MESSAGES/django.mo and b/locale/en/LC_MESSAGES/django.mo differ
diff --git a/locale/en/LC_MESSAGES/django.po b/locale/en/LC_MESSAGES/django.po
index 9a59644..8737253 100644
--- a/locale/en/LC_MESSAGES/django.po
+++ b/locale/en/LC_MESSAGES/django.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2024-12-30 13:04+0100\n"
+"POT-Creation-Date: 2024-12-30 13:27+0100\n"
"PO-Revision-Date: 2024-12-30 13:06+0050\n"
"Last-Translator: \n"
"Language-Team: LANGUAGE \n"
@@ -242,8 +242,7 @@ msgstr "Are you sure?"
#: bartenders/templates/bartender_info.html:49
#: bartenders/templates/bartender_info.html:56
msgid ""
-"Husk at du som inaktiv bartender ikke kan komme til "
-"bartenderarrangementerne."
+"Husk at du som inaktiv bartender ikke kan komme til bartenderarrangementerne."
msgstr ""
"Remember that as an inactive bartender you cannot come to the bartender "
"events."
@@ -351,8 +350,8 @@ msgid ""
"begivenheder, såsom ølsmagning og lign. Alt sammen gratis for bartendere."
msgstr ""
"In addition to this, you are invited to our annual events for bartenders, "
-"such as the Summer Party and the Christmas Lunch. In addition, there will be"
-" ongoing cool events, such as beer tasting and the like. All free for "
+"such as the Summer Party and the Christmas Lunch. In addition, there will be "
+"ongoing cool events, such as beer tasting and the like. All free for "
"bartenders."
#: bartenders/templates/index.html:16
@@ -379,6 +378,18 @@ msgstr "Submit"
msgid "Bartendertilmeldingen er lukket."
msgstr "Bartender applications are closed."
+#: bartenders/templates/streak_admin.html:10
+msgid "Placering"
+msgstr "Placement"
+
+#: bartenders/templates/streak_admin.html:11
+msgid "Streak"
+msgstr "Streak"
+
+#: bartenders/templates/streak_admin.html:12
+msgid "Start - Slut"
+msgstr "Start - Finish"
+
#: bartenders/views.py:69
msgid "Din ansøgning er blevet indsendt."
msgstr "Your application has been submitted."
@@ -814,8 +825,8 @@ msgstr "Guides"
#: guides/templates/guides.html:9
msgctxt "Fredagscaféen"
msgid ""
-"Her ligger alle de lækre guides, som er rare at have, når man involverer sig"
-" i driften af"
+"Her ligger alle de lækre guides, som er rare at have, når man involverer sig "
+"i driften af"
msgstr ""
"Here are all the delicious guides that are nice to have when you get "
"involved in the operation of"
@@ -831,16 +842,22 @@ msgstr ""
#: items/templates/items.html:11
msgid ""
"\n"
-"\tHer kan du se Fredagscaféens faste sortiment, og mange af de ting vi er kendte for at sælge.\n"
-"\tMen derudover finder du altid et stort sortiment af spændende og nye specialøl, for enhver smag, i baren.\n"
-"\tVi har i Fredagscaféen et stort fokus på at have noget for alle, så derfor finder du også flere\n"
+"\tHer kan du se Fredagscaféens faste sortiment, og mange af de ting vi er "
+"kendte for at sælge.\n"
+"\tMen derudover finder du altid et stort sortiment af spændende og nye "
+"specialøl, for enhver smag, i baren.\n"
+"\tVi har i Fredagscaféen et stort fokus på at have noget for alle, så derfor "
+"finder du også flere\n"
"\tglutenfrie og alkoholfrie øl.\n"
"\t"
msgstr ""
"\n"
-"Here you can see Fredagscaféen's fixed selection and many of the things we are known for selling.\n"
-"But in addition, you will always find a large range of exciting and new specialty beers, for every taste, in the bar.\n"
-"At Fredagscaféen, we have a big focus on having something for everyone, so you will also find more\n"
+"Here you can see Fredagscaféen's fixed selection and many of the things we "
+"are known for selling.\n"
+"But in addition, you will always find a large range of exciting and new "
+"specialty beers, for every taste, in the bar.\n"
+"At Fredagscaféen, we have a big focus on having something for everyone, so "
+"you will also find more\n"
"gluten-free and alcohol-free beers."
#: items/templates/items.html:22
@@ -969,8 +986,8 @@ msgstr "Expected consumption"
#: udlejning/models.py:64
msgid ""
-"Hvilke slags øl eller andre drikkevarer ønskes der og hvor mange fustager af"
-" hver type?"
+"Hvilke slags øl eller andre drikkevarer ønskes der og hvor mange fustager af "
+"hver type?"
msgstr ""
"What types of beer or other beverages are desired and how many kegs of each "
"type?"
@@ -1072,8 +1089,8 @@ msgid ""
"Hvis vores anlæg ikke allerede er udlånt, kan du låne det ved at udfylde "
"ansøgninsformularen nederst på denne side."
msgstr ""
-"If our equipment is not already on loan, you can borrow it by filling in the"
-" application form at the bottom of this page."
+"If our equipment is not already on loan, you can borrow it by filling in the "
+"application form at the bottom of this page."
#: udlejning/templates/udlejning.html:38
msgid "Anlæg udlånes kun til"
@@ -1097,8 +1114,7 @@ msgstr "Internal events"
#: udlejning/templates/udlejning.html:42
msgid ""
-"Udelukkende arrangementer der finder sted på universitetet. Dette "
-"inkluderer:"
+"Udelukkende arrangementer der finder sted på universitetet. Dette inkluderer:"
msgstr "Exclusive events that take place at the university. This includes:"
#: udlejning/templates/udlejning.html:44
@@ -1115,8 +1131,8 @@ msgstr "Events with association"
#: udlejning/templates/udlejning.html:50
msgid ""
-"Arrangementer der finder sted på universitetet eller andetsteds, kan være af"
-" privat natur. Dette inkluderer:"
+"Arrangementer der finder sted på universitetet eller andetsteds, kan være af "
+"privat natur. Dette inkluderer:"
msgstr ""
"Events that take place at the university or elsewhere may be of a private "
"nature. This includes:"
@@ -1146,9 +1162,9 @@ msgid ""
"Forløber som det har gjort indtil nu, udlån inkluderer opstilling, kulsyre "
"og skylning af anlægget, 50 glas (1 rulle) tilkøbes for 150,- pr. stk."
msgstr ""
-"Precursor as it has been until now, lending includes setting up, carbonation"
-" and rinsing of the system, 50 cups (1 roll) can be purchased for DKK 150 "
-"per PCS."
+"Precursor as it has been until now, lending includes setting up, carbonation "
+"and rinsing of the system, 50 cups (1 roll) can be purchased for DKK 150 per "
+"PCS."
#: udlejning/templates/udlejning.html:66
msgid ""
@@ -1157,9 +1173,9 @@ msgid ""
"Afleveringstid af anlægget skal aftales i dialog med den ansvarlige for det "
"praktiske, og er ikke nødvendigvis samme dag."
msgstr ""
-"Here, loans only include unlocking and unlocking of the draft beer facility."
-" This means that the plant must be picked up in Ada-0, and delivered cleaned"
-" in Ada-0. The delivery time of the installation must be agreed in dialogue "
+"Here, loans only include unlocking and unlocking of the draft beer facility. "
+"This means that the plant must be picked up in Ada-0, and delivered cleaned "
+"in Ada-0. The delivery time of the installation must be agreed in dialogue "
"with the person responsible for the practical, and is not necessarily the "
"same day."
@@ -1169,10 +1185,10 @@ msgstr "Request rental in good time"
#: udlejning/templates/udlejning.html:72
msgid ""
-"Når du låner et anlæg, skal der på udlåningsdagen samt tilbagelevering, være"
-" et bestyrelsesmedlem der står for det praktiske. Vi er alle frivillige og "
-"har studier og jobs ved siden af vorest bestyrelsesarbejde, og derfor kan vi"
-" ikke være sikre på at kunne stille et besyterelsesmedlem til rådighed."
+"Når du låner et anlæg, skal der på udlåningsdagen samt tilbagelevering, være "
+"et bestyrelsesmedlem der står for det praktiske. Vi er alle frivillige og "
+"har studier og jobs ved siden af vorest bestyrelsesarbejde, og derfor kan vi "
+"ikke være sikre på at kunne stille et besyterelsesmedlem til rådighed."
msgstr ""
"When you borrow a facility, there must be a board member responsible for "
"practical matters on the day of lending and return. We are all volunteers "
@@ -1193,15 +1209,15 @@ msgid ""
"mulighed for at være der i en af de mulige tidsrum. Hvis ikke du skriver "
"mindst 7 dage i forvejen, kan vi ikke garantere at vi kan melde ud hvorvidt "
"udlejning er muligt i god tid, dog er det stadig muligt at kunne låne "
-"anlægget selv hvis man melder ud i dårlig tid, vi kan blot ikke garantere at"
-" der kommer et svar i god tid."
+"anlægget selv hvis man melder ud i dårlig tid, vi kan blot ikke garantere at "
+"der kommer et svar i god tid."
msgstr ""
"We will therefore, no later than 5 days before, announce whether someone on "
"the board has the opportunity to be there during one of the possible times. "
"If you do not write at least 7 days in advance, we cannot guarantee that we "
"can announce whether or not renting is possible in good time, however it is "
-"still possible to borrow the facility even if you announce at a bad time, we"
-" just cannot guarantee that there will be an answer in good time."
+"still possible to borrow the facility even if you announce at a bad time, we "
+"just cannot guarantee that there will be an answer in good time."
#: udlejning/templates/udlejning.html:79
msgid "Generelle informationer"
@@ -1217,8 +1233,7 @@ msgstr "Our primary draft beer is"
#: udlejning/templates/udlejning.html:91
msgid ""
-", som kommer i 25 liters fustager. Prisen er 750 kr. pr. fustage (incl. "
-"moms)"
+", som kommer i 25 liters fustager. Prisen er 750 kr. pr. fustage (incl. moms)"
msgstr ""
", which comes in 25 liter kegs. The price is DKK 750 per keg (incl. VAT)"
@@ -1239,16 +1254,15 @@ msgid ""
"Vi sælger også Magners Cider på fustage, der koster 1250 kr. pr. fustage "
"(incl. moms)."
msgstr ""
-"We also sell Magners Cider in kegs, which costs DKK 1250 per keg (incl. "
-"VAT)."
+"We also sell Magners Cider in kegs, which costs DKK 1250 per keg (incl. VAT)."
#: udlejning/templates/udlejning.html:106
msgid ""
"Vi har et sortiment af special-øl tilgængeligt på: (det er ikke tilgængelig "
"pt. men man kan skrive en mail til"
msgstr ""
-"We have a range of specialty beers available at: (it is not available at the"
-" moment, but you can write an e-mail to"
+"We have a range of specialty beers available at: (it is not available at the "
+"moment, but you can write an e-mail to"
#: udlejning/templates/udlejning.html:109
msgid ""
@@ -1384,19 +1398,29 @@ msgstr "General info"
#: web/templates/about.html:11
msgid ""
"\n"
-"Fredagscaféen er en studenterdrevet bar på Institut for Datalogi, Aarhus Universitet,\n"
-"som siden 1993 har været et socialt samlingspunkt for studerende og ansatte på instituttet.\n"
-"Vi er kendt for vores store udvalg af specialøl, der kontinuerligt udskiftes.\n"
-"Derudover har vi fokus på at have noget for enhver smag og prisklasse, og vi har altid\n"
-"et stort udvalg af sodavand, cider, shots, glutenfri øl og alkoholfrie alternativer.\n"
+"Fredagscaféen er en studenterdrevet bar på Institut for Datalogi, Aarhus "
+"Universitet,\n"
+"som siden 1993 har været et socialt samlingspunkt for studerende og ansatte "
+"på instituttet.\n"
+"Vi er kendt for vores store udvalg af specialøl, der kontinuerligt "
+"udskiftes.\n"
+"Derudover har vi fokus på at have noget for enhver smag og prisklasse, og vi "
+"har altid\n"
+"et stort udvalg af sodavand, cider, shots, glutenfri øl og alkoholfrie "
+"alternativer.\n"
"Vi er samtidig den eneste fredagsbar i landet, der fast har pilsner fra\n"
msgstr ""
"\n"
-"Fredagscaféen is a student-run bar at the Department of Computer Science, Aarhus University,\n"
-"which has been a social gathering place for students and employees at the department since 1993.\n"
-"We are known for our large selection of specialty beers, which are constantly being changed.\n"
-"In addition, we focus on having something for every taste and price range, and we always have\n"
-"a large selection of soda, cider, shots, gluten-free beer and non-alcoholic alternatives.\n"
+"Fredagscaféen is a student-run bar at the Department of Computer Science, "
+"Aarhus University,\n"
+"which has been a social gathering place for students and employees at the "
+"department since 1993.\n"
+"We are known for our large selection of specialty beers, which are "
+"constantly being changed.\n"
+"In addition, we focus on having something for every taste and price range, "
+"and we always have\n"
+"a large selection of soda, cider, shots, gluten-free beer and non-alcoholic "
+"alternatives.\n"
"We are also the only Friday bar in the country that always has lager from\n"
#: web/templates/about.html:20
@@ -1417,20 +1441,24 @@ msgstr "here"
#: web/templates/about.html:27
msgid ""
"\n"
-"Fredagscaféen drives af en frivillig bestyrelse, der består af studerende på instituttet,\n"
+"Fredagscaféen drives af en frivillig bestyrelse, der består af studerende på "
+"instituttet,\n"
"som også kan ses\n"
msgstr ""
"\n"
-"Fredagscaféen is run by a volunteer board of directors consisting of students at the department,\n"
+"Fredagscaféen is run by a volunteer board of directors consisting of "
+"students at the department,\n"
"which can also be seen\n"
#: web/templates/about.html:32
msgid ""
"\n"
-"Baren er non-profit, og overskuddet går til vedligeholdelse af baren og arrangementer for bartenderene.\n"
+"Baren er non-profit, og overskuddet går til vedligeholdelse af baren og "
+"arrangementer for bartenderene.\n"
msgstr ""
"\n"
-"The bar is non-profit, and the profits go towards maintaining the bar and events for the bartenders.\n"
+"The bar is non-profit, and the profits go towards maintaining the bar and "
+"events for the bartenders.\n"
#: web/templates/about.html:39
msgid "befinder sig kælderen i Nygaard-bygningen på Institut for Datalogi"
@@ -1583,22 +1611,12 @@ msgid "Missing from environment"
msgstr "Missing from environment"
#: web/views.py:52
-msgid ""
-"Login mail sendt: Tryk på linket i din modtagede mail for at logge ind."
+msgid "Login mail sendt: Tryk på linket i din modtagede mail for at logge ind."
msgstr "Login mail sent: Press the link in your received email to log in."
#~ msgid "Se bare tabellen nedenfor, over vores længste streaks."
#~ msgstr "Just look at the table below, of our longest streaks."
-#~ msgid "Placering"
-#~ msgstr "Placement"
-
-#~ msgid "Streak"
-#~ msgstr "Streak"
-
-#~ msgid "Start - Slut"
-#~ msgstr "Start - Finish"
-
#~ msgid "i træk"
#~ msgstr "in a row"