Skip to content

Commit

Permalink
Update column name
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeh committed Sep 26, 2023
1 parent 14430ca commit f04764c
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class TypeormProjectCostSurface
CostSurfacePuDataEntity,
rows.map((row) => ({
cost: row.cost,
puid: row.projectsPuId,
projectsPuId: row.projectsPuId,
costSurfaceId: row.costSurfaceId,
})),
);
Expand Down Expand Up @@ -70,7 +70,7 @@ export class TypeormProjectCostSurface
*/
await this.geoprocessingEntityManager.query(
`
INSERT INTO cost_surface_pu_data (puid, cost, cost_surface_id)
INSERT INTO cost_surface_pu_data (projects_pu_id, cost, cost_surface_id)
SELECT ppu.id, round(pug.area / 1000000) as area, $2
FROM projects_pu ppu
INNER JOIN planning_units_geom pug ON pug.id = ppu.geom_id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export class PlanningUnitsGridProcessor {
// TODO: Maybe add a custom method in the repo, share it in libs to be used in both sides
const projectPuIds = projectPus.map((p) => p.id);
await manager.query(
`INSERT INTO cost_surface_pu_data (puid, cost, cost_surface_id)
`INSERT INTO cost_surface_pu_data (projects_pu_id, cost, cost_surface_id)
SELECT ppu.id, round(pug.area / 1000000) as area, ppu.id
FROM projects_pu ppu
INNER JOIN planning_units_geom pug ON pug.id = ppu.geom_id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ grid.geom
ids.map((geometryId: string) => {
return em.query(
`
INSERT INTO cost_surface_pu_data (puid, cost, cost_surface_id)
INSERT INTO cost_surface_pu_data (projects_pu_id, cost, cost_surface_id)
SELECT ppu.id, round(pug.area / 1000000) as area, $1
FROM projects_pu ppu
INNER JOIN planning_units_geom pug ON pug.id = ppu.geom_id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ export const getFixtures = async () => {
},
async ThenThePUCostOfThatPlanningAreaIsCreated(planingAreaId: string) {
const costForPlanningArea = await puGeoRepo.query(
`select * from cost_surface_pu_data join projects_pu pp on cost_surface_pu_data.puid = pp.id where pp.planning_area_id = $1`,
`select * from cost_surface_pu_data join projects_pu pp on cost_surface_pu_data.projects_pu_id = pp.id where pp.planning_area_id = $1`,
[planingAreaId],
);
const pusForProject = await projectsPuRepo.query(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export const GivenCostSurfacePuDataExists = async (
.getRepository(ProjectsPuEntity)
.findOneOrFail({ where: { projectId } });
await entityManager.query(
`INSERT INTO cost_surface_pu_data (puid, cost, cost_surface_id)
`INSERT INTO cost_surface_pu_data (projects_pu_id, cost, cost_surface_id)
SELECT ppu.id, round(pug.area / 1000000) as area, $1
FROM projects_pu ppu
INNER JOIN planning_units_geom pug ON pug.id = ppu.geom_id
Expand Down

0 comments on commit f04764c

Please sign in to comment.