Skip to content

Commit

Permalink
crop and harvest distribution fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Danielzxccc committed May 1, 2024
1 parent 526cab1 commit 3d59693
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/modules/Reports/ReportsService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1064,7 +1064,7 @@ export async function getFarmHarvestDistribution(month: number, limit: number) {
sql`
WITH monthly_harvest AS (
SELECT
SUM(harvested_qty) AS total_harvest,
SUM(kilogram) AS total_harvest,
EXTRACT(MONTH FROM date_harvested) AS harvest_month
FROM community_crop_reports
WHERE EXTRACT(MONTH FROM date_harvested) = ${month}
Expand All @@ -1073,7 +1073,7 @@ export async function getFarmHarvestDistribution(month: number, limit: number) {
farm_harvest AS (
SELECT
farmid,
SUM(harvested_qty) AS farm_harvest_qty
SUM(kilogram) AS farm_harvest_qty
FROM community_crop_reports
WHERE EXTRACT(MONTH FROM date_harvested) = ${month}
GROUP BY farmid
Expand All @@ -1099,7 +1099,7 @@ export async function getCropHarvestDistribution(month: number, limit: number) {
SELECT
cc.crop_id,
c.name AS crop_name,
SUM(cr.harvested_qty) AS total_harvested_qty
SUM(cr.kilogram) AS total_harvested_qty
FROM
community_crop_reports cr
JOIN
Expand Down

0 comments on commit 3d59693

Please sign in to comment.