refactor: remove unused imports and streamline code in calculations and navigation services
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import List, Optional
|
||||
from typing import List
|
||||
|
||||
from pydantic import BaseModel, Field, PositiveFloat, ValidationError, field_validator
|
||||
|
||||
|
||||
@@ -25,7 +25,6 @@ from schemas.calculations import (
|
||||
CapexCalculationResult,
|
||||
CapexCategoryBreakdown,
|
||||
CapexComponentInput,
|
||||
CapexParameters,
|
||||
CapexTotals,
|
||||
CapexTimelineEntry,
|
||||
CashFlowEntry,
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from dataclasses import dataclass, field
|
||||
from typing import Iterable, List, Optional, Sequence
|
||||
from typing import Iterable, List, Sequence
|
||||
|
||||
from fastapi import Request
|
||||
|
||||
from models.navigation import NavigationGroup, NavigationLink
|
||||
from models.navigation import NavigationLink
|
||||
from services.repositories import NavigationRepository
|
||||
from services.session import AuthSession
|
||||
|
||||
@@ -92,7 +92,7 @@ class NavigationService:
|
||||
) -> List[NavigationLinkDTO]:
|
||||
resolved_roles = tuple(roles)
|
||||
mapped: List[NavigationLinkDTO] = []
|
||||
for link in sorted(links, key=lambda l: (l.sort_order, l.id)):
|
||||
for link in sorted(links, key=lambda x: (x.sort_order, x.id)):
|
||||
if not include_children and link.parent_link_id is not None:
|
||||
continue
|
||||
if not include_disabled and (not link.is_enabled):
|
||||
|
||||
@@ -43,9 +43,9 @@ def session(engine) -> Iterator[Session]:
|
||||
def test_project_scenario_cascade_deletes(session: Session) -> None:
|
||||
project = Project(name="Cascade Mine",
|
||||
operation_type=MiningOperationType.OTHER)
|
||||
scenario_a = Scenario(
|
||||
Scenario(
|
||||
name="Base Case", status=ScenarioStatus.DRAFT, project=project)
|
||||
scenario_b = Scenario(
|
||||
Scenario(
|
||||
name="Expansion", status=ScenarioStatus.DRAFT, project=project)
|
||||
|
||||
session.add(project)
|
||||
|
||||
Reference in New Issue
Block a user