-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2688 from bcgov/chore-456-operation-representative
Chore 456 operation representative
- Loading branch information
Showing
20 changed files
with
505 additions
and
278 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
77 changes: 77 additions & 0 deletions
77
bc_obps/reporting/migrations/0044_reportoperationrepresentative.py
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,77 @@ | ||
# Generated by Django 5.0.9 on 2025-01-14 16:21 | ||
|
||
import django.db.models.deletion | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('registration', '0067_alter_facility_latitude_of_largest_emissions_and_more'), | ||
('reporting', '0043_alter_reportversion_status'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='ReportOperationRepresentative', | ||
fields=[ | ||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('created_at', models.DateTimeField(auto_now_add=True, null=True)), | ||
('updated_at', models.DateTimeField(blank=True, null=True)), | ||
('archived_at', models.DateTimeField(blank=True, null=True)), | ||
( | ||
'representative_name', | ||
models.CharField(db_comment='The name of the operation representative.', max_length=1000), | ||
), | ||
( | ||
'selected_for_report', | ||
models.BooleanField( | ||
db_comment='Indicates whether this representative is selected for reporting.', default=False | ||
), | ||
), | ||
( | ||
'archived_by', | ||
models.ForeignKey( | ||
blank=True, | ||
null=True, | ||
on_delete=django.db.models.deletion.PROTECT, | ||
related_name='%(class)s_archived', | ||
to='registration.user', | ||
), | ||
), | ||
( | ||
'created_by', | ||
models.ForeignKey( | ||
blank=True, | ||
null=True, | ||
on_delete=django.db.models.deletion.PROTECT, | ||
related_name='%(class)s_created', | ||
to='registration.user', | ||
), | ||
), | ||
( | ||
'report_version', | ||
models.ForeignKey( | ||
db_comment='The report version associated with this operation representative.', | ||
on_delete=django.db.models.deletion.CASCADE, | ||
related_name='report_operation_representatives', | ||
to='reporting.reportversion', | ||
), | ||
), | ||
( | ||
'updated_by', | ||
models.ForeignKey( | ||
blank=True, | ||
null=True, | ||
on_delete=django.db.models.deletion.PROTECT, | ||
related_name='%(class)s_updated', | ||
to='registration.user', | ||
), | ||
), | ||
], | ||
options={ | ||
'db_table': 'erc"."report_operation_representative', | ||
'db_table_comment': 'Stores information about operation representatives linked to report versions, including their selection status for reports.', | ||
}, | ||
), | ||
] |
17 changes: 17 additions & 0 deletions
17
bc_obps/reporting/migrations/0045_remove_reportoperation_operation_representative_name.py
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,17 @@ | ||
# Generated by Django 5.0.9 on 2025-01-14 17:46 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('reporting', '0044_reportoperationrepresentative'), | ||
] | ||
|
||
operations = [ | ||
migrations.RemoveField( | ||
model_name='reportoperation', | ||
name='operation_representative_name', | ||
), | ||
] |
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
32 changes: 32 additions & 0 deletions
32
bc_obps/reporting/models/report_operation_representative.py
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,32 @@ | ||
from django.db import models | ||
from registration.models.time_stamped_model import TimeStampedModel | ||
from reporting.models.report_version import ReportVersion | ||
|
||
|
||
class ReportOperationRepresentative(TimeStampedModel): | ||
""" | ||
Represents an operation representative associated with a specific report version. | ||
""" | ||
|
||
report_version = models.ForeignKey( | ||
ReportVersion, | ||
on_delete=models.CASCADE, | ||
related_name="report_operation_representatives", | ||
db_comment="The report version associated with this operation representative.", | ||
) | ||
representative_name = models.CharField( | ||
max_length=1000, | ||
db_comment="The name of the operation representative.", | ||
) | ||
selected_for_report = models.BooleanField( | ||
default=False, | ||
db_comment="Indicates whether this representative is selected for reporting.", | ||
) | ||
|
||
class Meta: | ||
db_table = 'erc"."report_operation_representative' | ||
app_label = 'reporting' | ||
db_table_comment = ( | ||
"Stores information about operation representatives linked to report versions, " | ||
"including their selection status for reports." | ||
) |
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
16 changes: 16 additions & 0 deletions
16
bc_obps/reporting/tests/models/test_report_operation_representative.py
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,16 @@ | ||
from common.tests.utils.helpers import BaseTestCase | ||
from registration.tests.constants import TIMESTAMP_COMMON_FIELDS | ||
from model_bakery.baker import make_recipe | ||
|
||
|
||
class ReportOperationRepresentativeModelTest(BaseTestCase): | ||
@classmethod | ||
def setUpTestData(cls): | ||
cls.test_object = make_recipe('reporting.tests.utils.report_operation_representative') | ||
cls.field_data = [ | ||
*TIMESTAMP_COMMON_FIELDS, | ||
("id", "ID", None, None), | ||
("report_version", "report version", None, None), | ||
("representative_name", "representative name", None, None), | ||
("selected_for_report", "selected for report", None, None), | ||
] |
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
Oops, something went wrong.