-
Notifications
You must be signed in to change notification settings - Fork 1
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
1962 eio form #2738
1962 eio form #2738
Changes from all commits
d7de312
4817815
f3758d2
e7c28c2
4212c2d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# Generated by Django 5.0.11 on 2025-02-06 19:28 | ||
|
||
import django.db.models.deletion | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('registration', '0075_facility_operation_historicalfacility_operation'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='facility', | ||
name='type', | ||
field=models.CharField( | ||
choices=[ | ||
('Single Facility', 'Single Facility'), | ||
('Large Facility', 'Large Facility'), | ||
('Medium Facility', 'Medium Facility'), | ||
('Small Aggregate', 'Small Aggregate'), | ||
('Electricity Import', 'Electricity Import'), | ||
], | ||
db_comment='The type of the facility', | ||
max_length=100, | ||
), | ||
), | ||
migrations.AlterField( | ||
model_name='historicalfacility', | ||
name='type', | ||
field=models.CharField( | ||
choices=[ | ||
('Single Facility', 'Single Facility'), | ||
('Large Facility', 'Large Facility'), | ||
('Medium Facility', 'Medium Facility'), | ||
('Small Aggregate', 'Small Aggregate'), | ||
('Electricity Import', 'Electricity Import'), | ||
], | ||
db_comment='The type of the facility', | ||
max_length=100, | ||
), | ||
), | ||
migrations.AlterField( | ||
model_name='operation', | ||
name='naics_code', | ||
field=models.ForeignKey( | ||
blank=True, | ||
db_comment="This column refers to an operation's primary NAICS code.", | ||
null=True, | ||
on_delete=django.db.models.deletion.PROTECT, | ||
related_name='operations', | ||
to='registration.naicscode', | ||
), | ||
), | ||
] |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -162,10 +162,11 @@ def create_facility_with_designated_operation(cls, user_guid: UUID, payload: Fac | |
operation = OperationDataAccessService.get_by_id(payload.operation_id) | ||
cls.check_user_access(user_guid, operation) | ||
|
||
# Validate that SFO can only make one facility | ||
num_facilities = FacilityDataAccessService.get_current_facilities_by_operation(operation).count() | ||
if num_facilities > 0 and operation.type == OperationTypes.SFO.value: | ||
raise RuntimeError("SFO can only create one facility, this page should not be accessible") | ||
# Validate that SFO and EIO can only have one facility | ||
if operation.facilities.count() > 0 and operation.type != OperationTypes.LFO.value: | ||
raise Exception( | ||
"This type of operation (SFO or EIO) can only have one facility, this page should not be accessible" | ||
) | ||
Comment on lines
+168
to
+169
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added this error for EIO too because I did manage to create a second facility while testing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of |
||
|
||
facility_data = cls.prepare_facility_data(payload) | ||
address_data = cls.build_address(payload) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the only field that isn't already optional, so perhaps it's not worth making a separate EIO schema