Skip to content

Commit

Permalink
API source update and resultItems
Browse files Browse the repository at this point in the history
  • Loading branch information
fabianlinkflink committed Dec 10, 2024
1 parent feca136 commit e5f678c
Show file tree
Hide file tree
Showing 7 changed files with 193 additions and 92 deletions.
7 changes: 4 additions & 3 deletions src/components/Graphs/GraphContainer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ import Dropdown from '@/components/Misc/Dropdown.vue'
// Utility imports
import {
geometryToChartData,
geometryToNestedChartData,
ResultItemToChartData,
geometryToMaterialTypeNestedChartData
ResultItemToNestedChartData
} from '@/utils/resultUtils'
// Type imports
Expand Down Expand Up @@ -156,8 +157,8 @@ const updateGraphProps = (chart: string = "") => {
aggregate: true,
unit: "kgCO2e",
}
data = geometryToMaterialTypeNestedChartData(projectStore.currProject.geometry)
data = geometryToNestedChartData(projectStore.currProject.geometry, selectedResult.value.parameter)
graphProps.value = {
data,
options,
Expand Down
2 changes: 1 addition & 1 deletion src/models/result.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export interface GroupedResults{
parameter: string
data: GroupedEmission
quantity?: Quantity
nested?: GroupedResults[]
}

/**
Expand All @@ -27,7 +28,6 @@ export interface ResultItem {
parameter: string
displayName: string
data: GroupedResults[]
nested?: ResultItem
}

export type ResultList = ResultItem[]
Expand Down
1 change: 0 additions & 1 deletion src/models/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ export interface CalculationSettings {
key: string,
data: BuildingCodeItem[],
},

}

export interface MaterialSettings {
Expand Down
13 changes: 11 additions & 2 deletions src/utils/EPDUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ interface EPDService {

/**
* Class for fetching data from EcoPortal
* TODO: This implementation is not done yet, EPD Information is flaky at best
*/
class EcoPortalService implements EPDService {
createApiClient() {
Expand Down Expand Up @@ -93,12 +94,20 @@ class RevaluService implements EPDService {
})
}

// Create list URL, we check if dev or not and switch the URL
createListUrl() {
return 'api/revalu/epds/search'
const apiListUrl = import.meta.env.MODE === 'development'
? '/SpeckleLCA/api/revalu/epds/search'
: 'https://api.revalu.io/epds/search'
return apiListUrl
}

// Create EPD URL, we check if dev or not and switch the URL
createEPDUrl(epd: any) {
return `api/revalu/epds/${epd.id}`
const apiEPDUrl = import.meta.env.MODE === 'development'
? `/SpeckleLCA/api/revalu/epds/${epd.id}`
: `https://api.revalu.io/epds/${epd.id}`
return apiEPDUrl
}

createListParams() {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/emissionUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export class EmissionCalculator {
for (const phase in matEmission) {
// Check if the phase is included in the calculation settings, if not skip it
if (this.settingsStore.calculationSettings.includedStages.relevantStages.some(
(stage) => phase === stage.stage)
(stage) => phase === stage.stage && stage.included)
){
let value = matEmission[phase]
if (value === undefined) value = matEmission[phase]
Expand Down
3 changes: 1 addition & 2 deletions src/utils/projectUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import type { GeometryObject } from '@/models/geometryObject'
import { useProjectStore } from '@/stores/main'
import {
baseColors,
getValueColorFromGradient,
generateColors,
getValueColorFromGradient,
ColorManager
} from '@/utils/colorUtils'

Expand Down
Loading

0 comments on commit e5f678c

Please sign in to comment.