Skip to content

Commit

Permalink
Fix sorted graph names #1901
Browse files Browse the repository at this point in the history
  • Loading branch information
dennissiemensma committed Oct 23, 2023
1 parent 9ab6940 commit b82318b
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 3 deletions.
5 changes: 3 additions & 2 deletions docs/reference/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,13 @@ Current release series
:depth: 1


v5.11.0 - August 2023
------------------------
v5.11.0 - November 2023
-----------------------

- ``Fixed`` Bugfix for Archive which was causing the electricity returned meter positions to be displayed at all times.
- ``Fixed`` [`#1767 <https://github.com/dsmrreader/dsmr-reader/issues/1767>`_] Slightly alter debug info for unsupported database engines.
- ``Fixed`` [`#1841 <https://github.com/dsmrreader/dsmr-reader/issues/1841>`_] Restored broken `v4-upgrade-redirect` route for legacy upgrades.
- ``Fixed`` [`#1901 <https://github.com/dsmrreader/dsmr-reader/issues/1901>`_] Naamgeving in configuratie van sorted graphs.

- ``Changed`` [`#1827 <https://github.com/dsmrreader/dsmr-reader/issues/1827>`_] Update to python 3.11.2 - by ``goegol``
- ``Changed`` [`#1861 <https://github.com/dsmrreader/dsmr-reader/issues/1861>`_] Added undocumented env var for low level datalogger usage
Expand Down
2 changes: 1 addition & 1 deletion dsmr_frontend/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ class FrontendNotificationAdmin(ModelAdmin):

@admin.register(SortedGraph)
class SortedGraphAdmin(ChangeOnlyAdminModel, SortableAdmin):
list_display = ("sorting_order", "name")
list_display = ("sorting_order", "name", "graph_type")
fieldsets = (
(
None,
Expand Down
51 changes: 51 additions & 0 deletions dsmr_frontend/migrations/0050_sorted_graphs_names.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Generated by Django 3.2.22 on 2023-10-23 17:37

from django.db import migrations


def migrate_forward(apps, schema_editor):
GRAPH_TYPE_ELECTRICITY = "electricity"
GRAPH_TYPE_PHASES = "phases"
GRAPH_TYPE_VOLTAGE = "voltage"
GRAPH_TYPE_POWER_CURRENT = "power_current"
GRAPH_TYPE_GAS = "gas"
GRAPH_TYPE_WEATHER = "weather"
GRAPH_TYPE_ELECTRICITY_PEAKS = "electricity-peaks"

SortedGraph = apps.get_model("dsmr_frontend", "SortedGraph")
SortedGraph.objects.filter(graph_type=GRAPH_TYPE_ELECTRICITY).update(
name="Recent Electricity usage"
)
SortedGraph.objects.filter(graph_type=GRAPH_TYPE_PHASES).update(
name="Recent phase usage"
)
SortedGraph.objects.filter(graph_type=GRAPH_TYPE_VOLTAGE).update(
name="Recent phase voltages"
)
SortedGraph.objects.filter(graph_type=GRAPH_TYPE_POWER_CURRENT).update(
name="Recent phase currents"
)
SortedGraph.objects.filter(graph_type=GRAPH_TYPE_GAS).update(
name="Recent gas consumption"
)
SortedGraph.objects.filter(graph_type=GRAPH_TYPE_WEATHER).update(
name="Recent temperatures"
)
SortedGraph.objects.filter(graph_type=GRAPH_TYPE_ELECTRICITY_PEAKS).update(
name="Recent quarter hour electricity peak consumption"
)


def migrate_backward(apps, schema_editor):
# No-op. Idempotent when running migrate_forward() again.
pass


class Migration(migrations.Migration):
dependencies = [
("dsmr_frontend", "0049_alter_notification_options"),
]

operations = [
migrations.RunPython(migrate_forward, migrate_backward),
]

0 comments on commit b82318b

Please sign in to comment.