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

LCFS-1659: Incorrect fuel type list in Fuels for other use #1658

Merged
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
"""Update other_uses_fossil_derived in fuel_type

Revision ID: fe03799b4018
Revises: fa98709e7952
Create Date: 2025-01-14 18:12:43.683691

"""

import sqlalchemy as sa
from alembic import op

# revision identifiers, used by Alembic.
revision = "fe03799b4018"
down_revision = "5163af6ba4a4"
branch_labels = None
depends_on = None


def upgrade() -> None:
# Set other_uses_fossil_derived to false
op.execute("""
UPDATE fuel_type
SET other_uses_fossil_derived = false
WHERE fuel_type IN (
'CNG', 'Electricity', 'Hydrogen', 'LNG', 'Propane',
'Natural gas-based gasoline', 'Petroleum-based diesel',
'Petroleum-based gasoline'
)
""")

# Set other_uses_fossil_derived to true
op.execute("""
UPDATE fuel_type
SET other_uses_fossil_derived = true
WHERE fuel_type IN (
'Alternative jet fuel', 'Biodiesel', 'Ethanol', 'HDRD',
'Other diesel fuel', 'Renewable gasoline', 'Renewable naphtha'
)
""")

def downgrade() -> None:
# Revert `other_uses_fossil_derived` to original values for false
op.execute("""
UPDATE fuel_type
SET other_uses_fossil_derived = true
WHERE fuel_type IN (
'CNG', 'Electricity', 'Hydrogen', 'LNG', 'Propane',
'Natural gas-based gasoline', 'Petroleum-based diesel',
'Petroleum-based gasoline'
)
""")

# Revert `other_uses_fossil_derived` to original values for true
op.execute("""
UPDATE fuel_type
SET other_uses_fossil_derived = false
WHERE fuel_type IN (
'Alternative jet fuel', 'Biodiesel', 'Ethanol', 'HDRD',
'Other diesel fuel', 'Renewable gasoline', 'Renewable naphtha'
)
""")
1 change: 1 addition & 0 deletions backend/lcfs/web/api/other_uses/repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@ async def get_formatted_fuel_types(
joinedload(FuelType.provision_1),
joinedload(FuelType.provision_2),
)
.order_by(FuelType.fuel_type)
)

result = await self.db.execute(query)
Expand Down
9 changes: 9 additions & 0 deletions frontend/src/views/OtherUses/AddEditOtherUses.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,15 @@ export const AddEditOtherUses = () => {

params.node.setDataValue('fuelCategory', categoryValue)

// Auto populate the "provisionOfTheAct" field
areyeslo marked this conversation as resolved.
Show resolved Hide resolved
const provisions = fuelType.provisionOfTheAct.map(
(provision) => provision.name
)

const provisionValue =
provisions.length === 1 ? provisions[0] : null
params.node.setDataValue('provisionOfTheAct', provisionValue)

// Auto-populate the "fuelCode" field
const fuelCodeOptions = fuelType.fuelCodes.map(
(code) => code.fuelCode
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/views/OtherUses/OtherUsesSummary.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export const OtherUsesSummary = ({ data, status }) => {
minWidth: 200
},
{
headerName: t('otherUses:otherUsesColLabels.rationale'),
headerName: t('otherUses:otherUsesColLabels.otherExpectedUse'),
field: 'rationale',
floatingFilter: false,
flex: 1,
Expand Down