Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Portfolio summary move to backend #4885

Merged
merged 8 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions seed/migrations/0233_alter_goal_options.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Generated by Django 3.2.25 on 2024-11-01 21:40

from django.db import migrations


class Migration(migrations.Migration):
dependencies = [
("seed", "0232_reportconfiguration"),
]

operations = [
migrations.AlterModelOptions(
name="goal",
options={"ordering": ["name"]},
),
]
8 changes: 0 additions & 8 deletions seed/models/data_quality.py
Original file line number Diff line number Diff line change
Expand Up @@ -977,10 +977,6 @@ def append_to_apply_labels():
self.add_result_range_error(row["current"].id, rule, data_type, value)
self.update_status_label(PropertyViewLabel, rule, current_view.id, row["current"].id)

# other rule condition types
else:
logging.error(">>> OTHER")

else: # Within Cycle
for cycle_key in ["baseline", "current"]:
state = row["baseline"] if cycle_key == "baseline" else row["current"]
Expand All @@ -1005,10 +1001,6 @@ def append_to_apply_labels():
self.add_result_is_null(state.id, rule, data_type, value)
self.update_status_label(PropertyViewLabel, rule, view.id, state.id)

# other rule condition types.
else:
logging.error(">>> OTHER")

goal_note.passed_checks = all(results)

# if there are multiple rules with the same label, determine if they are all passing to add or remove the label
Expand Down
3 changes: 3 additions & 0 deletions seed/models/goals.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ class Goal(models.Model):
commitment_sqft = models.IntegerField(blank=True, null=True, validators=[MinValueValidator(0)])
name = models.CharField(max_length=255, unique=True)

class Meta:
ordering = ["name"]

def __str__(self):
return f"Goal - {self.name}"

Expand Down
15 changes: 14 additions & 1 deletion seed/serializers/goals.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,20 @@ class Meta:

def to_representation(self, obj):
result = super().to_representation(obj)
result["level_name_index"] = obj.access_level_instance.depth - 1
level_index = obj.access_level_instance.depth - 1

details = {
"level_name_index": level_index,
"level_name": obj.organization.access_level_names[level_index],
"baseline_cycle_name": obj.baseline_cycle.name,
"current_cycle_name": obj.current_cycle.name,
"eui_column1_name": obj.eui_column1.display_name,
"eui_column2_name": obj.eui_column2.display_name if obj.eui_column2 else None,
"eui_column3_name": obj.eui_column3.display_name if obj.eui_column3 else None,
"area_column_name": obj.area_column.display_name,
}
result.update(details)

return result

def validate(self, data):
Expand Down
Loading
Loading