Skip to content

Commit

Permalink
Fix query dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeh committed Oct 4, 2023
1 parent 785178a commit fee5d95
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {
get_annual_commodity_weighted_impact_over_georegion,
get_annual_landscape_impact_over_georegion,
get_h3_table_column_for_indicators_by_name_code,
} from 'procedures/stored-prodecures';
import { MigrationInterface, QueryRunner } from 'typeorm';
Expand All @@ -10,7 +10,7 @@ export class AddNewImpactStoredProcedure1695954091382
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`
CREATE OR REPLACE FUNCTION ${get_annual_commodity_weighted_impact_over_georegion}(
CREATE OR REPLACE FUNCTION ${get_annual_landscape_impact_over_georegion}(
geo_region_id uuid,
shortName text,
material_id uuid,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { INDICATOR_NAME_CODES } from 'modules/indicators/indicator.entity';
import {
get_annual_commodity_weighted_impact_over_georegion,
get_annual_landscape_impact_over_georegion,
get_indicator_coefficient_impact,
} from 'procedures/stored-prodecures';

Expand Down Expand Up @@ -74,17 +74,17 @@ export const INDICATOR_NAME_CODE_TO_QUERY_MAP: {
production: () =>
`sum_material_over_georegion($1, $2, 'producer') as "${QueryPropertyNames.production}"`,
[INDICATOR_NAME_CODES.DF_SLUC]: (nameCode: INDICATOR_NAME_CODES) =>
`${get_annual_commodity_weighted_impact_over_georegion}($1, '${nameCode}', $2, 'producer') as "${INDICATOR_NAME_CODES.DF_SLUC}"`,
`${get_annual_landscape_impact_over_georegion}($1, '${nameCode}', $2, 'producer') as "${INDICATOR_NAME_CODES.DF_SLUC}"`,
},
[INDICATOR_NAME_CODES.GHG_DEF_SLUC]: {
production: () =>
`sum_material_over_georegion($1, $2, 'producer') as "${QueryPropertyNames.production}"`,
[INDICATOR_NAME_CODES.GHG_DEF_SLUC]: (nameCode: INDICATOR_NAME_CODES) =>
`${get_annual_commodity_weighted_impact_over_georegion}($1,'${nameCode}', $2, 'producer') as "${INDICATOR_NAME_CODES.GHG_DEF_SLUC}"`,
`${get_annual_landscape_impact_over_georegion}($1,'${nameCode}', $2, 'producer') as "${INDICATOR_NAME_CODES.GHG_DEF_SLUC}"`,
},
[INDICATOR_NAME_CODES.UWU]: {
[INDICATOR_NAME_CODES.UWU]: (nameCode: INDICATOR_NAME_CODES) =>
`${get_annual_commodity_weighted_impact_over_georegion}($1, '${nameCode}', $2, 'producer') as "${INDICATOR_NAME_CODES.UWU}"`,
`${get_indicator_coefficient_impact}('${nameCode}', $3, $2) as "${INDICATOR_NAME_CODES.UWU}"`,
},
[INDICATOR_NAME_CODES.WU]: {
[INDICATOR_NAME_CODES.WU]: (nameCode: INDICATOR_NAME_CODES) =>
Expand All @@ -99,14 +99,14 @@ export const INDICATOR_NAME_CODE_TO_QUERY_MAP: {
production: () =>
`sum_material_over_georegion($1, $2, 'producer') as "${QueryPropertyNames.production}"`,
[INDICATOR_NAME_CODES.NCE]: (nameCode: INDICATOR_NAME_CODES) =>
`${get_annual_commodity_weighted_impact_over_georegion}($1, '${nameCode}', $2, 'producer') as "${INDICATOR_NAME_CODES.NCE}"`,
`${get_annual_landscape_impact_over_georegion}($1, '${nameCode}', $2, 'producer') as "${INDICATOR_NAME_CODES.NCE}"`,
},
[INDICATOR_NAME_CODES.FLIL]: {
production: () =>
`sum_material_over_georegion($1, $2, 'producer') as "${QueryPropertyNames.production}"`,
harvest: () =>
`sum_material_over_georegion($1, $2, 'harvest') as "${QueryPropertyNames.harvest}"`,
[INDICATOR_NAME_CODES.FLIL]: (nameCode: INDICATOR_NAME_CODES) =>
`${get_annual_commodity_weighted_impact_over_georegion}($1, '${nameCode}', $2, 'producer') as "${INDICATOR_NAME_CODES.FLIL}"`,
`${get_annual_landscape_impact_over_georegion}($1, '${nameCode}', $2, 'producer') as "${INDICATOR_NAME_CODES.FLIL}"`,
},
};
2 changes: 1 addition & 1 deletion api/src/procedures/stored-prodecures.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const get_h3_table_column_for_indicators_by_name_code: string =
'get_h3_table_column_for_indicators_by_name_code';

export const get_annual_commodity_weighted_impact_over_georegion: string = `get_annual_commodity_weighted_impact_over_georegion`;
export const get_annual_landscape_impact_over_georegion: string = `get_annual_landscape_impact_over_georegion`;

export const get_indicator_coefficient_impact: string = `get_indicator_coefficient_impact`;

0 comments on commit fee5d95

Please sign in to comment.