From 42df654dcd872b9262933928d1c850985ba101cb Mon Sep 17 00:00:00 2001 From: Daniel Haselhan Date: Wed, 4 Dec 2024 15:14:05 -0800 Subject: [PATCH] fix: Data and Label Fixes * Change hydrogen to kg * Relabel allocation agreement transaciton types * Rename first column to Responsibility * Add $ infront of CAD --- .../versions/2024-12-04-23-00_8491890dd688.py | 57 +++++++++++++++++++ .../common/allocation_agreement_seeder.py | 8 +-- .../db/seeders/common/seed_fuel_data.json | 3 +- .../locales/en/allocationAgreement.json | 2 +- frontend/src/assets/locales/en/transfer.json | 2 +- 5 files changed, 64 insertions(+), 8 deletions(-) create mode 100644 backend/lcfs/db/migrations/versions/2024-12-04-23-00_8491890dd688.py diff --git a/backend/lcfs/db/migrations/versions/2024-12-04-23-00_8491890dd688.py b/backend/lcfs/db/migrations/versions/2024-12-04-23-00_8491890dd688.py new file mode 100644 index 000000000..d12c0a57a --- /dev/null +++ b/backend/lcfs/db/migrations/versions/2024-12-04-23-00_8491890dd688.py @@ -0,0 +1,57 @@ +"""Data Fixes + +Revision ID: 8491890dd688 +Revises: aeaa26f5cdd5 +Create Date: 2024-12-04 23:00:10.708533 + +""" + +from alembic import op +from sqlalchemy import update + +from lcfs.db.models import FuelType, AllocationTransactionType +from lcfs.db.models.fuel.FuelType import QuantityUnitsEnum + +# revision identifiers, used by Alembic. +revision = "8491890dd688" +down_revision = "aeaa26f5cdd5" +branch_labels = None +depends_on = None + + +def upgrade() -> None: + # ### commands auto generated by Alembic - please adjust! ### + op.execute( + update(FuelType) + .where(FuelType.fuel_type_id == 6) + .values(units=QuantityUnitsEnum.Kilograms) + ) + + op.execute( + update(FuelType).where(FuelType.fuel_type_id == 20).values(fossil_derived=False) + ) + + # Update 'type' and 'description' in allocation_transaction_type where allocation_transaction_type_id = 2 + op.execute( + update(AllocationTransactionType) + .where(AllocationTransactionType.allocation_transaction_type_id == 2) + .values( + type="Allocated to", + description="Fuel allocated to another supplier under an allocation agreement", + ) + ) + + # Update 'type' and 'description' in allocation_transaction_type where allocation_transaction_type_id = 1 + op.execute( + update(AllocationTransactionType) + .where(AllocationTransactionType.allocation_transaction_type_id == 1) + .values( + type="Allocated from", + description="Fuel allocated from another supplier under an allocation agreement", + ) + ) + # ### end Alembic commands ### + + +def downgrade() -> None: + pass diff --git a/backend/lcfs/db/seeders/common/allocation_agreement_seeder.py b/backend/lcfs/db/seeders/common/allocation_agreement_seeder.py index e78fc2bbc..e48a57227 100644 --- a/backend/lcfs/db/seeders/common/allocation_agreement_seeder.py +++ b/backend/lcfs/db/seeders/common/allocation_agreement_seeder.py @@ -18,15 +18,15 @@ async def seed_allocation_transaction_types(session): allocation_transaction_types_to_seed = [ { "allocation_transaction_type_id": 1, - "type": "Purchased", - "description": "Fuel purchased under an allocation agreement", + "type": "Allocated from", + "description": "Fuel allocated from another supplier under an allocation agreement", "display_order": 1, "effective_date": datetime.strptime("2012-01-01", "%Y-%m-%d").date(), }, { "allocation_transaction_type_id": 2, - "type": "Sold", - "description": "Fuel sold under an allocation agreement", + "type": "Allocated to", + "description": "Fuel allocated to another supplier under an allocation agreement", "display_order": 2, "effective_date": datetime.strptime("2012-01-01", "%Y-%m-%d").date(), }, diff --git a/backend/lcfs/db/seeders/common/seed_fuel_data.json b/backend/lcfs/db/seeders/common/seed_fuel_data.json index 828d7576d..db08313f8 100644 --- a/backend/lcfs/db/seeders/common/seed_fuel_data.json +++ b/backend/lcfs/db/seeders/common/seed_fuel_data.json @@ -83,7 +83,7 @@ "provision_1_id": 2, "provision_2_id": 3, "default_carbon_intensity": 123.96, - "units": "kWh", + "units": "kg", "unrecognized": false }, { @@ -97,7 +97,6 @@ "units": "kg", "unrecognized": false }, - { "fuel_type_id": 11, "fuel_type": "Alternative jet fuel", diff --git a/frontend/src/assets/locales/en/allocationAgreement.json b/frontend/src/assets/locales/en/allocationAgreement.json index cb01bb29a..1da1af078 100644 --- a/frontend/src/assets/locales/en/allocationAgreement.json +++ b/frontend/src/assets/locales/en/allocationAgreement.json @@ -4,7 +4,7 @@ "addAllocationAgreementRowsTitle": "Allocation agreements (e.g., allocating responsibility for fuel)", "allocationAgreementSubtitle": "Enter allocation agreement details below", "allocationAgreementColLabels": { - "transaction": "Transaction", + "transaction": "Responsibility", "transactionPartner": "Legal name of transaction partner", "postalAddress": "Address for service", "transactionPartnerEmail": "Email", diff --git a/frontend/src/assets/locales/en/transfer.json b/frontend/src/assets/locales/en/transfer.json index f0e5ffc25..14ba125bd 100644 --- a/frontend/src/assets/locales/en/transfer.json +++ b/frontend/src/assets/locales/en/transfer.json @@ -51,7 +51,7 @@ "loadingText": "Loading transfer...", "processingText": "Processing transfer...", "detailsLabel": "Transfer Details (required)", - "fairMarketText": "The fair market value of any consideration, in CAD", + "fairMarketText": "The fair market value of any consideration, in $CAD", "totalValueText": " per compliance unit for a total value of ", "saLabel": "Signing Authority Declaration", "saConfirmation": "I confirm that records evidencing each matter reported under section 18 of the Low Carbon Fuel (General) Regulation are available on request.",