-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add year built to table * prefer non-null values for cross cycle columns * base for goal notes * goal crd tested * update tested * refactor to only permit update * attatch goal note to property on goal property filter and display * permissioning * backfill historical notes * post save goal to create goal notes * create historical notes on property creation * historical note view * precommit * access historical notes and refactor ui grid edit cells * precommit * migration order * migration order * migration order * update property retrieval * precommit * colors --------- Co-authored-by: Hannah Eslinger <[email protected]>
- Loading branch information
1 parent
da889df
commit cb8c7af
Showing
22 changed files
with
539 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Generated by Django 3.2.23 on 2024-02-01 22:04 | ||
|
||
import django.db.models.deletion | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('seed', '0216_goal'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='GoalNote', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('question', models.CharField(blank=True, choices=[('Is this a new construction or acquisition?', 'Is this a new construction or acquisition?'), ('Do you have data to report?', 'Do you have data to report?'), ('Is this value correct?', 'Is this value correct?'), ('Are these values correct?', 'Are these values correct?'), ('Other or multiple flags; explain in Additional Notes field', 'Other or multiple flags; explain in Additional Notes field')], max_length=1024, null=True)), | ||
('resolution', models.CharField(blank=True, max_length=1024, null=True)), | ||
('passed_checks', models.BooleanField(default=False)), | ||
('new_or_acquired', models.BooleanField(default=False)), | ||
('goal', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='seed.goal')), | ||
('property', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='seed.property')), | ||
], | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Generated by Django 3.2.23 on 2024-02-12 20:27 | ||
|
||
import django.db.models.deletion | ||
from django.db import migrations, models, transaction | ||
|
||
|
||
@transaction.atomic | ||
def backfill_historical_notes(apps, schema_editor): | ||
Property = apps.get_model("seed", "Property") | ||
HistoricalNote = apps.get_model("seed", "HistoricalNote") | ||
|
||
properties_to_update = Property.objects.filter(historical_note__isnull=True) | ||
|
||
historical_notes_to_create = [ | ||
HistoricalNote(property=property, text='') | ||
for property in properties_to_update | ||
] | ||
HistoricalNote.objects.bulk_create(historical_notes_to_create) | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('seed', '0217_goalnote'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='HistoricalNote', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('text', models.TextField(blank=True)), | ||
('property', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='historical_note', to='seed.property')), | ||
], | ||
), | ||
migrations.RunPython(backfill_historical_notes) | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
""" | ||
SEED Platform (TM), Copyright (c) Alliance for Sustainable Energy, LLC, and other contributors. | ||
See also https://github.com/seed-platform/seed/main/LICENSE.md | ||
""" | ||
from django.db import models | ||
|
||
from seed.models import Goal, Property | ||
|
||
|
||
class GoalNote(models.Model): | ||
QUESTION_CHOICES = ( | ||
('Is this a new construction or acquisition?', 'Is this a new construction or acquisition?'), | ||
('Do you have data to report?', 'Do you have data to report?'), | ||
('Is this value correct?', 'Is this value correct?'), | ||
('Are these values correct?', 'Are these values correct?'), | ||
('Other or multiple flags; explain in Additional Notes field', 'Other or multiple flags; explain in Additional Notes field'), | ||
) | ||
|
||
goal = models.ForeignKey(Goal, on_delete=models.CASCADE) | ||
property = models.ForeignKey(Property, on_delete=models.CASCADE) | ||
|
||
question = models.CharField(max_length=1024, choices=QUESTION_CHOICES, blank=True, null=True) | ||
resolution = models.CharField(max_length=1024, blank=True, null=True) | ||
passed_checks = models.BooleanField(default=False) | ||
new_or_acquired = models.BooleanField(default=False) | ||
|
||
def serialize(self): | ||
from seed.serializers.goal_notes import GoalNoteSerializer | ||
serializer = GoalNoteSerializer(self) | ||
return serializer.data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
""" | ||
SEED Platform (TM), Copyright (c) Alliance for Sustainable Energy, LLC, and other contributors. | ||
See also https://github.com/seed-platform/seed/main/LICENSE.md | ||
""" | ||
from rest_framework import serializers | ||
|
||
from seed.models import GoalNote | ||
|
||
|
||
class GoalNoteSerializer(serializers.ModelSerializer): | ||
|
||
class Meta: | ||
model = GoalNote | ||
fields = '__all__' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
""" | ||
SEED Platform (TM), Copyright (c) Alliance for Sustainable Energy, LLC, and other contributors. | ||
See also https://github.com/seed-platform/seed/main/LICENSE.md | ||
""" | ||
from rest_framework import serializers | ||
|
||
from seed.models import HistoricalNote | ||
|
||
|
||
class HistoricalNoteSerializer(serializers.ModelSerializer): | ||
|
||
class Meta: | ||
model = HistoricalNote | ||
fields = '__all__' |
Oops, something went wrong.