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

fix: Lock Summary on Submit #1653

Merged
merged 4 commits into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all 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
13 changes: 3 additions & 10 deletions backend/lcfs/db/models/compliance/ComplianceReportSummary.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from sqlalchemy import Column, Integer, Float, ForeignKey, Boolean, CheckConstraint
from sqlalchemy.exc import InvalidRequestError
from sqlalchemy import Column, Integer, Float, ForeignKey, Boolean
from sqlalchemy.orm import relationship

from lcfs.db.base import BaseModel, Auditable
from datetime import datetime


class ComplianceReportSummary(BaseModel, Auditable):
Expand Down Expand Up @@ -112,13 +111,7 @@ class ComplianceReportSummary(BaseModel, Auditable):

compliance_report = relationship("ComplianceReport", back_populates="summary")

def lock_summary(self):
if not self.is_locked:
self.is_locked = True
else:
raise InvalidRequestError("ComplianceReportSummary is already locked")

def __repr__(self):
return f"<ComplianceReportSummary(id={self.summary_id}, quarter={self.quarter}, version={self.version})>"

# method to annualize a report once all four quarters are approved?
# method to annualize a report once all four quarters are approved?
2 changes: 0 additions & 2 deletions backend/lcfs/db/models/compliance/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
from .NotionalTransfer import NotionalTransfer
from .OtherUses import OtherUses
from .EndUserType import EndUserType
from . import listeners

__all__ = [
"AllocationAgreement",
Expand All @@ -30,6 +29,5 @@
"LevelOfEquipment",
"NotionalTransfer",
"OtherUses",
"listeners",
"EndUserType",
]
11 changes: 0 additions & 11 deletions backend/lcfs/db/models/compliance/listeners.py

This file was deleted.

1 change: 1 addition & 0 deletions backend/lcfs/web/api/compliance_report/repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,7 @@ async def save_compliance_report_summary(
f"No summary found with report ID {summary.compliance_report_id}"
)

summary_obj.is_locked = summary.is_locked
prv-proton marked this conversation as resolved.
Show resolved Hide resolved
# Update renewable fuel target summary
for row in summary.renewable_fuel_target_summary:
line_number = row.line
Expand Down