From 646d3f5408b261ff3e50b9baae85f828d899b738 Mon Sep 17 00:00:00 2001 From: Peter Pfeufer Date: Mon, 6 Jan 2025 16:21:14 +0100 Subject: [PATCH 1/8] [ADD] Mercenary Dens to structure type selection --- allianceauth/timerboard/models.py | 1 + allianceauth/timerboard/templates/timerboard/timertable.html | 2 ++ 2 files changed, 3 insertions(+) diff --git a/allianceauth/timerboard/models.py b/allianceauth/timerboard/models.py index d4127c9b..e0713e88 100644 --- a/allianceauth/timerboard/models.py +++ b/allianceauth/timerboard/models.py @@ -39,6 +39,7 @@ class Timer(models.Model): PHAROLUX = "Pharolux Cyno Beacon", _("Pharolux Cyno Beacon") TENEBREX = "Tenebrex Cyno Jammer", _("Tenebrex Cyno Jammer") ANSIBLEX = "Ansiblex Jump Gate", _("Ansiblex Jump Gate") + MERCDEN = "Mercenary Den", _("Mercenary Den") MOONPOP = "Moon Mining Cycle", _("Moon Mining Cycle") METENOX = "Metenox Moon Drill", _("Metenox Moon Drill") OTHER = "Other", _("Other") diff --git a/allianceauth/timerboard/templates/timerboard/timertable.html b/allianceauth/timerboard/templates/timerboard/timertable.html index c1d5c818..7ac0099c 100644 --- a/allianceauth/timerboard/templates/timerboard/timertable.html +++ b/allianceauth/timerboard/templates/timerboard/timertable.html @@ -80,6 +80,8 @@
{% translate "Cyno Jammer" %}
{% elif timer.structure == "Jump Gate" or timer.structure == "Ansiblex Jump Gate" %}
{% translate "Ansiblex Jump Gate" %}
+ {% elif timer.structure == "Mercenary Den" %} +
{% translate "Mercenary Den" %}
{% elif timer.structure == "Moon Mining Cycle" %}
{% translate "Moon Mining Cycle" %}
{% elif timer.structure == "Metenox Moon Drill" %} From a4ea48e14e25477eb41728b44d30a542b91ad13e Mon Sep 17 00:00:00 2001 From: Peter Pfeufer Date: Mon, 6 Jan 2025 16:43:59 +0100 Subject: [PATCH 2/8] [CHANGE] Group timer types by BG color BS class --- .../templates/timerboard/timertable.html | 59 +++++++++++++------ 1 file changed, 40 insertions(+), 19 deletions(-) diff --git a/allianceauth/timerboard/templates/timerboard/timertable.html b/allianceauth/timerboard/templates/timerboard/timertable.html index 7ac0099c..3ee2c202 100644 --- a/allianceauth/timerboard/templates/timerboard/timertable.html +++ b/allianceauth/timerboard/templates/timerboard/timertable.html @@ -30,13 +30,21 @@ + {% comment %} Objective: Hostile (BG: Danger) {% endcomment %} {% if timer.objective == "Hostile" %} -
{% translate "Hostile" %}
+
+ + {% comment %} Objective: Friendly (BG: Primare) {% endcomment %} {% elif timer.objective == "Friendly" %} -
{% translate "Friendly" %}
+
+ + {% comment %} Objective: Neutral (BG: Secondary) {% endcomment %} {% elif timer.objective == "Neutral" %} -
{% translate "Neutral" %}
+
{% endif %} + + {{ timer.get_objective_display }} +
@@ -44,32 +52,27 @@ + {% comment %} BG: Info {% endcomment %} {% if timer.structure == "POCO" %}
{% translate "POCO" %}
- {% elif timer.structure == "Orbital Skyhook" %} -
{% translate "Orbital Skyhook" %}
- {% elif timer.structure == "I-HUB" %} -
{% translate "I-HUB" %}
- {% elif timer.structure == "TCU" %} {% comment %} Pending Removal {% endcomment %} -
{% translate "TCU" %}
{% elif timer.structure == "POS[S]" %}
{% translate "POS [S]" %}
{% elif timer.structure == "POS[M]" %}
{% translate "POS [M]" %}
{% elif timer.structure == "POS[L]" %}
{% translate "POS [L]" %}
- {% elif timer.structure == "Citadel[M]" or timer.structure == "Astrahus" %} -
{% translate "Astrahus" %}
- {% elif timer.structure == "Citadel[L]" or timer.structure == "Fortizar" %} -
{% translate "Fortizar" %}
- {% elif timer.structure == "Citadel[XL]" or timer.structure == "Keepstar" %} -
{% translate "Keepstar" %}
+ + {% comment %} BG: Warning {% endcomment %} + {% elif timer.structure == "Station" %} +
{% translate "Station" %}
+ {% elif timer.structure == "Orbital Skyhook" %} +
{% translate "Orbital Skyhook" %}
+ {% elif timer.structure == "I-HUB" %} +
{% translate "I-HUB" %}
{% elif timer.structure == "Engineering Complex[M]" or timer.structure == "Raitaru" %}
{% translate "Raitaru" %}
{% elif timer.structure == "Engineering Complex[L]" or timer.structure == "Azbel" %}
{% translate "Azbel" %}
- {% elif timer.structure == "Engineering Complex[XL]" or timer.structure == "Sotiyo" %} -
{% translate "Sotiyo" %}
{% elif timer.structure == "Refinery[M]" or timer.structure == "Athanor" %}
{% translate "Athanor" %}
{% elif timer.structure == "Refinery[L]" or timer.structure == "Tatara" %} @@ -82,12 +85,30 @@
{% translate "Ansiblex Jump Gate" %}
{% elif timer.structure == "Mercenary Den" %}
{% translate "Mercenary Den" %}
- {% elif timer.structure == "Moon Mining Cycle" %} -
{% translate "Moon Mining Cycle" %}
{% elif timer.structure == "Metenox Moon Drill" %}
{% translate "Metenox Moon Drill" %}
+ + {% comment %} BG: Danger {% endcomment %} + {% elif timer.structure == "TCU" %} +
{% translate "TCU" %}
+ {% elif timer.structure == "Citadel[M]" or timer.structure == "Astrahus" %} +
{% translate "Astrahus" %}
+ {% elif timer.structure == "Citadel[L]" or timer.structure == "Fortizar" %} +
{% translate "Fortizar" %}
+ {% elif timer.structure == "Citadel[XL]" or timer.structure == "Keepstar" %} +
{% translate "Keepstar" %}
+ {% elif timer.structure == "Engineering Complex[XL]" or timer.structure == "Sotiyo" %} +
{% translate "Sotiyo" %}
+ + {% comment %} BG: Secondary {% endcomment %} + {% elif timer.structure == "TCU" %} {% comment %} Pending Removal {% endcomment %} +
{% translate "TCU" %}
{% elif timer.structure == "Other" %}
{% translate "Other" %}
+ + {% comment %} BG: Success {% endcomment %} + {% elif timer.structure == "Moon Mining Cycle" %} +
{% translate "Moon Mining Cycle" %}
{% endif %} From bd4dd60c989d087547b18d155a66f0b04ed1795f Mon Sep 17 00:00:00 2001 From: Peter Pfeufer Date: Mon, 6 Jan 2025 16:48:02 +0100 Subject: [PATCH 3/8] [CHANGE] Rename I-Hub to Sovereignty Hub --- allianceauth/timerboard/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/allianceauth/timerboard/models.py b/allianceauth/timerboard/models.py index e0713e88..ce14f17e 100644 --- a/allianceauth/timerboard/models.py +++ b/allianceauth/timerboard/models.py @@ -23,7 +23,7 @@ class Timer(models.Model): POCO = "POCO", _("POCO") ORBITALSKYHOOK = "Orbital Skyhook", _("Orbital Skyhook") - IHUB = "I-HUB", _("I-HUB") + IHUB = "I-HUB", _("Soverreignty Hub") TCU = "TCU", _("TCU") # Pending Remval POSS = "POS[S]", _("POS [S]") POSM = "POS[M]", _("POS [M]") From f51523dc07d768ccbdd74a296459172bf7e268d7 Mon Sep 17 00:00:00 2001 From: Peter Pfeufer Date: Mon, 6 Jan 2025 17:03:00 +0100 Subject: [PATCH 4/8] [CHANGE] Use TextChoices displayed name in template --- allianceauth/timerboard/models.py | 6 +- .../templates/timerboard/timertable.html | 80 ++++++++++--------- 2 files changed, 46 insertions(+), 40 deletions(-) diff --git a/allianceauth/timerboard/models.py b/allianceauth/timerboard/models.py index ce14f17e..6823ea8d 100644 --- a/allianceauth/timerboard/models.py +++ b/allianceauth/timerboard/models.py @@ -1,6 +1,6 @@ from django.contrib.auth.models import User from django.db import models -from django.utils.translation import gettext as _ +from django.utils.translation import gettext_lazy as _ from allianceauth.eveonline.models import EveCharacter from allianceauth.eveonline.models import EveCorporationInfo @@ -36,8 +36,8 @@ class Timer(models.Model): SOTIYO = "Sotiyo", _("Sotiyo") ATHANOR = "Athanor", _("Athanor") TATARA = "Tatara", _("Tatara") - PHAROLUX = "Pharolux Cyno Beacon", _("Pharolux Cyno Beacon") - TENEBREX = "Tenebrex Cyno Jammer", _("Tenebrex Cyno Jammer") + PHAROLUX = "Pharolux Cyno Beacon", _("Cyno Beacon") + TENEBREX = "Tenebrex Cyno Jammer", _("Cyno Jammer") ANSIBLEX = "Ansiblex Jump Gate", _("Ansiblex Jump Gate") MERCDEN = "Mercenary Den", _("Mercenary Den") MOONPOP = "Moon Mining Cycle", _("Moon Mining Cycle") diff --git a/allianceauth/timerboard/templates/timerboard/timertable.html b/allianceauth/timerboard/templates/timerboard/timertable.html index 3ee2c202..455d0d94 100644 --- a/allianceauth/timerboard/templates/timerboard/timertable.html +++ b/allianceauth/timerboard/templates/timerboard/timertable.html @@ -19,7 +19,6 @@ {% for timer in timers %} - {{ timer.details }} @@ -54,62 +53,69 @@ {% comment %} BG: Info {% endcomment %} {% if timer.structure == "POCO" %} -
{% translate "POCO" %}
+
{% elif timer.structure == "POS[S]" %} -
{% translate "POS [S]" %}
+
{% elif timer.structure == "POS[M]" %} -
{% translate "POS [M]" %}
+
{% elif timer.structure == "POS[L]" %} -
{% translate "POS [L]" %}
+
{% comment %} BG: Warning {% endcomment %} - {% elif timer.structure == "Station" %} -
{% translate "Station" %}
+ {% elif timer.structure == "Station" %} {% comment %} Pending Removal {% endcomment %} +
{% elif timer.structure == "Orbital Skyhook" %} -
{% translate "Orbital Skyhook" %}
+
{% elif timer.structure == "I-HUB" %} -
{% translate "I-HUB" %}
- {% elif timer.structure == "Engineering Complex[M]" or timer.structure == "Raitaru" %} -
{% translate "Raitaru" %}
- {% elif timer.structure == "Engineering Complex[L]" or timer.structure == "Azbel" %} -
{% translate "Azbel" %}
- {% elif timer.structure == "Refinery[M]" or timer.structure == "Athanor" %} -
{% translate "Athanor" %}
- {% elif timer.structure == "Refinery[L]" or timer.structure == "Tatara" %} -
{% translate "Tatara" %}
- {% elif timer.structure == "Cyno Beacon" or timer.structure == "Pharolux Cyno Beacon" %} -
{% translate "Cyno Beacon" %}
- {% elif timer.structure == "Cyno Jammer" or timer.structure == "Tenebrex Cyno Jammer" %} -
{% translate "Cyno Jammer" %}
- {% elif timer.structure == "Jump Gate" or timer.structure == "Ansiblex Jump Gate" %} -
{% translate "Ansiblex Jump Gate" %}
+
+ {% elif timer.structure == "Raitaru" %} +
+ {% elif timer.structure == "Azbel" %} +
+ {% elif timer.structure == "Athanor" %} +
+ {% elif timer.structure == "Tatara" %} +
+ {% elif timer.structure == "Pharolux Cyno Beacon" %} +
+ {% elif timer.structure == "Tenebrex Cyno Jammer" %} +
+ {% elif timer.structure == "Ansiblex Jump Gate" %} +
{% elif timer.structure == "Mercenary Den" %} -
{% translate "Mercenary Den" %}
+
{% elif timer.structure == "Metenox Moon Drill" %} -
{% translate "Metenox Moon Drill" %}
+
{% comment %} BG: Danger {% endcomment %} {% elif timer.structure == "TCU" %} -
{% translate "TCU" %}
- {% elif timer.structure == "Citadel[M]" or timer.structure == "Astrahus" %} -
{% translate "Astrahus" %}
- {% elif timer.structure == "Citadel[L]" or timer.structure == "Fortizar" %} -
{% translate "Fortizar" %}
- {% elif timer.structure == "Citadel[XL]" or timer.structure == "Keepstar" %} -
{% translate "Keepstar" %}
- {% elif timer.structure == "Engineering Complex[XL]" or timer.structure == "Sotiyo" %} -
{% translate "Sotiyo" %}
+
+ {% elif timer.structure == "Astrahus" %} +
+ {% elif timer.structure == "Fortizar" %} +
+ {% elif timer.structure == "Keepstar" %} +
+ {% elif timer.structure == "Sotiyo" %} +
{% comment %} BG: Secondary {% endcomment %} {% elif timer.structure == "TCU" %} {% comment %} Pending Removal {% endcomment %} -
{% translate "TCU" %}
+
{% elif timer.structure == "Other" %} -
{% translate "Other" %}
+
{% comment %} BG: Success {% endcomment %} {% elif timer.structure == "Moon Mining Cycle" %} -
{% translate "Moon Mining Cycle" %}
+
+ + {% comment %} BG: Primary (for all other timers) {% endcomment %} + {% else %} +
{% endif %} + + {{ timer.get_structure_display }} +
{{ timer.eve_time | date:"Y-m-d H:i" }} From c6b6443901a086b6ee02b9f7a37ef79b3c2d0381 Mon Sep 17 00:00:00 2001 From: Peter Pfeufer Date: Mon, 6 Jan 2025 18:08:20 +0100 Subject: [PATCH 5/8] [CHANGE] Move structure label BG detection to Python instead of Django MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Python is faster and needs less memory … It's also much mire readable that way. --- .../templates/timerboard/timertable.html | 64 +-------- allianceauth/timerboard/views.py | 135 +++++++++++++++--- 2 files changed, 114 insertions(+), 85 deletions(-) diff --git a/allianceauth/timerboard/templates/timerboard/timertable.html b/allianceauth/timerboard/templates/timerboard/timertable.html index 455d0d94..014b01e8 100644 --- a/allianceauth/timerboard/templates/timerboard/timertable.html +++ b/allianceauth/timerboard/templates/timerboard/timertable.html @@ -51,69 +51,7 @@ - {% comment %} BG: Info {% endcomment %} - {% if timer.structure == "POCO" %} -
- {% elif timer.structure == "POS[S]" %} -
- {% elif timer.structure == "POS[M]" %} -
- {% elif timer.structure == "POS[L]" %} -
- - {% comment %} BG: Warning {% endcomment %} - {% elif timer.structure == "Station" %} {% comment %} Pending Removal {% endcomment %} -
- {% elif timer.structure == "Orbital Skyhook" %} -
- {% elif timer.structure == "I-HUB" %} -
- {% elif timer.structure == "Raitaru" %} -
- {% elif timer.structure == "Azbel" %} -
- {% elif timer.structure == "Athanor" %} -
- {% elif timer.structure == "Tatara" %} -
- {% elif timer.structure == "Pharolux Cyno Beacon" %} -
- {% elif timer.structure == "Tenebrex Cyno Jammer" %} -
- {% elif timer.structure == "Ansiblex Jump Gate" %} -
- {% elif timer.structure == "Mercenary Den" %} -
- {% elif timer.structure == "Metenox Moon Drill" %} -
- - {% comment %} BG: Danger {% endcomment %} - {% elif timer.structure == "TCU" %} -
- {% elif timer.structure == "Astrahus" %} -
- {% elif timer.structure == "Fortizar" %} -
- {% elif timer.structure == "Keepstar" %} -
- {% elif timer.structure == "Sotiyo" %} -
- - {% comment %} BG: Secondary {% endcomment %} - {% elif timer.structure == "TCU" %} {% comment %} Pending Removal {% endcomment %} -
- {% elif timer.structure == "Other" %} -
- - {% comment %} BG: Success {% endcomment %} - {% elif timer.structure == "Moon Mining Cycle" %} -
- - {% comment %} BG: Primary (for all other timers) {% endcomment %} - {% else %} -
- {% endif %} - +
{{ timer.get_structure_display }}
diff --git a/allianceauth/timerboard/views.py b/allianceauth/timerboard/views.py index 93c877c8..bfee13ff 100644 --- a/allianceauth/timerboard/views.py +++ b/allianceauth/timerboard/views.py @@ -3,7 +3,8 @@ import logging from django.contrib import messages from django.contrib.auth.mixins import ( - LoginRequiredMixin, PermissionRequiredMixin, + LoginRequiredMixin, + PermissionRequiredMixin, ) from django.db.models import Q from django.shortcuts import get_object_or_404, redirect, render @@ -20,8 +21,8 @@ from allianceauth.timerboard.models import Timer logger = logging.getLogger(__name__) -TIMER_VIEW_PERMISSION = 'auth.timer_view' -TIMER_MANAGE_PERMISSION = 'auth.timer_management' +TIMER_VIEW_PERMISSION = "auth.timer_view" +TIMER_MANAGE_PERMISSION = "auth.timer_management" class BaseTimerView(LoginRequiredMixin, PermissionRequiredMixin, View): @@ -29,22 +30,112 @@ class BaseTimerView(LoginRequiredMixin, PermissionRequiredMixin, View): class TimerView(BaseTimerView): - template_name = 'timerboard/view.html' + template_name = "timerboard/view.html" permission_required = TIMER_VIEW_PERMISSION def get(self, request): + """ + Renders the timer view + + :param request: + :type request: + :return: + :rtype: + """ + + def get_bg_modifier(structure): + """ + Returns the bootstrap bg modifier for the given structure + + :param structure: + :type structure: + :return: + :rtype: + """ + + if structure in bg_info: + return "info" + elif structure in bg_waning: + return "warning" + elif structure in bg_danger: + return "danger" + elif structure in bg_secondary: + return "secondary" + + return "primary" + logger.debug(f"timer_view called by user {request.user}") char = request.user.profile.main_character + if char: corp = char.corporation else: corp = None - base_query = Timer.objects.select_related('eve_character') + + base_query = Timer.objects.select_related("eve_character") + + timers = [] + corp_timers = [] + future_timers = [] + past_timers = [] + + bg_info = [ + Timer.Structure.POCO.value, # POCO + Timer.Structure.POSS.value, # POS[S] + Timer.Structure.POSM.value, # POS[M] + Timer.Structure.POSL.value, # POS[L] + ] + bg_waning = [ + Timer.Structure.ANSIBLEX.value, # Ansiblex Jump Gate + Timer.Structure.ATHANOR.value, # Athanor + Timer.Structure.AZBEL.value, # Azbel + Timer.Structure.MERCDEN.value, # Mercenary Den + Timer.Structure.METENOX.value, # Metenox Moon Drill + Timer.Structure.ORBITALSKYHOOK.value, # Orbital Skyhook + Timer.Structure.PHAROLUX.value, # Pharolux Cyno Beacon + Timer.Structure.RAITARU.value, # Raitaru + "Station", # Legacy structure, remove in future update + Timer.Structure.TATARA.value, # Tatara + Timer.Structure.TENEBREX.value, # Tenebrex Cyno Jammer + ] + bg_danger = [ + Timer.Structure.ASTRAHUS.value, # Astrahus + Timer.Structure.FORTIZAR.value, # Fortizar + Timer.Structure.IHUB.value, # I-HUB + Timer.Structure.KEEPSTAR.value, # Keepstar + Timer.Structure.SOTIYO.value, # Sotiyo + Timer.Structure.TCU.value, # TCU (Legacy structure, remove in future update) + ] + bg_secondary = [ + Timer.Structure.MOONPOP.value, # Moon Mining Cycle + Timer.Structure.OTHER.value, # Other + ] + + # Timers + for timer in base_query.filter(corp_timer=False): + timer.bg_modifier = get_bg_modifier(timer.structure) + timers.append(timer) + + # Corp Timers + for timer in base_query.filter(corp_timer=True, eve_corp=corp): + timer.bg_modifier = get_bg_modifier(timer.structure) + corp_timers.append(timer) + + # Future Timers + for timer in base_query.filter(corp_timer=False, eve_time__gte=timezone.now()): + timer.bg_modifier = get_bg_modifier(timer.structure) + future_timers.append(timer) + + # Past Timers + for timer in base_query.filter(corp_timer=False, eve_time__lt=timezone.now()): + timer.bg_modifier = get_bg_modifier(timer.structure) + past_timers.append(timer) + render_items = { - 'timers': base_query.filter(corp_timer=False), - 'corp_timers': base_query.filter(corp_timer=True, eve_corp=corp), - 'future_timers': base_query.filter(corp_timer=False, eve_time__gte=timezone.now()), - 'past_timers': base_query.filter(corp_timer=False, eve_time__lt=timezone.now()), + "timers": timers, + "corp_timers": corp_timers, + "future_timers": future_timers, + "past_timers": past_timers, } return render(request, self.template_name, context=render_items) @@ -52,7 +143,7 @@ class TimerView(BaseTimerView): class TimerManagementView(BaseTimerView): permission_required = TIMER_MANAGE_PERMISSION - index_redirect = 'timerboard:view' + index_redirect = "timerboard:view" success_url = reverse_lazy(index_redirect) model = Timer @@ -66,12 +157,12 @@ class AddUpdateMixin: Inject the request user into the kwargs passed to the form """ kwargs = super().get_form_kwargs() - kwargs.update({'user': self.request.user}) + kwargs.update({"user": self.request.user}) return kwargs class AddTimerView(TimerManagementView, AddUpdateMixin, CreateView): - template_name_suffix = '_create_form' + template_name_suffix = "_create_form" form_class = TimerForm def form_valid(self, form): @@ -82,17 +173,18 @@ class AddTimerView(TimerManagementView, AddUpdateMixin, CreateView): ) messages.success( self.request, - _('Added new timer in %(system)s at %(time)s.') % {"system": timer.system, "time": timer.eve_time} + _("Added new timer in %(system)s at %(time)s.") + % {"system": timer.system, "time": timer.eve_time}, ) return result class EditTimerView(TimerManagementView, AddUpdateMixin, UpdateView): - template_name_suffix = '_update_form' + template_name_suffix = "_update_form" form_class = TimerForm def form_valid(self, form): - messages.success(self.request, _('Saved changes to the timer.')) + messages.success(self.request, _("Saved changes to the timer.")) return super().form_valid(form) @@ -107,21 +199,20 @@ def dashboard_timers(request): except (EveCorporationInfo.DoesNotExist, AttributeError): return "" - timers = Timer.objects.select_related( - 'eve_character' - ).filter( + timers = Timer.objects.select_related("eve_character").filter( (Q(corp_timer=True) & Q(eve_corp=corp)) | Q(corp_timer=False), - eve_time__gte=timezone.now() + eve_time__gte=timezone.now(), )[:5] if timers.count(): context = { - 'timers': timers, + "timers": timers, } return render_to_string( - template_name='timerboard/dashboard.timers.html', - context=context, request=request + template_name="timerboard/dashboard.timers.html", + context=context, + request=request, ) else: return "" From b737504d52fea34e7274b0f5b7e4233110166c91 Mon Sep 17 00:00:00 2001 From: Peter Pfeufer Date: Mon, 6 Jan 2025 18:08:52 +0100 Subject: [PATCH 6/8] [REMOVE] Unused imports --- allianceauth/timerboard/views.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/allianceauth/timerboard/views.py b/allianceauth/timerboard/views.py index bfee13ff..27c6045f 100644 --- a/allianceauth/timerboard/views.py +++ b/allianceauth/timerboard/views.py @@ -1,4 +1,3 @@ -import datetime import logging from django.contrib import messages @@ -7,7 +6,7 @@ from django.contrib.auth.mixins import ( PermissionRequiredMixin, ) from django.db.models import Q -from django.shortcuts import get_object_or_404, redirect, render +from django.shortcuts import get_object_or_404, render from django.template.loader import render_to_string from django.urls import reverse_lazy from django.utils import timezone From 4578ecf21dbe79df29855a08256af88fe7ee2e8a Mon Sep 17 00:00:00 2001 From: Peter Pfeufer Date: Mon, 6 Jan 2025 18:17:21 +0100 Subject: [PATCH 7/8] [ADD] Missing migration --- .../migrations/0007_alter_timer_structure.py | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 allianceauth/timerboard/migrations/0007_alter_timer_structure.py diff --git a/allianceauth/timerboard/migrations/0007_alter_timer_structure.py b/allianceauth/timerboard/migrations/0007_alter_timer_structure.py new file mode 100644 index 00000000..e7468d57 --- /dev/null +++ b/allianceauth/timerboard/migrations/0007_alter_timer_structure.py @@ -0,0 +1,45 @@ +# Generated by Django 4.2.17 on 2025-01-06 17:16 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("timerboard", "0006_alter_timer_objective_alter_timer_structure_and_more"), + ] + + operations = [ + migrations.AlterField( + model_name="timer", + name="structure", + field=models.CharField( + choices=[ + ("POCO", "POCO"), + ("Orbital Skyhook", "Orbital Skyhook"), + ("I-HUB", "Soverreignty Hub"), + ("TCU", "TCU"), + ("POS[S]", "POS [S]"), + ("POS[M]", "POS [M]"), + ("POS[L]", "POS [L]"), + ("Astrahus", "Astrahus"), + ("Fortizar", "Fortizar"), + ("Keepstar", "Keepstar"), + ("Raitaru", "Raitaru"), + ("Azbel", "Azbel"), + ("Sotiyo", "Sotiyo"), + ("Athanor", "Athanor"), + ("Tatara", "Tatara"), + ("Pharolux Cyno Beacon", "Cyno Beacon"), + ("Tenebrex Cyno Jammer", "Cyno Jammer"), + ("Ansiblex Jump Gate", "Ansiblex Jump Gate"), + ("Mercenary Den", "Mercenary Den"), + ("Moon Mining Cycle", "Moon Mining Cycle"), + ("Metenox Moon Drill", "Metenox Moon Drill"), + ("Other", "Other"), + ], + default="Other", + max_length=254, + ), + ), + ] From a03c7668400bfad8ba43e4040e2ddba3098a91df Mon Sep 17 00:00:00 2001 From: Peter Pfeufer Date: Fri, 10 Jan 2025 11:41:31 +0100 Subject: [PATCH 8/8] [FIX] Spelling mistakes Thx @soratidus999 --- .../timerboard/migrations/0007_alter_timer_structure.py | 2 +- allianceauth/timerboard/models.py | 2 +- allianceauth/timerboard/views.py | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/allianceauth/timerboard/migrations/0007_alter_timer_structure.py b/allianceauth/timerboard/migrations/0007_alter_timer_structure.py index e7468d57..26513513 100644 --- a/allianceauth/timerboard/migrations/0007_alter_timer_structure.py +++ b/allianceauth/timerboard/migrations/0007_alter_timer_structure.py @@ -17,7 +17,7 @@ class Migration(migrations.Migration): choices=[ ("POCO", "POCO"), ("Orbital Skyhook", "Orbital Skyhook"), - ("I-HUB", "Soverreignty Hub"), + ("I-HUB", "Sovereignty Hub"), ("TCU", "TCU"), ("POS[S]", "POS [S]"), ("POS[M]", "POS [M]"), diff --git a/allianceauth/timerboard/models.py b/allianceauth/timerboard/models.py index 6823ea8d..bf6f9b08 100644 --- a/allianceauth/timerboard/models.py +++ b/allianceauth/timerboard/models.py @@ -23,7 +23,7 @@ class Timer(models.Model): POCO = "POCO", _("POCO") ORBITALSKYHOOK = "Orbital Skyhook", _("Orbital Skyhook") - IHUB = "I-HUB", _("Soverreignty Hub") + IHUB = "I-HUB", _("Sovereignty Hub") TCU = "TCU", _("TCU") # Pending Remval POSS = "POS[S]", _("POS [S]") POSM = "POS[M]", _("POS [M]") diff --git a/allianceauth/timerboard/views.py b/allianceauth/timerboard/views.py index 27c6045f..0c7c76d1 100644 --- a/allianceauth/timerboard/views.py +++ b/allianceauth/timerboard/views.py @@ -54,7 +54,7 @@ class TimerView(BaseTimerView): if structure in bg_info: return "info" - elif structure in bg_waning: + elif structure in bg_warning: return "warning" elif structure in bg_danger: return "danger" @@ -84,7 +84,7 @@ class TimerView(BaseTimerView): Timer.Structure.POSM.value, # POS[M] Timer.Structure.POSL.value, # POS[L] ] - bg_waning = [ + bg_warning = [ Timer.Structure.ANSIBLEX.value, # Ansiblex Jump Gate Timer.Structure.ATHANOR.value, # Athanor Timer.Structure.AZBEL.value, # Azbel