WomenPlusPlus / deploy-impact-23-kpi-3

GNU General Public License v3.0
0 stars 3 forks source link

Create queries for the economist reporting form #50

Open dasvas opened 11 months ago

dasvas commented 11 months ago

Create queries for each field in the economist reporting form to fetch data from the DB.

Related to user story #40

Daria-Oni commented 10 months ago

Hi. I was practicing writing RPCs and queries in Supabase and tried to address this issue: 'In the form, there is an option to select a reporting year.' I understood the end-to-end method of doing things:)

Image

Image

Image

Image

maalej commented 10 months ago

Given a KPI id, you need to retrieve that KPI with the min and max values from unit_constraint table.

Daria-Oni commented 10 months ago

git commit -m "Updated kpi.service and kpi.controller to retrieve min and max values for KPI" in daria-branch

Image

@maalej

Daria-Oni commented 10 months ago

Image

Daria-Oni commented 10 months ago

???(Could you try to fetch the value with a 3rd join with fills_in table?)

LEFT JOIN LATERAL ( -- Using LATERAL to fetch the latest kpi_value SELECT f.kpi_value FROM fills_in AS f WHERE f.kpi_id = k.id ORDER BY f.updated_at DESC LIMIT 1 ) AS fi ON TRUE

Image