diff --git a/caluma/caluma_analytics/migrations/0005_analytics_field_ordering.py b/caluma/caluma_analytics/migrations/0005_analytics_field_ordering.py index 6e2d01618..d6509a859 100644 --- a/caluma/caluma_analytics/migrations/0005_analytics_field_ordering.py +++ b/caluma/caluma_analytics/migrations/0005_analytics_field_ordering.py @@ -12,7 +12,7 @@ class Migration(migrations.Migration): operations = [ migrations.AlterModelOptions( name="analyticsfield", - options={"ordering": ["sort", "alias"]}, + options={"ordering": ["sort", "-created_at"]}, ), migrations.AddField( model_name="analyticsfield", diff --git a/caluma/caluma_analytics/models.py b/caluma/caluma_analytics/models.py index d1e40fc80..6ba941442 100644 --- a/caluma/caluma_analytics/models.py +++ b/caluma/caluma_analytics/models.py @@ -97,7 +97,7 @@ def __repr__(self): return f"AnalyticsField<{self.table.slug}.{self.alias}>" class Meta: - ordering = ["sort", "alias"] + ordering = ["sort", "-created_at"] constraints = [ UniqueConstraint( name="unique_data_source", diff --git a/caluma/caluma_analytics/tests/__snapshots__/test_simple_table.ambr b/caluma/caluma_analytics/tests/__snapshots__/test_simple_table.ambr index a15f33f17..41169ff4c 100644 --- a/caluma/caluma_analytics/tests/__snapshots__/test_simple_table.ambr +++ b/caluma/caluma_analytics/tests/__snapshots__/test_simple_table.ambr @@ -99,14 +99,14 @@ }), dict({ 'node': dict({ - 'alias': 'foo', - 'value': 'bar', + 'alias': 'quarter', + 'value': '4', }), }), dict({ 'node': dict({ - 'alias': 'quarter', - 'value': '4', + 'alias': 'foo', + 'value': 'bar', }), }), dict({ diff --git a/caluma/caluma_analytics/tests/__snapshots__/test_table.ambr b/caluma/caluma_analytics/tests/__snapshots__/test_table.ambr index ba91321fc..58824c0f5 100644 --- a/caluma/caluma_analytics/tests/__snapshots__/test_table.ambr +++ b/caluma/caluma_analytics/tests/__snapshots__/test_table.ambr @@ -56,14 +56,14 @@ 'edges': list([ dict({ 'node': dict({ - 'alias': 'existing', - 'dataSource': 'meta.foobar', + 'alias': 'quarter', + 'dataSource': 'created_at.quarter', }), }), dict({ 'node': dict({ - 'alias': 'quarter', - 'dataSource': 'created_at.quarter', + 'alias': 'existing', + 'dataSource': 'meta.foobar', }), }), ]), @@ -89,14 +89,14 @@ 'edges': list([ dict({ 'node': dict({ - 'alias': 'existing', - 'dataSource': 'meta.foobar', + 'alias': 'foobar', + 'dataSource': 'meta.baz', }), }), dict({ 'node': dict({ - 'alias': 'foobar', - 'dataSource': 'meta.baz', + 'alias': 'existing', + 'dataSource': 'meta.foobar', }), }), ]),