From 96a608f3a40a69275f26b22b2981438e6732e4dc Mon Sep 17 00:00:00 2001
From: Nadja Geisler <ngeisler@fachschaft.informatik.tu-darmstadt.de>
Date: Fri, 29 Oct 2021 12:06:29 +0200
Subject: [PATCH 1/6] add interest window

adds datetimefield for start to Event model
adds datetimefield for start to Event model
adds translations
adds migration
---
 .../locale/de_DE/LC_MESSAGES/django.po        |   4 +-
 AKModel/locale/de_DE/LC_MESSAGES/django.po    | 310 +++++++++---------
 AKModel/migrations/0049_interest_window.py    |  24 ++
 AKModel/models.py                             |  11 +-
 AKPlan/locale/de_DE/LC_MESSAGES/django.po     |  30 +-
 AKPlanning/locale/de_DE/LC_MESSAGES/django.po |   6 +-
 .../locale/de_DE/LC_MESSAGES/django.po        |   6 +-
 .../locale/de_DE/LC_MESSAGES/django.po        |  48 ++-
 locale/de_DE/LC_MESSAGES/django.po            |   2 +-
 9 files changed, 243 insertions(+), 198 deletions(-)
 create mode 100644 AKModel/migrations/0049_interest_window.py

diff --git a/AKDashboard/locale/de_DE/LC_MESSAGES/django.po b/AKDashboard/locale/de_DE/LC_MESSAGES/django.po
index 0e9393ff..fef5cc12 100644
--- a/AKDashboard/locale/de_DE/LC_MESSAGES/django.po
+++ b/AKDashboard/locale/de_DE/LC_MESSAGES/django.po
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2021-04-29 22:48+0000\n"
+"POT-Creation-Date: 2021-10-29 09:57+0000\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -116,7 +116,7 @@ msgstr "AK \"%(ak)s\" bearbeitet."
 msgid "AK \"%(ak)s\" deleted."
 msgstr "AK \"%(ak)s\" gelöscht."
 
-#: AKDashboard/views.py:58
+#: AKDashboard/views.py:61
 #, python-format
 msgid "AK \"%(ak)s\" (re-)scheduled."
 msgstr "AK \"%(ak)s\" (um-)geplant."
diff --git a/AKModel/locale/de_DE/LC_MESSAGES/django.po b/AKModel/locale/de_DE/LC_MESSAGES/django.po
index 740582d5..713074cd 100644
--- a/AKModel/locale/de_DE/LC_MESSAGES/django.po
+++ b/AKModel/locale/de_DE/LC_MESSAGES/django.po
@@ -2,7 +2,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2021-10-28 20:45+0000\n"
+"POT-Creation-Date: 2021-10-29 09:57+0000\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -65,17 +65,17 @@ msgstr "Die eingegebene Verfügbarkeit enthält ein ungültiges Datum."
 msgid "Please fill in your availabilities!"
 msgstr "Bitte Verfügbarkeiten eintragen!"
 
-#: AKModel/availability/models.py:38 AKModel/models.py:47 AKModel/models.py:111
-#: AKModel/models.py:165 AKModel/models.py:184 AKModel/models.py:216
-#: AKModel/models.py:270 AKModel/models.py:335 AKModel/models.py:368
-#: AKModel/models.py:478
+#: AKModel/availability/models.py:38 AKModel/models.py:52 AKModel/models.py:116
+#: AKModel/models.py:171 AKModel/models.py:190 AKModel/models.py:222
+#: AKModel/models.py:276 AKModel/models.py:342 AKModel/models.py:375
+#: AKModel/models.py:485
 msgid "Event"
 msgstr "Event"
 
-#: AKModel/availability/models.py:39 AKModel/models.py:112
-#: AKModel/models.py:166 AKModel/models.py:185 AKModel/models.py:217
-#: AKModel/models.py:271 AKModel/models.py:336 AKModel/models.py:369
-#: AKModel/models.py:479
+#: AKModel/availability/models.py:39 AKModel/models.py:117
+#: AKModel/models.py:172 AKModel/models.py:191 AKModel/models.py:223
+#: AKModel/models.py:277 AKModel/models.py:343 AKModel/models.py:376
+#: AKModel/models.py:486
 msgid "Associated event"
 msgstr "Zugehöriges Event"
 
@@ -87,8 +87,8 @@ msgstr "Person"
 msgid "Person whose availability this is"
 msgstr "Person deren Verfügbarkeit hier abgebildet wird"
 
-#: AKModel/availability/models.py:56 AKModel/models.py:339
-#: AKModel/models.py:358 AKModel/models.py:487
+#: AKModel/availability/models.py:56 AKModel/models.py:346
+#: AKModel/models.py:365 AKModel/models.py:494
 msgid "Room"
 msgstr "Raum"
 
@@ -96,8 +96,8 @@ msgstr "Raum"
 msgid "Room whose availability this is"
 msgstr "Raum dessen Verfügbarkeit hier abgebildet wird"
 
-#: AKModel/availability/models.py:65 AKModel/models.py:276
-#: AKModel/models.py:357 AKModel/models.py:434
+#: AKModel/availability/models.py:65 AKModel/models.py:282
+#: AKModel/models.py:364 AKModel/models.py:441
 msgid "AK"
 msgstr "AK"
 
@@ -105,8 +105,8 @@ msgstr "AK"
 msgid "AK whose availability this is"
 msgstr "Verfügbarkeiten"
 
-#: AKModel/availability/models.py:74 AKModel/models.py:169
-#: AKModel/models.py:493
+#: AKModel/availability/models.py:74 AKModel/models.py:175
+#: AKModel/models.py:500
 msgid "AK Category"
 msgstr "AK-Kategorie"
 
@@ -135,9 +135,9 @@ msgstr "AK-Kategorien kopieren"
 msgid "Copy ak requirements"
 msgstr "AK-Anforderungen kopieren"
 
-#: AKModel/models.py:16 AKModel/models.py:158 AKModel/models.py:181
-#: AKModel/models.py:200 AKModel/models.py:214 AKModel/models.py:232
-#: AKModel/models.py:328
+#: AKModel/models.py:16 AKModel/models.py:163 AKModel/models.py:187
+#: AKModel/models.py:206 AKModel/models.py:220 AKModel/models.py:238
+#: AKModel/models.py:334
 msgid "Name"
 msgstr "Name"
 
@@ -196,54 +196,70 @@ msgid "When should AKs with intention to submit a resolution be done?"
 msgstr "Wann sollen AKs mit Resolutionsabsicht stattgefunden haben?"
 
 #: AKModel/models.py:30
+msgid "Interest Window Start"
+msgstr "Beginn Interessensbekundung"
+
+#: AKModel/models.py:31
+msgid "Opening time for expression of interest."
+msgstr "Öffnungszeitpunkt für die Angabe von Interesse an AKs."
+
+#: AKModel/models.py:32
+msgid "Interest Window End"
+msgstr "Ende Interessensbekundung"
+
+#: AKModel/models.py:33
+msgid "Closing time for expression of interest."
+msgstr "Öffnungszeitpunkt für die Angabe von Interesse an AKs."
+
+#: AKModel/models.py:35
 msgid "Public event"
 msgstr "Öffentliches Event"
 
-#: AKModel/models.py:31
+#: AKModel/models.py:36
 msgid "Show this event on overview page."
 msgstr "Zeige dieses Event auf der Übersichtseite an"
 
-#: AKModel/models.py:33
+#: AKModel/models.py:38
 msgid "Active State"
 msgstr "Aktiver Status"
 
-#: AKModel/models.py:33
+#: AKModel/models.py:38
 msgid "Marks currently active events"
 msgstr "Markiert aktuell aktive Events"
 
-#: AKModel/models.py:34
+#: AKModel/models.py:39
 msgid "Plan Hidden"
 msgstr "Plan verborgen"
 
-#: AKModel/models.py:34
+#: AKModel/models.py:39
 msgid "Hides plan for non-staff users"
 msgstr "Verbirgt den Plan für Nutzer*innen ohne erweiterte Rechte"
 
-#: AKModel/models.py:37
+#: AKModel/models.py:42
 msgid "Base URL"
 msgstr "URL-Prefix"
 
-#: AKModel/models.py:37
+#: AKModel/models.py:42
 msgid "Prefix for wiki link construction"
 msgstr "Prefix für die automatische Generierung von Wiki-Links"
 
-#: AKModel/models.py:38
+#: AKModel/models.py:43
 msgid "Wiki Export Template Name"
 msgstr "Wiki-Export Templatename"
 
-#: AKModel/models.py:39
+#: AKModel/models.py:44
 msgid "Default Slot Length"
 msgstr "Standardslotlänge"
 
-#: AKModel/models.py:40
+#: AKModel/models.py:45
 msgid "Default length in hours that is assumed for AKs in this event."
 msgstr "Standardlänge von Slots (in Stunden) für dieses Event"
 
-#: AKModel/models.py:42
+#: AKModel/models.py:47
 msgid "Contact email address"
 msgstr "E-Mail Kontaktadresse"
 
-#: AKModel/models.py:44
+#: AKModel/models.py:49
 msgid ""
 "An email address that is displayed on every page and can be used for all "
 "kinds of questions"
@@ -251,75 +267,75 @@ msgstr ""
 "Eine Mailadresse die auf jeder Seite angezeigt wird und für alle Arten von "
 "Fragen genutzt werden kann"
 
-#: AKModel/models.py:48
+#: AKModel/models.py:53
 msgid "Events"
 msgstr "Events"
 
-#: AKModel/models.py:106
+#: AKModel/models.py:111
 msgid "Nickname"
 msgstr "Spitzname"
 
-#: AKModel/models.py:106
+#: AKModel/models.py:111
 msgid "Name to identify an AK owner by"
 msgstr "Name, durch den eine AK-Leitung identifiziert wird"
 
-#: AKModel/models.py:107
+#: AKModel/models.py:112
 msgid "Slug"
 msgstr "Slug"
 
-#: AKModel/models.py:107
+#: AKModel/models.py:112
 msgid "Slug for URL generation"
 msgstr "Slug für URL-Generierung"
 
-#: AKModel/models.py:108
+#: AKModel/models.py:113
 msgid "Institution"
 msgstr "Instutution"
 
-#: AKModel/models.py:108
+#: AKModel/models.py:113
 msgid "Uni etc."
 msgstr "Universität o.ä."
 
-#: AKModel/models.py:109 AKModel/models.py:241
+#: AKModel/models.py:114 AKModel/models.py:247
 msgid "Web Link"
 msgstr "Internet Link"
 
-#: AKModel/models.py:109
+#: AKModel/models.py:114
 msgid "Link to Homepage"
 msgstr "Link zu Homepage oder Webseite"
 
-#: AKModel/models.py:115 AKModel/models.py:486
+#: AKModel/models.py:120 AKModel/models.py:493
 msgid "AK Owner"
 msgstr "AK-Leitung"
 
-#: AKModel/models.py:116
+#: AKModel/models.py:121
 msgid "AK Owners"
 msgstr "AK-Leitungen"
 
-#: AKModel/models.py:158
+#: AKModel/models.py:163
 msgid "Name of the AK Category"
 msgstr "Name der AK-Kategorie"
 
-#: AKModel/models.py:159 AKModel/models.py:182
+#: AKModel/models.py:164 AKModel/models.py:188
 msgid "Color"
 msgstr "Farbe"
 
-#: AKModel/models.py:159 AKModel/models.py:182
+#: AKModel/models.py:164 AKModel/models.py:188
 msgid "Color for displaying"
 msgstr "Farbe für die Anzeige"
 
-#: AKModel/models.py:160 AKModel/models.py:235
+#: AKModel/models.py:165 AKModel/models.py:241
 msgid "Description"
 msgstr "Beschreibung"
 
-#: AKModel/models.py:161
+#: AKModel/models.py:166
 msgid "Short description of this AK Category"
 msgstr "Beschreibung der AK-Kategorie"
 
-#: AKModel/models.py:162
+#: AKModel/models.py:167
 msgid "Present by default"
 msgstr ""
 
-#: AKModel/models.py:163
+#: AKModel/models.py:169
 msgid ""
 "Present AKs of this category by default if AK owner did not specify whether "
 "this AK should be presented?"
@@ -327,152 +343,152 @@ msgstr ""
 "AKs dieser Kategorie standardmäßig vorstellen, wenn die Leitungen das für "
 "ihren AK nicht explizit spezifiziert haben?"
 
-#: AKModel/models.py:170
+#: AKModel/models.py:176
 msgid "AK Categories"
 msgstr "AK-Kategorien"
 
-#: AKModel/models.py:181
+#: AKModel/models.py:187
 msgid "Name of the AK Track"
 msgstr "Name des AK-Tracks"
 
-#: AKModel/models.py:188
+#: AKModel/models.py:194
 msgid "AK Track"
 msgstr "AK-Track"
 
-#: AKModel/models.py:189
+#: AKModel/models.py:195
 msgid "AK Tracks"
 msgstr "AK-Tracks"
 
-#: AKModel/models.py:200
+#: AKModel/models.py:206
 msgid "Name of the AK Tag"
 msgstr "Name das AK-Tags"
 
-#: AKModel/models.py:203
+#: AKModel/models.py:209
 msgid "AK Tag"
 msgstr "AK-Tag"
 
-#: AKModel/models.py:204
+#: AKModel/models.py:210
 msgid "AK Tags"
 msgstr "AK-Tags"
 
-#: AKModel/models.py:214
+#: AKModel/models.py:220
 msgid "Name of the Requirement"
 msgstr "Name der Anforderung"
 
-#: AKModel/models.py:220 AKModel/models.py:490
+#: AKModel/models.py:226 AKModel/models.py:497
 msgid "AK Requirement"
 msgstr "AK-Anforderung"
 
-#: AKModel/models.py:221
+#: AKModel/models.py:227
 msgid "AK Requirements"
 msgstr "AK-Anforderungen"
 
-#: AKModel/models.py:232
+#: AKModel/models.py:238
 msgid "Name of the AK"
 msgstr "Name des AKs"
 
-#: AKModel/models.py:233
+#: AKModel/models.py:239
 msgid "Short Name"
 msgstr "Kurzer Name"
 
-#: AKModel/models.py:234
+#: AKModel/models.py:240
 msgid "Name displayed in the schedule"
 msgstr "Name zur Anzeige im AK-Plan"
 
-#: AKModel/models.py:235
+#: AKModel/models.py:241
 msgid "Description of the AK"
 msgstr "Beschreibung des AKs"
 
-#: AKModel/models.py:237
+#: AKModel/models.py:243
 msgid "Owners"
 msgstr "Leitungen"
 
-#: AKModel/models.py:238
+#: AKModel/models.py:244
 msgid "Those organizing the AK"
 msgstr "Menschen, die den AK organisieren und halten"
 
-#: AKModel/models.py:241
+#: AKModel/models.py:247
 msgid "Link to wiki page"
 msgstr "Link zur Wiki Seite"
 
-#: AKModel/models.py:242
+#: AKModel/models.py:248
 msgid "Protocol Link"
 msgstr "Protokolllink"
 
-#: AKModel/models.py:242
+#: AKModel/models.py:248
 msgid "Link to protocol"
 msgstr "Link zum Protokoll"
 
-#: AKModel/models.py:244
+#: AKModel/models.py:250
 msgid "Category"
 msgstr "Kategorie"
 
-#: AKModel/models.py:245
+#: AKModel/models.py:251
 msgid "Category of the AK"
 msgstr "Kategorie des AKs"
 
-#: AKModel/models.py:246
+#: AKModel/models.py:252
 msgid "Tags"
 msgstr "Tags"
 
-#: AKModel/models.py:246
+#: AKModel/models.py:252
 msgid "Tags provided by owners"
 msgstr "Tags, die durch die AK-Leitung vergeben wurden"
 
-#: AKModel/models.py:247
+#: AKModel/models.py:253
 msgid "Track"
 msgstr "Track"
 
-#: AKModel/models.py:248
+#: AKModel/models.py:254
 msgid "Track the AK belongs to"
 msgstr "Track zu dem der AK gehört"
 
-#: AKModel/models.py:250
+#: AKModel/models.py:256
 msgid "Resolution Intention"
 msgstr "Resolutionsabsicht"
 
-#: AKModel/models.py:251
+#: AKModel/models.py:257
 msgid "Intends to submit a resolution"
 msgstr "Beabsichtigt eine Resolution einzureichen"
 
-#: AKModel/models.py:252
+#: AKModel/models.py:258
 msgid "Present this AK"
 msgstr "AK präsentieren"
 
-#: AKModel/models.py:253
+#: AKModel/models.py:259
 msgid "Present results of this AK"
 msgstr "Die Ergebnisse dieses AKs vorstellen"
 
-#: AKModel/models.py:255 AKModel/templates/admin/AKModel/status.html:91
+#: AKModel/models.py:261 AKModel/templates/admin/AKModel/status.html:91
 msgid "Requirements"
 msgstr "Anforderungen"
 
-#: AKModel/models.py:256
+#: AKModel/models.py:262
 msgid "AK's Requirements"
 msgstr "Anforderungen des AKs"
 
-#: AKModel/models.py:258
+#: AKModel/models.py:264
 msgid "Conflicting AKs"
 msgstr "AK-Konflikte"
 
-#: AKModel/models.py:259
+#: AKModel/models.py:265
 msgid "AKs that conflict and thus must not take place at the same time"
 msgstr ""
 "AKs, die Konflikte haben und deshalb nicht gleichzeitig stattfinden dürfen"
 
-#: AKModel/models.py:260
+#: AKModel/models.py:266
 msgid "Prerequisite AKs"
 msgstr "Vorausgesetzte AKs"
 
-#: AKModel/models.py:261
+#: AKModel/models.py:267
 msgid "AKs that should precede this AK in the schedule"
 msgstr "AKs die im AK-Plan vor diesem AK stattfinden müssen"
 
-#: AKModel/models.py:263
+#: AKModel/models.py:269
 msgid "Organizational Notes"
 msgstr "Notizen zur Organisation"
 
-#: AKModel/models.py:264
+#: AKModel/models.py:270
 msgid ""
 "Notes to organizers. These are public. For private notes, please send an e-"
 "mail."
@@ -480,258 +496,258 @@ msgstr ""
 "Notizen an die Organisator*innen. Diese sind öffentlich, für private "
 "Anmerkungen bitte eine E-Mail schicken."
 
-#: AKModel/models.py:266
+#: AKModel/models.py:272
 msgid "Interest"
 msgstr "Interesse"
 
-#: AKModel/models.py:266
+#: AKModel/models.py:272
 msgid "Expected number of people"
 msgstr "Erwartete Personenzahl"
 
-#: AKModel/models.py:267
+#: AKModel/models.py:273
 msgid "Interest Counter"
 msgstr "Interessenszähler"
 
-#: AKModel/models.py:268
+#: AKModel/models.py:274
 msgid "People who have indicated interest online"
 msgstr "Anzahl Personen, die online Interesse bekundet haben"
 
-#: AKModel/models.py:277 AKModel/models.py:481
+#: AKModel/models.py:283 AKModel/models.py:488
 #: AKModel/templates/admin/AKModel/status.html:49
 #: AKModel/templates/admin/AKModel/status.html:56 AKModel/views.py:335
 msgid "AKs"
 msgstr "AKs"
 
-#: AKModel/models.py:328
+#: AKModel/models.py:334
 msgid "Name or number of the room"
 msgstr "Name oder Nummer des Raums"
 
-#: AKModel/models.py:329
+#: AKModel/models.py:335
 msgid "Location"
 msgstr "Ort"
 
-#: AKModel/models.py:330
+#: AKModel/models.py:336
 msgid "Name or number of the location"
 msgstr "Name oder Nummer des Ortes"
 
-#: AKModel/models.py:331
+#: AKModel/models.py:337
 msgid "Capacity"
 msgstr "Kapazität"
 
-#: AKModel/models.py:331
+#: AKModel/models.py:338
 msgid "Maximum number of people (-1 for unlimited)."
 msgstr "Maximale Personenzahl (-1 wenn unbeschränkt)."
 
-#: AKModel/models.py:332
+#: AKModel/models.py:339
 msgid "Properties"
 msgstr "Eigenschaften"
 
-#: AKModel/models.py:333
+#: AKModel/models.py:340
 msgid "AK requirements fulfilled by the room"
 msgstr "AK-Anforderungen, die dieser Raum erfüllt"
 
-#: AKModel/models.py:340 AKModel/templates/admin/AKModel/status.html:33
+#: AKModel/models.py:347 AKModel/templates/admin/AKModel/status.html:33
 msgid "Rooms"
 msgstr "Räume"
 
-#: AKModel/models.py:357
+#: AKModel/models.py:364
 msgid "AK being mapped"
 msgstr "AK, der zugeordnet wird"
 
-#: AKModel/models.py:359
+#: AKModel/models.py:366
 msgid "Room the AK will take place in"
 msgstr "Raum in dem der AK stattfindet"
 
-#: AKModel/models.py:360
+#: AKModel/models.py:367
 msgid "Slot Begin"
 msgstr "Beginn des Slots"
 
-#: AKModel/models.py:360
+#: AKModel/models.py:367
 msgid "Time and date the slot begins"
 msgstr "Zeit und Datum zu der der AK beginnt"
 
-#: AKModel/models.py:362
+#: AKModel/models.py:369
 msgid "Duration"
 msgstr "Dauer"
 
-#: AKModel/models.py:363
+#: AKModel/models.py:370
 msgid "Length in hours"
 msgstr "Länge in Stunden"
 
-#: AKModel/models.py:365
+#: AKModel/models.py:372
 msgid "Scheduling fixed"
 msgstr "Planung fix"
 
-#: AKModel/models.py:366
+#: AKModel/models.py:373
 msgid "Length and time of this AK should not be changed"
 msgstr "Dauer und Zeit dieses AKs sollten nicht verändert werden"
 
-#: AKModel/models.py:371
+#: AKModel/models.py:378
 msgid "Last update"
 msgstr "Letzte Aktualisierung"
 
-#: AKModel/models.py:374
+#: AKModel/models.py:381
 msgid "AK Slot"
 msgstr "AK-Slot"
 
-#: AKModel/models.py:375 AKModel/models.py:483
+#: AKModel/models.py:382 AKModel/models.py:490
 msgid "AK Slots"
 msgstr "AK-Slot"
 
-#: AKModel/models.py:397 AKModel/models.py:406
+#: AKModel/models.py:404 AKModel/models.py:413
 msgid "Not scheduled yet"
 msgstr "Noch nicht geplant"
 
-#: AKModel/models.py:435
+#: AKModel/models.py:442
 msgid "AK this message belongs to"
 msgstr "AK zu dem die Nachricht gehört"
 
-#: AKModel/models.py:436
+#: AKModel/models.py:443
 msgid "Message text"
 msgstr "Nachrichtentext"
 
-#: AKModel/models.py:437
+#: AKModel/models.py:444
 msgid "Message to the organizers. This is not publicly visible."
 msgstr ""
 "Nachricht an die Organisator*innen. Diese ist nicht öffentlich sichtbar."
 
-#: AKModel/models.py:441
+#: AKModel/models.py:448
 msgid "AK Orga Message"
 msgstr "AK-Organachricht"
 
-#: AKModel/models.py:442
+#: AKModel/models.py:449
 msgid "AK Orga Messages"
 msgstr "AK-Organachrichten"
 
-#: AKModel/models.py:451
+#: AKModel/models.py:458
 msgid "Constraint Violation"
 msgstr "Constraintverletzung"
 
-#: AKModel/models.py:452 AKModel/templates/admin/AKModel/status.html:79
+#: AKModel/models.py:459 AKModel/templates/admin/AKModel/status.html:79
 msgid "Constraint Violations"
 msgstr "Constraintverletzungen"
 
-#: AKModel/models.py:456
+#: AKModel/models.py:463
 msgid "Owner has two parallel slots"
 msgstr "Leitung hat zwei Slots parallel"
 
-#: AKModel/models.py:457
+#: AKModel/models.py:464
 msgid "AK Slot was scheduled outside the AK's availabilities"
 msgstr "AK Slot wurde außerhalb der Verfügbarkeit des AKs platziert"
 
-#: AKModel/models.py:458
+#: AKModel/models.py:465
 msgid "Room has two AK slots scheduled at the same time"
 msgstr "Raum hat zwei AK Slots gleichzeitig"
 
-#: AKModel/models.py:459
+#: AKModel/models.py:466
 msgid "Room does not satisfy the requirement of the scheduled AK"
 msgstr "Room erfüllt die Anforderungen des platzierten AKs nicht"
 
-#: AKModel/models.py:460
+#: AKModel/models.py:467
 msgid "AK Slot is scheduled at the same time as an AK listed as a conflict"
 msgstr ""
 "AK Slot wurde wurde zur gleichen Zeit wie ein Konflikt des AKs platziert"
 
-#: AKModel/models.py:461
+#: AKModel/models.py:468
 msgid "AK Slot is scheduled before an AK listed as a prerequisite"
 msgstr "AK Slot wurde vor einem als Voraussetzung gelisteten AK platziert"
 
-#: AKModel/models.py:463
+#: AKModel/models.py:470
 msgid ""
 "AK Slot for AK with intention to submit a resolution is scheduled after "
 "resolution deadline"
 msgstr ""
 "AK Slot eines AKs mit Resoabsicht wurde nach der Resodeadline platziert"
 
-#: AKModel/models.py:464
+#: AKModel/models.py:471
 msgid "AK Slot in a category is outside that categories availabilities"
 msgstr "AK Slot wurde außerhalb der Verfügbarkeiten seiner Kategorie"
 
-#: AKModel/models.py:465
+#: AKModel/models.py:472
 msgid "Two AK Slots for the same AK scheduled at the same time"
 msgstr "Zwei AK Slots eines AKs wurden zur selben Zeit platziert"
 
-#: AKModel/models.py:466
+#: AKModel/models.py:473
 msgid "Room does not have enough space for interest in scheduled AK Slot"
 msgstr "Room hat nicht genug Platz für das Interesse am geplanten AK-Slot"
 
-#: AKModel/models.py:467
+#: AKModel/models.py:474
 msgid "AK Slot is scheduled outside the event's availabilities"
 msgstr "AK Slot wurde außerhalb der Verfügbarkeit des Events platziert"
 
-#: AKModel/models.py:470
+#: AKModel/models.py:477
 msgid "Warning"
 msgstr "Warnung"
 
-#: AKModel/models.py:471
+#: AKModel/models.py:478
 msgid "Violation"
 msgstr "Verletzung"
 
-#: AKModel/models.py:473
+#: AKModel/models.py:480
 msgid "Type"
 msgstr "Art"
 
-#: AKModel/models.py:474
+#: AKModel/models.py:481
 msgid "Type of violation, i.e. what kind of constraint was violated"
 msgstr "Art der Verletzung, gibt an welche Art Constraint verletzt wurde"
 
-#: AKModel/models.py:475
+#: AKModel/models.py:482
 msgid "Level"
 msgstr "Level"
 
-#: AKModel/models.py:476
+#: AKModel/models.py:483
 msgid "Severity level of the violation"
 msgstr "Schweregrad der Verletzung"
 
-#: AKModel/models.py:482
+#: AKModel/models.py:489
 msgid "AK(s) belonging to this constraint"
 msgstr "AK(s), die zu diesem Constraint gehören"
 
-#: AKModel/models.py:484
+#: AKModel/models.py:491
 msgid "AK Slot(s) belonging to this constraint"
 msgstr "AK Slot(s), die zu diesem Constraint gehören"
 
-#: AKModel/models.py:486
+#: AKModel/models.py:493
 msgid "AK Owner belonging to this constraint"
 msgstr "AK Leitung(en), die zu diesem Constraint gehören"
 
-#: AKModel/models.py:488
+#: AKModel/models.py:495
 msgid "Room belonging to this constraint"
 msgstr "Raum, der zu diesem Constraint gehört"
 
-#: AKModel/models.py:491
+#: AKModel/models.py:498
 msgid "AK Requirement belonging to this constraint"
 msgstr "AK Anforderung, die zu diesem Constraint gehört"
 
-#: AKModel/models.py:493
+#: AKModel/models.py:500
 msgid "AK Category belonging to this constraint"
 msgstr "AK Kategorie, di zu diesem Constraint gehört"
 
-#: AKModel/models.py:495
+#: AKModel/models.py:502
 msgid "Comment"
 msgstr "Kommentar"
 
-#: AKModel/models.py:495
+#: AKModel/models.py:502
 msgid "Comment or further details for this violation"
 msgstr "Kommentar oder weitere Details zu dieser Vereletzung"
 
-#: AKModel/models.py:498
+#: AKModel/models.py:505
 msgid "Timestamp"
 msgstr "Timestamp"
 
-#: AKModel/models.py:498
+#: AKModel/models.py:505
 msgid "Time of creation"
 msgstr "Zeitpunkt der ERstellung"
 
-#: AKModel/models.py:499
+#: AKModel/models.py:506
 msgid "Manually Resolved"
 msgstr "Manuell behoben"
 
-#: AKModel/models.py:500
+#: AKModel/models.py:507
 msgid "Mark this violation manually as resolved"
 msgstr "Markiere diese Verletzung manuell als behoben"
 
-#: AKModel/models.py:527
+#: AKModel/models.py:534
 #: AKModel/templates/admin/AKModel/requirements_overview.html:27
 msgid "Details"
 msgstr "Details"
diff --git a/AKModel/migrations/0049_interest_window.py b/AKModel/migrations/0049_interest_window.py
new file mode 100644
index 00000000..07448c54
--- /dev/null
+++ b/AKModel/migrations/0049_interest_window.py
@@ -0,0 +1,24 @@
+# Generated by Django 3.1.8 on 2021-10-29 10:01
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+    dependencies = [
+        ('AKModel', '0048_constraint_violation_text'),
+    ]
+
+    operations = [
+        migrations.AddField(
+            model_name='event',
+            name='interest_end',
+            field=models.DateTimeField(blank=True, help_text='Closing time for expression of interest.', null=True,
+                                       verbose_name='Interest Window End'),
+        ),
+        migrations.AddField(
+            model_name='event',
+            name='interest_start',
+            field=models.DateTimeField(blank=True, help_text='Opening time for expression of interest.', null=True,
+                                       verbose_name='Interest Window Start'),
+        ),
+    ]
diff --git a/AKModel/models.py b/AKModel/models.py
index 98dad770..2767effb 100644
--- a/AKModel/models.py
+++ b/AKModel/models.py
@@ -27,6 +27,11 @@ class Event(models.Model):
     reso_deadline = models.DateTimeField(verbose_name=_('Resolution Deadline'), blank=True, null=True,
                                          help_text=_('When should AKs with intention to submit a resolution be done?'))
 
+    interest_start = models.DateTimeField(verbose_name=_('Interest Window Start'), blank=True, null=True,
+                                          help_text=_('Opening time for expression of interest.'))
+    interest_end = models.DateTimeField(verbose_name=_('Interest Window End'), blank=True, null=True,
+                                        help_text=_('Closing time for expression of interest.'))
+
     public = models.BooleanField(verbose_name=_('Public event'), default=True,
                                  help_text=_('Show this event on overview page.'))
 
@@ -160,7 +165,8 @@ class AKCategory(models.Model):
     description = models.TextField(blank=True, verbose_name=_("Description"),
                                    help_text=_("Short description of this AK Category"))
     present_by_default = models.BooleanField(blank=True, default=True, verbose_name=_("Present by default"),
-        help_text=_("Present AKs of this category by default if AK owner did not specify whether this AK should be presented?"))
+                                             help_text=_(
+                                                 "Present AKs of this category by default if AK owner did not specify whether this AK should be presented?"))
 
     event = models.ForeignKey(to=Event, on_delete=models.CASCADE, verbose_name=_('Event'),
                               help_text=_('Associated event'))
@@ -328,7 +334,8 @@ class Room(models.Model):
     name = models.CharField(max_length=64, verbose_name=_('Name'), help_text=_('Name or number of the room'))
     location = models.CharField(max_length=256, blank=True, verbose_name=_('Location'),
                                 help_text=_('Name or number of the location'))
-    capacity = models.IntegerField(verbose_name=_('Capacity'), help_text=_('Maximum number of people (-1 for unlimited).'))
+    capacity = models.IntegerField(verbose_name=_('Capacity'),
+                                   help_text=_('Maximum number of people (-1 for unlimited).'))
     properties = models.ManyToManyField(to=AKRequirement, blank=True, verbose_name=_('Properties'),
                                         help_text=_('AK requirements fulfilled by the room'))
 
diff --git a/AKPlan/locale/de_DE/LC_MESSAGES/django.po b/AKPlan/locale/de_DE/LC_MESSAGES/django.po
index 120f98ec..9000d9d8 100644
--- a/AKPlan/locale/de_DE/LC_MESSAGES/django.po
+++ b/AKPlan/locale/de_DE/LC_MESSAGES/django.po
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2021-04-29 22:48+0000\n"
+"POT-Creation-Date: 2021-10-29 09:57+0000\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -27,56 +27,56 @@ msgstr "Plan"
 msgid "Write to organizers of this event for questions and comments"
 msgstr "Fragen oder Kommentare? Schreib den Orgas dieses Events eine Mail"
 
-#: AKPlan/templates/AKPlan/plan_index.html:31
+#: AKPlan/templates/AKPlan/plan_index.html:32
 msgid "Day"
 msgstr "Tag"
 
-#: AKPlan/templates/AKPlan/plan_index.html:41
+#: AKPlan/templates/AKPlan/plan_index.html:42
 msgid "Event"
 msgstr "Veranstaltung"
 
-#: AKPlan/templates/AKPlan/plan_index.html:53
+#: AKPlan/templates/AKPlan/plan_index.html:55
 #: AKPlan/templates/AKPlan/plan_room.html:13
 #: AKPlan/templates/AKPlan/plan_room.html:59
-#: AKPlan/templates/AKPlan/plan_wall.html:50
+#: AKPlan/templates/AKPlan/plan_wall.html:52
 msgid "Room"
 msgstr "Raum"
 
-#: AKPlan/templates/AKPlan/plan_index.html:74
+#: AKPlan/templates/AKPlan/plan_index.html:76
 #: AKPlan/templates/AKPlan/plan_room.html:11
 #: AKPlan/templates/AKPlan/plan_track.html:9
 msgid "AK Plan"
 msgstr "AK-Plan"
 
-#: AKPlan/templates/AKPlan/plan_index.html:86
+#: AKPlan/templates/AKPlan/plan_index.html:88
 #: AKPlan/templates/AKPlan/plan_room.html:49
 msgid "Rooms"
 msgstr "Räume"
 
-#: AKPlan/templates/AKPlan/plan_index.html:99
+#: AKPlan/templates/AKPlan/plan_index.html:101
 #: AKPlan/templates/AKPlan/plan_track.html:36
 msgid "Tracks"
 msgstr "Tracks"
 
-#: AKPlan/templates/AKPlan/plan_index.html:111
+#: AKPlan/templates/AKPlan/plan_index.html:113
 msgid "AK Wall"
 msgstr "AK-Wall"
 
-#: AKPlan/templates/AKPlan/plan_index.html:124
-#: AKPlan/templates/AKPlan/plan_wall.html:79
+#: AKPlan/templates/AKPlan/plan_index.html:126
+#: AKPlan/templates/AKPlan/plan_wall.html:81
 msgid "Current AKs"
 msgstr "Aktuelle AKs"
 
-#: AKPlan/templates/AKPlan/plan_index.html:131
-#: AKPlan/templates/AKPlan/plan_wall.html:84
+#: AKPlan/templates/AKPlan/plan_index.html:133
+#: AKPlan/templates/AKPlan/plan_wall.html:86
 msgid "Next AKs"
 msgstr "Nächste AKs"
 
-#: AKPlan/templates/AKPlan/plan_index.html:139
+#: AKPlan/templates/AKPlan/plan_index.html:141
 msgid "This event is not active."
 msgstr "Dieses Event ist nicht aktiv."
 
-#: AKPlan/templates/AKPlan/plan_index.html:152
+#: AKPlan/templates/AKPlan/plan_index.html:154
 #: AKPlan/templates/AKPlan/plan_room.html:77
 #: AKPlan/templates/AKPlan/plan_track.html:58
 msgid "Plan is not visible (yet)."
diff --git a/AKPlanning/locale/de_DE/LC_MESSAGES/django.po b/AKPlanning/locale/de_DE/LC_MESSAGES/django.po
index 7338ca7c..7e4b2703 100644
--- a/AKPlanning/locale/de_DE/LC_MESSAGES/django.po
+++ b/AKPlanning/locale/de_DE/LC_MESSAGES/django.po
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2021-04-29 22:48+0000\n"
+"POT-Creation-Date: 2021-10-29 09:57+0000\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -17,10 +17,10 @@ msgstr ""
 "Content-Type: text/plain; charset=UTF-8\n"
 "Content-Transfer-Encoding: 8bit\n"
 
-#: AKPlanning/settings.py:134
+#: AKPlanning/settings.py:144
 msgid "German"
 msgstr "Deutsch"
 
-#: AKPlanning/settings.py:135
+#: AKPlanning/settings.py:145
 msgid "English"
 msgstr "Englisch"
diff --git a/AKScheduling/locale/de_DE/LC_MESSAGES/django.po b/AKScheduling/locale/de_DE/LC_MESSAGES/django.po
index dbf3a8a6..071f4f87 100644
--- a/AKScheduling/locale/de_DE/LC_MESSAGES/django.po
+++ b/AKScheduling/locale/de_DE/LC_MESSAGES/django.po
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2021-10-28 20:45+0000\n"
+"POT-Creation-Date: 2021-10-29 09:57+0000\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -17,7 +17,7 @@ msgstr ""
 "Content-Type: text/plain; charset=UTF-8\n"
 "Content-Transfer-Encoding: 8bit\n"
 
-#: AKScheduling/models.py:507
+#: AKScheduling/models.py:80
 #, python-format
 msgid ""
 "Not enough space for AK interest (Interest: %(interest)d, Capacity: "
@@ -26,7 +26,7 @@ msgstr ""
 "Nicht genug Platz für AK-Interesse (Interesse: %(interest)d, Kapazität: "
 "%(capacity)d)"
 
-#: AKScheduling/models.py:519
+#: AKScheduling/models.py:92
 #, python-format
 msgid ""
 "Space is too close to AK interest (Interest: %(interest)d, Capacity: "
diff --git a/AKSubmission/locale/de_DE/LC_MESSAGES/django.po b/AKSubmission/locale/de_DE/LC_MESSAGES/django.po
index 92f1633b..7441d587 100644
--- a/AKSubmission/locale/de_DE/LC_MESSAGES/django.po
+++ b/AKSubmission/locale/de_DE/LC_MESSAGES/django.po
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2021-05-15 14:34+0000\n"
+"POT-Creation-Date: 2021-10-29 09:57+0000\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -38,30 +38,6 @@ msgstr ""
 "Mindestens eine geplante Dauer (in Stunden) angeben. Wenn der AK mehrere "
 "Slots haben soll, mehrere Zeilen verwenden"
 
-#: AKSubmission/templates/AKSubmission/ak_detail.html:11
-#: AKSubmission/templates/AKSubmission/ak_edit.html:8
-#: AKSubmission/templates/AKSubmission/ak_history.html:11
-#: AKSubmission/templates/AKSubmission/ak_overview.html:8
-#: AKSubmission/templates/AKSubmission/ak_overview.html:12
-#: AKSubmission/templates/AKSubmission/ak_overview.html:38
-#: AKSubmission/templates/AKSubmission/akmessage_add.html:7
-#: AKSubmission/templates/AKSubmission/akowner_create_update.html:7
-#: AKSubmission/templates/AKSubmission/akslot_add_update.html:7
-#: AKSubmission/templates/AKSubmission/akslot_delete.html:7
-#: AKSubmission/templates/AKSubmission/submission_not_configured.html:7
-#: AKSubmission/templates/AKSubmission/submission_overview.html:7
-#: AKSubmission/templates/AKSubmission/submission_overview.html:43
-#: AKSubmission/templates/AKSubmission/submit_new.html:8
-#: AKSubmission/templates/AKSubmission/submit_new_wish.html:7
-msgid "AKs"
-msgstr "AKs"
-
-#: AKSubmission/templates/AKSubmission/ak_detail.html:11
-#: AKSubmission/templates/AKSubmission/ak_history.html:11
-#: AKSubmission/templates/AKSubmission/akslot_delete.html:31
-msgid "AK"
-msgstr "AK"
-
 #: AKSubmission/templates/AKSubmission/ak_detail.html:22
 #: AKSubmission/templates/AKSubmission/ak_edit.html:13
 #: AKSubmission/templates/AKSubmission/ak_history.html:16
@@ -244,11 +220,33 @@ msgstr "Start"
 msgid "End"
 msgstr "Ende"
 
+#: AKSubmission/templates/AKSubmission/ak_edit.html:8
+#: AKSubmission/templates/AKSubmission/ak_history.html:11
+#: AKSubmission/templates/AKSubmission/ak_overview.html:8
+#: AKSubmission/templates/AKSubmission/ak_overview.html:12
+#: AKSubmission/templates/AKSubmission/ak_overview.html:38
+#: AKSubmission/templates/AKSubmission/akmessage_add.html:7
+#: AKSubmission/templates/AKSubmission/akowner_create_update.html:7
+#: AKSubmission/templates/AKSubmission/akslot_add_update.html:7
+#: AKSubmission/templates/AKSubmission/akslot_delete.html:7
+#: AKSubmission/templates/AKSubmission/submission_not_configured.html:7
+#: AKSubmission/templates/AKSubmission/submission_overview.html:7
+#: AKSubmission/templates/AKSubmission/submission_overview.html:43
+#: AKSubmission/templates/AKSubmission/submit_new.html:8
+#: AKSubmission/templates/AKSubmission/submit_new_wish.html:7
+msgid "AKs"
+msgstr "AKs"
+
 #: AKSubmission/templates/AKSubmission/ak_edit.html:8
 #: AKSubmission/templates/AKSubmission/ak_edit.html:21
 msgid "Edit AK"
 msgstr "AK bearbeiten"
 
+#: AKSubmission/templates/AKSubmission/ak_history.html:11
+#: AKSubmission/templates/AKSubmission/akslot_delete.html:31
+msgid "AK"
+msgstr "AK"
+
 #: AKSubmission/templates/AKSubmission/ak_history.html:27
 msgid "Back"
 msgstr "Zurück"
diff --git a/locale/de_DE/LC_MESSAGES/django.po b/locale/de_DE/LC_MESSAGES/django.po
index 08f762b7..84e04f5f 100644
--- a/locale/de_DE/LC_MESSAGES/django.po
+++ b/locale/de_DE/LC_MESSAGES/django.po
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2021-04-29 22:48+0000\n"
+"POT-Creation-Date: 2021-10-29 09:57+0000\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
-- 
GitLab


From 8c55f4dbc9f9ad323da4217c97e602fca2b077c7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Benjamin=20H=C3=A4ttasch?=
 <benjamin.haettasch@fachschaft.informatik.tu-darmstadt.de>
Date: Fri, 29 Oct 2021 12:38:28 +0200
Subject: [PATCH 2/6] Introduce API Post Endpoint for indication of interest in
 AK

This endpoint checks for validity of the request and increments the AK interest counter if currently allowed
---
 AKModel/urls.py     | 12 +++++++-----
 AKSubmission/api.py | 38 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 45 insertions(+), 5 deletions(-)
 create mode 100644 AKSubmission/api.py

diff --git a/AKModel/urls.py b/AKModel/urls.py
index 64527851..2071acc9 100644
--- a/AKModel/urls.py
+++ b/AKModel/urls.py
@@ -26,11 +26,13 @@ if apps.is_installed("AKScheduling"):
     api_router.register('scheduling-constraint-violations', ConstraintViolationsViewSet,
                         basename='scheduling-constraint-violations')
 
-    extra_paths = [
-        path('api/scheduling-events/', EventsView.as_view(), name='scheduling-events'),
-        path('api/scheduling-room-availabilities/', RoomAvailabilitiesView.as_view(),
-             name='scheduling-room-availabilities'),
-    ]
+    extra_paths.append(path('api/scheduling-events/', EventsView.as_view(), name='scheduling-events'))
+    extra_paths.append(path('api/scheduling-room-availabilities/', RoomAvailabilitiesView.as_view(),
+             name='scheduling-room-availabilities'))
+if apps.is_installed("AKSubmission"):
+    from AKSubmission.api import increment_interest_counter
+
+    extra_paths.append(path('api/ak/<pk>/indicate-interest/', increment_interest_counter, name='submission-ak-indicate-interest'))
 
 event_specific_paths = [
     path('api/', include(api_router.urls), name='api'),
diff --git a/AKSubmission/api.py b/AKSubmission/api.py
new file mode 100644
index 00000000..d11de2d0
--- /dev/null
+++ b/AKSubmission/api.py
@@ -0,0 +1,38 @@
+from rest_framework import status
+from rest_framework.decorators import api_view
+from rest_framework.response import Response
+from django.utils.datetime_safe import datetime
+
+from AKModel.models import AK
+
+
+def ak_interest_indication_active(event, current_timestamp):
+    """
+    Check whether indication of interest is currently allowed for a given event
+
+    :param event: event to check for
+    :type event: Event
+    :param current_timestamp: current timestamp
+    :type current_timestamp: datetime
+    :return: True if indication is allowed, False if not
+    :rtype: Bool
+    """
+    return event.active and (event.interest_start is None or (event.interest_start <= current_timestamp and (
+            event.interest_end is None or current_timestamp <= event.interest_end)))
+
+
+@api_view(['POST'])
+def increment_interest_counter(request, event_slug, pk, **kwargs):
+    """
+    Increment interest counter for AK
+    """
+    ak = AK.objects.get(pk=pk)
+    if ak:
+        # Check whether interest indication is currently allowed
+        current_timestamp = datetime.now().astimezone(ak.event.timezone)
+        if ak_interest_indication_active(ak.event, current_timestamp):
+            ak.interest_counter += 1
+            ak.save()
+            return Response(status=status.HTTP_200_OK)
+        return Response(status=status.HTTP_403_FORBIDDEN)
+    return Response(status=status.HTTP_404_NOT_FOUND)
-- 
GitLab


From 98ce6e3cc702e82aefdb9b741981dd5379209229 Mon Sep 17 00:00:00 2001
From: Nadja Geisler <ngeisler@fachschaft.informatik.tu-darmstadt.de>
Date: Fri, 29 Oct 2021 12:50:36 +0200
Subject: [PATCH 3/6] make interest counter editable in admin AK list

---
 AKModel/admin.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/AKModel/admin.py b/AKModel/admin.py
index c5d067e6..60e38891 100644
--- a/AKModel/admin.py
+++ b/AKModel/admin.py
@@ -159,9 +159,9 @@ class AKAdminForm(forms.ModelForm):
 @admin.register(AK)
 class AKAdmin(SimpleHistoryAdmin):
     model = AK
-    list_display = ['name', 'short_name', 'category', 'track', 'is_wish', 'interest', 'event']
+    list_display = ['name', 'short_name', 'category', 'track', 'is_wish', 'interest', 'interest_counter', 'event']
     list_filter = ['category', WishFilter, 'event']
-    list_editable = ['short_name', 'track', 'interest']
+    list_editable = ['short_name', 'track', 'interest', 'interest_counter']
     ordering = ['pk']
     actions = ['wiki_export']
     form = AKAdminForm
-- 
GitLab


From e8ba7d85898f85acfef53d0d95e7210ebdbc8f78 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Benjamin=20H=C3=A4ttasch?=
 <benjamin.haettasch@fachschaft.informatik.tu-darmstadt.de>
Date: Fri, 29 Oct 2021 13:25:00 +0200
Subject: [PATCH 4/6] Use new AJAX based interest indication on AK detail view

---
 AKSubmission/api.py                           |   2 +-
 .../locale/de_DE/LC_MESSAGES/django.po        | 112 ++++++++++--------
 .../templates/AKSubmission/ak_detail.html     |  71 ++++++++++-
 AKSubmission/views.py                         |   4 +
 templates/base.html                           |   2 +-
 5 files changed, 133 insertions(+), 58 deletions(-)

diff --git a/AKSubmission/api.py b/AKSubmission/api.py
index d11de2d0..29a6f42a 100644
--- a/AKSubmission/api.py
+++ b/AKSubmission/api.py
@@ -33,6 +33,6 @@ def increment_interest_counter(request, event_slug, pk, **kwargs):
         if ak_interest_indication_active(ak.event, current_timestamp):
             ak.interest_counter += 1
             ak.save()
-            return Response(status=status.HTTP_200_OK)
+            return Response({'interest_counter': ak.interest_counter}, status=status.HTTP_200_OK)
         return Response(status=status.HTTP_403_FORBIDDEN)
     return Response(status=status.HTTP_404_NOT_FOUND)
diff --git a/AKSubmission/locale/de_DE/LC_MESSAGES/django.po b/AKSubmission/locale/de_DE/LC_MESSAGES/django.po
index 7441d587..c45713c4 100644
--- a/AKSubmission/locale/de_DE/LC_MESSAGES/django.po
+++ b/AKSubmission/locale/de_DE/LC_MESSAGES/django.po
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2021-10-29 09:57+0000\n"
+"POT-Creation-Date: 2021-10-29 11:22+0000\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -56,51 +56,59 @@ msgstr ""
 msgid "AK Submission"
 msgstr "AK-Eintragung"
 
-#: AKSubmission/templates/AKSubmission/ak_detail.html:37
+#: AKSubmission/templates/AKSubmission/ak_detail.html:78
+msgid "Interest indication currently not allowed. Sorry."
+msgstr "Interessenangabe aktuell nicht erlaubt. Sorry."
+
+#: AKSubmission/templates/AKSubmission/ak_detail.html:80
+msgid "Could not save your interest. Sorry."
+msgstr "Interesse konnte nicht gespeichert werden. Sorry."
+
+#: AKSubmission/templates/AKSubmission/ak_detail.html:101
 msgid "Interest"
 msgstr "Interesse"
 
-#: AKSubmission/templates/AKSubmission/ak_detail.html:40
-#: AKSubmission/templates/AKSubmission/ak_table.html:56
+#: AKSubmission/templates/AKSubmission/ak_detail.html:103
+#: AKSubmission/templates/AKSubmission/ak_table.html:57
 msgid "Show Interest"
 msgstr "Interesse bekunden"
 
-#: AKSubmission/templates/AKSubmission/ak_detail.html:46
+#: AKSubmission/templates/AKSubmission/ak_detail.html:109
 #: AKSubmission/templates/AKSubmission/ak_table.html:48
 msgid "Open external link"
 msgstr "Externen Link öffnen"
 
-#: AKSubmission/templates/AKSubmission/ak_detail.html:51
+#: AKSubmission/templates/AKSubmission/ak_detail.html:114
 msgid "Open protocol link"
 msgstr "Protokolllink öffnen"
 
-#: AKSubmission/templates/AKSubmission/ak_detail.html:56
+#: AKSubmission/templates/AKSubmission/ak_detail.html:119
 #: AKSubmission/templates/AKSubmission/ak_history.html:19
 #: AKSubmission/templates/AKSubmission/ak_history.html:31
 msgid "History"
 msgstr "Versionsgeschichte"
 
-#: AKSubmission/templates/AKSubmission/ak_detail.html:59
+#: AKSubmission/templates/AKSubmission/ak_detail.html:122
 #: AKSubmission/templates/AKSubmission/akmessage_add.html:8
 #: AKSubmission/templates/AKSubmission/akmessage_add.html:16
 #: AKSubmission/templates/AKSubmission/akmessage_add.html:22
 msgid "Add confidential message to organizers"
 msgstr "Sende eine private Nachricht an das Organisationsteam"
 
-#: AKSubmission/templates/AKSubmission/ak_detail.html:62
-#: AKSubmission/templates/AKSubmission/ak_detail.html:213
+#: AKSubmission/templates/AKSubmission/ak_detail.html:125
+#: AKSubmission/templates/AKSubmission/ak_detail.html:276
 #: AKSubmission/templates/AKSubmission/ak_edit.html:16
 #: AKSubmission/templates/AKSubmission/ak_table.html:53
 msgid "Edit"
 msgstr "Bearbeiten"
 
-#: AKSubmission/templates/AKSubmission/ak_detail.html:67
+#: AKSubmission/templates/AKSubmission/ak_detail.html:130
 #: AKSubmission/templates/AKSubmission/ak_history.html:31
 #: AKSubmission/templates/AKSubmission/ak_table.html:35
 msgid "AK Wish"
 msgstr "AK-Wunsch"
 
-#: AKSubmission/templates/AKSubmission/ak_detail.html:74
+#: AKSubmission/templates/AKSubmission/ak_detail.html:137
 #, python-format
 msgid ""
 "\n"
@@ -114,7 +122,7 @@ msgstr ""
 "Minute(n) in %(room)s statt.&nbsp;\n"
 "                    "
 
-#: AKSubmission/templates/AKSubmission/ak_detail.html:80
+#: AKSubmission/templates/AKSubmission/ak_detail.html:143
 #, python-format
 msgid ""
 "\n"
@@ -127,96 +135,96 @@ msgstr ""
 "Minute(n) in %(room)s.&nbsp;\n"
 "                    "
 
-#: AKSubmission/templates/AKSubmission/ak_detail.html:87
-#: AKSubmission/templates/AKSubmission/ak_detail.html:221
+#: AKSubmission/templates/AKSubmission/ak_detail.html:150
+#: AKSubmission/templates/AKSubmission/ak_detail.html:284
 msgid "Go to virtual room"
 msgstr "Zum virtuellen Raum"
 
-#: AKSubmission/templates/AKSubmission/ak_detail.html:96
+#: AKSubmission/templates/AKSubmission/ak_detail.html:159
 #: AKSubmission/templates/AKSubmission/ak_table.html:10
 msgid "Who?"
 msgstr "Wer?"
 
-#: AKSubmission/templates/AKSubmission/ak_detail.html:102
+#: AKSubmission/templates/AKSubmission/ak_detail.html:165
 #: AKSubmission/templates/AKSubmission/ak_history.html:36
 #: AKSubmission/templates/AKSubmission/ak_table.html:11
 msgid "Category"
 msgstr "Kategorie"
 
-#: AKSubmission/templates/AKSubmission/ak_detail.html:109
+#: AKSubmission/templates/AKSubmission/ak_detail.html:172
 #: AKSubmission/templates/AKSubmission/ak_history.html:37
 msgid "Track"
 msgstr "Track"
 
-#: AKSubmission/templates/AKSubmission/ak_detail.html:115
+#: AKSubmission/templates/AKSubmission/ak_detail.html:178
 #, fuzzy
 #| msgid "Present results of this AK"
 msgid "Present this AK"
 msgstr "Die Ergebnisse dieses AKs vorstellen"
 
-#: AKSubmission/templates/AKSubmission/ak_detail.html:120
+#: AKSubmission/templates/AKSubmission/ak_detail.html:183
 msgid "(Category Default)"
 msgstr "(Kategorievoreinstellung)"
 
-#: AKSubmission/templates/AKSubmission/ak_detail.html:126
+#: AKSubmission/templates/AKSubmission/ak_detail.html:189
 #: AKSubmission/templates/AKSubmission/ak_table.html:12
 msgid "Tags"
 msgstr "Tags"
 
-#: AKSubmission/templates/AKSubmission/ak_detail.html:132
+#: AKSubmission/templates/AKSubmission/ak_detail.html:195
 msgid "Reso intention?"
 msgstr "Resoabsicht?"
 
-#: AKSubmission/templates/AKSubmission/ak_detail.html:139
+#: AKSubmission/templates/AKSubmission/ak_detail.html:202
 msgid "Requirements"
 msgstr "Anforderungen"
 
-#: AKSubmission/templates/AKSubmission/ak_detail.html:152
+#: AKSubmission/templates/AKSubmission/ak_detail.html:215
 msgid "Conflicting AKs"
 msgstr "AK-Konflikte"
 
-#: AKSubmission/templates/AKSubmission/ak_detail.html:160
+#: AKSubmission/templates/AKSubmission/ak_detail.html:223
 msgid "Prerequisite AKs"
 msgstr "Vorausgesetzte AKs"
 
-#: AKSubmission/templates/AKSubmission/ak_detail.html:168
+#: AKSubmission/templates/AKSubmission/ak_detail.html:231
 msgid "Notes"
 msgstr "Notizen"
 
-#: AKSubmission/templates/AKSubmission/ak_detail.html:181
+#: AKSubmission/templates/AKSubmission/ak_detail.html:244
 msgid "When?"
 msgstr "Wann?"
 
-#: AKSubmission/templates/AKSubmission/ak_detail.html:183
+#: AKSubmission/templates/AKSubmission/ak_detail.html:246
 #: AKSubmission/templates/AKSubmission/akslot_delete.html:35
 msgid "Duration"
 msgstr "Dauer"
 
-#: AKSubmission/templates/AKSubmission/ak_detail.html:185
+#: AKSubmission/templates/AKSubmission/ak_detail.html:248
 msgid "Room"
 msgstr "Raum"
 
-#: AKSubmission/templates/AKSubmission/ak_detail.html:216
+#: AKSubmission/templates/AKSubmission/ak_detail.html:279
 msgid "Delete"
 msgstr "Löschen"
 
-#: AKSubmission/templates/AKSubmission/ak_detail.html:227
+#: AKSubmission/templates/AKSubmission/ak_detail.html:290
 msgid "Schedule"
 msgstr "Schedule"
 
-#: AKSubmission/templates/AKSubmission/ak_detail.html:239
+#: AKSubmission/templates/AKSubmission/ak_detail.html:302
 msgid "Add another slot"
 msgstr "Einen neuen AK-Slot hinzufügen"
 
-#: AKSubmission/templates/AKSubmission/ak_detail.html:249
+#: AKSubmission/templates/AKSubmission/ak_detail.html:312
 msgid "Possible Times"
 msgstr "Mögliche Zeiten"
 
-#: AKSubmission/templates/AKSubmission/ak_detail.html:253
+#: AKSubmission/templates/AKSubmission/ak_detail.html:316
 msgid "Start"
 msgstr "Start"
 
-#: AKSubmission/templates/AKSubmission/ak_detail.html:254
+#: AKSubmission/templates/AKSubmission/ak_detail.html:317
 msgid "End"
 msgstr "Ende"
 
@@ -270,7 +278,7 @@ msgstr "Die Ergebnisse dieses AKs vorstellen"
 msgid "Intends to submit a resolution"
 msgstr "Beabsichtigt eine Resolution einzureichen"
 
-#: AKSubmission/templates/AKSubmission/ak_list.html:6 AKSubmission/views.py:39
+#: AKSubmission/templates/AKSubmission/ak_list.html:6 AKSubmission/views.py:40
 msgid "All AKs"
 msgstr "Alle AKs"
 
@@ -290,7 +298,7 @@ msgstr "AK hinzufügen"
 msgid "Details"
 msgstr "Details"
 
-#: AKSubmission/templates/AKSubmission/ak_table.html:66
+#: AKSubmission/templates/AKSubmission/ak_table.html:67
 msgid "There are no AKs in this category yet"
 msgstr "Es gibt noch keine AKs in dieser Kategorie"
 
@@ -396,65 +404,65 @@ msgstr ""
 msgid "Submit"
 msgstr "Eintragen"
 
-#: AKSubmission/views.py:70
+#: AKSubmission/views.py:71
 msgid "Wishes"
 msgstr "Wünsche"
 
-#: AKSubmission/views.py:70
+#: AKSubmission/views.py:71
 msgid "AKs one would like to have"
 msgstr ""
 "AKs die sich gewünscht wurden, aber bei denen noch nicht klar ist, wer sie "
 "macht. Falls du dir das vorstellen kannst, trag dich einfach ein"
 
-#: AKSubmission/views.py:86
+#: AKSubmission/views.py:87
 msgid "Currently planned AKs"
 msgstr "Aktuell geplante AKs"
 
-#: AKSubmission/views.py:184
+#: AKSubmission/views.py:188
 msgid "Event inactive. Cannot create or update."
 msgstr "Event inaktiv. Hinzufügen/Bearbeiten nicht möglich."
 
-#: AKSubmission/views.py:200
+#: AKSubmission/views.py:204
 msgid "AK successfully created"
 msgstr "AK erfolgreich angelegt"
 
-#: AKSubmission/views.py:258
+#: AKSubmission/views.py:262
 msgid "AK successfully updated"
 msgstr "AK erfolgreich aktualisiert"
 
-#: AKSubmission/views.py:289
+#: AKSubmission/views.py:293
 msgid "Interest saved"
 msgstr "Interesse gespeichert"
 
-#: AKSubmission/views.py:348
+#: AKSubmission/views.py:352
 msgid "Person Info successfully updated"
 msgstr "Personen-Info erfolgreich aktualisiert"
 
-#: AKSubmission/views.py:368
+#: AKSubmission/views.py:372
 msgid "No user selected"
 msgstr "Keine Person ausgewählt"
 
-#: AKSubmission/views.py:394
+#: AKSubmission/views.py:398
 msgid "AK Slot successfully added"
 msgstr "AK-Slot erfolgreich angelegt"
 
-#: AKSubmission/views.py:408
+#: AKSubmission/views.py:412
 msgid "You cannot edit a slot that has already been scheduled"
 msgstr "Bereits geplante AK-Slots können nicht mehr bearbeitet werden"
 
-#: AKSubmission/views.py:418
+#: AKSubmission/views.py:422
 msgid "AK Slot successfully updated"
 msgstr "AK-Slot erfolgreich aktualisiert"
 
-#: AKSubmission/views.py:431
+#: AKSubmission/views.py:435
 msgid "You cannot delete a slot that has already been scheduled"
 msgstr "Bereits geplante AK-Slots können nicht mehr gelöscht werden"
 
-#: AKSubmission/views.py:441
+#: AKSubmission/views.py:445
 msgid "AK Slot successfully deleted"
 msgstr "AK-Slot erfolgreich angelegt"
 
-#: AKSubmission/views.py:462
+#: AKSubmission/views.py:466
 msgid "Message to organizers successfully saved"
 msgstr "Nachricht an die Organisator*innen erfolgreich gespeichert"
 
diff --git a/AKSubmission/templates/AKSubmission/ak_detail.html b/AKSubmission/templates/AKSubmission/ak_detail.html
index 4eadfd34..9cee1015 100644
--- a/AKSubmission/templates/AKSubmission/ak_detail.html
+++ b/AKSubmission/templates/AKSubmission/ak_detail.html
@@ -26,6 +26,69 @@
 {% if 'AKPlan'|check_app_installed %}
     {% block imports %}
         {% include "AKPlan/plan_akslot.html" %}
+
+        <script>
+            document.addEventListener('DOMContentLoaded', function () {
+                // CSRF Protection/Authentication
+                function getCookie(name) {
+                    let cookieValue = null;
+                    if (document.cookie && document.cookie !== '') {
+                        const cookies = document.cookie.split(';');
+                        for (let i = 0; i < cookies.length; i++) {
+                            const cookie = cookies[i].trim();
+                            // Does this cookie string begin with the name we want?
+                            if (cookie.substring(0, name.length + 1) === (name + '=')) {
+                                cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
+                                break;
+                            }
+                        }
+                    }
+                    return cookieValue;
+                }
+
+                const csrftoken = getCookie('csrftoken');
+
+                function csrfSafeMethod(method) {
+                    // these HTTP methods do not require CSRF protection
+                    return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method));
+                }
+
+                $.ajaxSetup({
+                    beforeSend: function (xhr, settings) {
+                        if (!csrfSafeMethod(settings.type) && !this.crossDomain) {
+                            xhr.setRequestHeader("X-CSRFToken", csrftoken);
+                        }
+                    }
+                });
+
+                function indicate_interest(ak_id, btn) {
+                    $.ajax({
+                           url: "{% url "model:AK-list" event_slug=event.slug %}" + ak_id + "/indicate-interest/",
+                            type: 'POST',
+                            data: {
+                            },
+                            success: function (response) {
+                               console.log(response);
+                               btn.html('{% fa5_icon 'check' 'fas' %}');
+                               btn.off('click');
+                               $('#interest-counter').html(response.interest_counter);
+                            },
+                            error: function (response) {
+                               if(response.status === 403)
+                                    alert("{% trans 'Interest indication currently not allowed. Sorry.' %}");
+                               else
+                                   alert("{% trans 'Could not save your interest. Sorry.' %}");
+                            }
+                       });
+                }
+
+                // Update counter
+                $('#btn-indicate-interest').click(function () {
+                    indicate_interest({{ ak.pk }}, $(this));
+                });
+            });
+        </script>
+
     {% endblock %}
 {% endif %}
 
@@ -34,11 +97,11 @@
 
     <div class="text-right">
         {% if ak.interest_counter >= 0 %}
-            {% trans 'Interest' %}: <b class='mx-1 text-muted'>{{ ak.interest_counter }}</b>
-            {% if ak.event.active %}
-                <a href="{% url 'submit:inc_interest' event_slug=ak.event.slug pk=ak.pk %}" data-toggle="tooltip"
+            {% if ak.event.active and interest_indication_active %}
+                {% trans 'Interest' %}: <b class='mx-1 text-muted' id="interest-counter">{{ ak.interest_counter }}</b>
+                <a href="#" data-toggle="tooltip"
                    title="{% trans 'Show Interest' %}"
-                   class="btn btn-primary">{% fa5_icon 'thumbs-up' 'fas' %}</a>
+                   class="btn btn-primary" id="btn-indicate-interest">{% fa5_icon 'thumbs-up' 'fas' %}</a>
             {% endif %}
         {% endif %}
         {% if ak.link != "" %}
diff --git a/AKSubmission/views.py b/AKSubmission/views.py
index b0e79389..a47fe728 100644
--- a/AKSubmission/views.py
+++ b/AKSubmission/views.py
@@ -16,6 +16,7 @@ from AKModel.availability.models import Availability
 from AKModel.models import AK, AKCategory, AKTag, AKOwner, AKSlot, AKTrack, AKOrgaMessage
 from AKModel.views import EventSlugMixin
 from AKModel.views import FilterByEventSlugMixin
+from AKSubmission.api import ak_interest_indication_active
 from AKSubmission.forms import AKWishForm, AKOwnerForm, AKEditForm, AKSubmissionForm, AKDurationForm, AKOrgaMessageForm
 
 
@@ -157,6 +158,9 @@ class AKDetailView(EventSlugMixin, DetailView):
                     context["featured_slot_remaining"] = floor(remaining.days * 24 * 60 + remaining.seconds / 60)
                     break
 
+        # Display interest indication button?
+        context['interest_indication_active'] = ak_interest_indication_active(self.event, current_timestamp)
+
         return context
 
 
diff --git a/templates/base.html b/templates/base.html
index 33e00bee..93cb5be8 100644
--- a/templates/base.html
+++ b/templates/base.html
@@ -14,7 +14,7 @@
 
     <!-- Load bootstrap, jquery and fontawesome-->
     {% bootstrap_css %}
-    {% bootstrap_javascript jquery='slim' %}
+    {% bootstrap_javascript jquery='full' %}
     {% fontawesome_5_static %}
 
     <link rel="stylesheet" href="{% static 'common/css/custom.css' %}">
-- 
GitLab


From b67838fca845eeae6572ede00911dab6bd518e48 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Benjamin=20H=C3=A4ttasch?=
 <benjamin.haettasch@fachschaft.informatik.tu-darmstadt.de>
Date: Fri, 29 Oct 2021 13:50:32 +0200
Subject: [PATCH 5/6] Use new AJAX based interest indication on AK overview
 views

Additionally, remove obsolete logging
---
 .../templates/AKSubmission/ak_detail.html     |  1 -
 .../AKSubmission/ak_interest_script.html      | 62 +++++++++++++++++++
 .../templates/AKSubmission/ak_overview.html   |  2 +
 .../templates/AKSubmission/ak_table.html      |  8 ++-
 .../AKSubmission/submission_overview.html     |  2 +
 AKSubmission/views.py                         |  7 ++-
 6 files changed, 77 insertions(+), 5 deletions(-)
 create mode 100644 AKSubmission/templates/AKSubmission/ak_interest_script.html

diff --git a/AKSubmission/templates/AKSubmission/ak_detail.html b/AKSubmission/templates/AKSubmission/ak_detail.html
index 9cee1015..69324b63 100644
--- a/AKSubmission/templates/AKSubmission/ak_detail.html
+++ b/AKSubmission/templates/AKSubmission/ak_detail.html
@@ -68,7 +68,6 @@
                             data: {
                             },
                             success: function (response) {
-                               console.log(response);
                                btn.html('{% fa5_icon 'check' 'fas' %}');
                                btn.off('click');
                                $('#interest-counter').html(response.interest_counter);
diff --git a/AKSubmission/templates/AKSubmission/ak_interest_script.html b/AKSubmission/templates/AKSubmission/ak_interest_script.html
new file mode 100644
index 00000000..952f5720
--- /dev/null
+++ b/AKSubmission/templates/AKSubmission/ak_interest_script.html
@@ -0,0 +1,62 @@
+{% load i18n %}
+{% load fontawesome_5 %}
+
+<script>
+    document.addEventListener('DOMContentLoaded', function () {
+        // CSRF Protection/Authentication
+        function getCookie(name) {
+            let cookieValue = null;
+            if (document.cookie && document.cookie !== '') {
+                const cookies = document.cookie.split(';');
+                for (let i = 0; i < cookies.length; i++) {
+                    const cookie = cookies[i].trim();
+                    // Does this cookie string begin with the name we want?
+                    if (cookie.substring(0, name.length + 1) === (name + '=')) {
+                        cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
+                        break;
+                    }
+                }
+            }
+            return cookieValue;
+        }
+
+        const csrftoken = getCookie('csrftoken');
+
+        function csrfSafeMethod(method) {
+            // these HTTP methods do not require CSRF protection
+            return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method));
+        }
+
+        $.ajaxSetup({
+            beforeSend: function (xhr, settings) {
+                if (!csrfSafeMethod(settings.type) && !this.crossDomain) {
+                    xhr.setRequestHeader("X-CSRFToken", csrftoken);
+                }
+            }
+        });
+
+        function indicate_interest(ak_id, btn) {
+            $.ajax({
+                   url: "{% url "model:AK-list" event_slug=event.slug %}" + ak_id + "/indicate-interest/",
+                    type: 'POST',
+                    data: {
+                    },
+                    success: function (response) {
+                       btn.html('{% fa5_icon 'check' 'fas' %}');
+                       btn.off('click');
+                    },
+                    error: function (response) {
+                       if(response.status === 403)
+                            alert("{% trans 'Interest indication currently not allowed. Sorry.' %}");
+                       else
+                           alert("{% trans 'Could not save your interest. Sorry.' %}");
+                    }
+               });
+        }
+
+        // Update counter
+        $('.btn-interest').click(function () {
+            indicate_interest($(this).data('ak_id'), $(this));
+        });
+    });
+</script>
diff --git a/AKSubmission/templates/AKSubmission/ak_overview.html b/AKSubmission/templates/AKSubmission/ak_overview.html
index 01b8ab84..b487f168 100644
--- a/AKSubmission/templates/AKSubmission/ak_overview.html
+++ b/AKSubmission/templates/AKSubmission/ak_overview.html
@@ -19,6 +19,8 @@
             white-space: nowrap;
         }
     </style>
+
+    {% include "AKSubmission/ak_interest_script.html" %}
 {% endblock %}
 
 {% block breadcrumbs %}
diff --git a/AKSubmission/templates/AKSubmission/ak_table.html b/AKSubmission/templates/AKSubmission/ak_table.html
index 41047096..ba15c259 100644
--- a/AKSubmission/templates/AKSubmission/ak_table.html
+++ b/AKSubmission/templates/AKSubmission/ak_table.html
@@ -52,9 +52,11 @@
                     <a href="{% url 'submit:ak_edit' event_slug=event.slug pk=ak.pk %}" data-toggle="tooltip"
                        title="{% trans 'Edit' %}"
                        class="btn btn-success">{% fa5_icon 'pencil-alt' 'fas' %}</a>
-                     <a href="{% url 'submit:overview_inc_interest' event_slug=event.slug pk=ak.pk %}" data-toggle="tooltip"
-                       title="{% trans 'Show Interest' %}"
-                       class="btn btn-primary">{% fa5_icon 'thumbs-up' 'fas' %}</a>
+                    {% if interest_indication_active %}
+                        <span data-ak_id="{{ ak.pk }}" data-toggle="tooltip"
+                           title="{% trans 'Show Interest' %}"
+                           class="btn btn-primary btn-interest" style="cursor: pointer">{% fa5_icon 'thumbs-up' 'fas' %}</span>
+                    {% endif %}
                 {% endif %}
             </td>
         </tr>
diff --git a/AKSubmission/templates/AKSubmission/submission_overview.html b/AKSubmission/templates/AKSubmission/submission_overview.html
index e7994b69..49782a63 100644
--- a/AKSubmission/templates/AKSubmission/submission_overview.html
+++ b/AKSubmission/templates/AKSubmission/submission_overview.html
@@ -28,6 +28,8 @@
         }
     </style>
 
+    {% include "AKSubmission/ak_interest_script.html" %}
+
     {% if event.active %}
         <link href="{% static 'common/vendor/select2/select2.min.css' %}" rel="stylesheet" />
         <script src="{% static 'common/vendor/select2/select2.min.js' %}"></script>
diff --git a/AKSubmission/views.py b/AKSubmission/views.py
index a47fe728..e1844787 100644
--- a/AKSubmission/views.py
+++ b/AKSubmission/views.py
@@ -74,6 +74,10 @@ class AKOverviewView(FilterByEventSlugMixin, ListView):
         context["active_category"] = self.get_active_category_name(context)
         context['table_title'] = self.get_table_title(context)
 
+        # Display interest indication button?
+        current_timestamp = datetime.now().astimezone(self.event.timezone)
+        context['interest_indication_active'] = ak_interest_indication_active(self.event, current_timestamp)
+
         return context
 
 
@@ -137,10 +141,11 @@ class AKDetailView(EventSlugMixin, DetailView):
         context = super().get_context_data(object_list=object_list, **kwargs)
         context["availabilities"] = Availability.objects.filter(ak=context["ak"])
 
+        current_timestamp = datetime.now().astimezone(self.event.timezone)
+
         # Is this AK taking place now or soon (used for top page visualization)
         context["featured_slot_type"] = "NONE"
         if apps.is_installed("AKPlan"):
-            current_timestamp = datetime.now().astimezone(self.event.timezone)
             in_two_hours = current_timestamp + timedelta(hours=2)
             slots = context["ak"].akslot_set.filter(start__isnull=False, room__isnull=False)
             for slot in slots:
-- 
GitLab


From c2fcc62090e5b7813edfd68e58fbc32c84f2c939 Mon Sep 17 00:00:00 2001
From: Nadja Geisler <ngeisler@fachschaft.informatik.tu-darmstadt.de>
Date: Fri, 29 Oct 2021 14:01:30 +0200
Subject: [PATCH 6/6] remove legacy interest views

---
 AKPlanning/urls.py    |  2 +-
 AKSubmission/urls.py  |  2 --
 AKSubmission/views.py | 25 +------------------------
 3 files changed, 2 insertions(+), 27 deletions(-)

diff --git a/AKPlanning/urls.py b/AKPlanning/urls.py
index 2386721c..cdbbea55 100644
--- a/AKPlanning/urls.py
+++ b/AKPlanning/urls.py
@@ -13,10 +13,10 @@ Including another URLconf
     1. Import the include() function: from django.urls import include, path
     2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
 """
+import debug_toolbar
 from django.apps import apps
 from django.contrib import admin
 from django.urls import path, include
-import debug_toolbar
 
 urlpatterns = [
     path('admin/', admin.site.urls),
diff --git a/AKSubmission/urls.py b/AKSubmission/urls.py
index e22ffdfd..213ea0e1 100644
--- a/AKSubmission/urls.py
+++ b/AKSubmission/urls.py
@@ -12,8 +12,6 @@ urlpatterns = [
             path('ak/<int:pk>/', views.AKDetailView.as_view(), name='ak_detail'),
             path('ak/<int:pk>/history/', views.AKHistoryView.as_view(), name='ak_history'),
             path('ak/<int:pk>/edit/', views.AKEditView.as_view(), name='ak_edit'),
-            path('ak/<int:pk>/interest/', views.AKInterestView.as_view(), name='inc_interest'),
-            path('ak/<int:pk>/overview_interest/', views.AKOverviewInterestView.as_view(), name='overview_inc_interest'),
             path('ak/<int:pk>/add_slot/', views.AKSlotAddView.as_view(), name='akslot_add'),
             path('ak/<int:pk>/add_message/', views.AKAddOrgaMessageView.as_view(), name='akmessage_add'),
             path('akslot/<int:pk>/edit/', views.AKSlotEditView.as_view(), name='akslot_edit'),
diff --git a/AKSubmission/views.py b/AKSubmission/views.py
index e1844787..077005e2 100644
--- a/AKSubmission/views.py
+++ b/AKSubmission/views.py
@@ -10,7 +10,7 @@ from django.urls import reverse_lazy
 from django.utils.datetime_safe import datetime
 from django.utils.translation import gettext_lazy as _
 from django.views import View
-from django.views.generic import ListView, DetailView, CreateView, UpdateView, DeleteView, RedirectView, TemplateView
+from django.views.generic import ListView, DetailView, CreateView, UpdateView, DeleteView, TemplateView
 
 from AKModel.availability.models import Availability
 from AKModel.models import AK, AKCategory, AKTag, AKOwner, AKSlot, AKTrack, AKOrgaMessage
@@ -286,29 +286,6 @@ class AKEditView(EventSlugMixin, EventInactiveRedirectMixin, UpdateView):
         return super_form_valid
 
 
-class AKInterestView(RedirectView):
-    permanent = False
-    pattern_name = 'submit:ak_detail'
-
-    def get(self, request, *args, **kwargs):
-        # Increase interest counter for given AK
-        ak = get_object_or_404(AK, pk=kwargs['pk'])
-        if ak.event.active:
-            ak.increment_interest()
-            messages.add_message(self.request, messages.SUCCESS, _("Interest saved"))
-        return super().get(request, *args, **kwargs)
-
-
-# when the interest increase request comes from the AK overview page, redirect to that instead of the AK overview page
-class AKOverviewInterestView(AKInterestView):
-    pattern_name = 'submit:submission_overview'
-
-    def get_redirect_url(self, *args, **kwargs):
-        # No PK needed for overview page of all AKs
-        del kwargs['pk']
-        return super().get_redirect_url(*args, **kwargs)
-
-
 class AKOwnerCreateView(EventSlugMixin, EventInactiveRedirectMixin, CreateView):
     model = AKOwner
     template_name = 'AKSubmission/akowner_create_update.html'
-- 
GitLab