Skip to content

Commit

Permalink
Display number of hakukohde on haut
Browse files Browse the repository at this point in the history
  • Loading branch information
SalamaGofore committed Apr 3, 2024
1 parent a5fe852 commit 7e851fd
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,8 @@ jobs:
run: npm ci
- name: Install Playwright Browsers
run: npx playwright install --with-deps
- name: Start mockserver
run: npm run mocks &
- name: Start the app
run: npm run dev &
- name: Start the mockserver & app
run: npm run mocks & npm run dev &
- name: Run Playwright tests
run: npx playwright test
- uses: actions/upload-artifact@v3
Expand Down
5 changes: 5 additions & 0 deletions mocks/routes/kouta/haut.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ const HAUT = [
"paattyy": "2024-10-31T00:00:00"
}
],
"hakukohdeOids": [],
"valintakokeet": [],
"muokkaaja": "1.2.246.562.24.10327979532",
"kielivalinta": [
Expand Down Expand Up @@ -138,6 +139,7 @@ const HAUT = [
"paattyy": "2022-08-14T00:00:00"
}
],
"hakukohdeOids": [],
"valintakokeet": [],
"muokkaaja": "1.2.246.562.24.61168703071",
"kielivalinta": [
Expand Down Expand Up @@ -166,6 +168,7 @@ const HAUT = [
},
"organisaatioOid": "1.2.246.562.10.135945357610",
"hakuajat": [],
"hakukohdeOids": [],
"valintakokeet": [],
"muokkaaja": "1.2.246.562.24.78053256082",
"kielivalinta": [
Expand Down Expand Up @@ -232,6 +235,7 @@ const HAUT = [
"paattyy": "2023-08-07T00:00:00"
}
],
"hakukohdeOids": [],
"valintakokeet": [],
"muokkaaja": "1.2.246.562.24.65467286208",
"kielivalinta": [
Expand Down Expand Up @@ -267,6 +271,7 @@ const HAUT = [
"alkaa": "2023-11-14T08:00:00"
}
],
"hakukohdeOids": [],
"valintakokeet": [],
"muokkaaja": "1.2.246.562.24.80913193985",
"kielivalinta": [
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/haku-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const HakuList = ({haut, hakutavat}: {haut : Haku[], hakutavat: Koodi[]})
<TableCell>{Tila[haku.tila]}</TableCell>
<TableCell>{getMatchingHakutapa(haku.hakutapaKoodiUri)}</TableCell>
<TableCell>{haku.alkamisKausiKoodiUri ? `${haku.alkamisVuosi} ${getAlkamisKausi(haku.alkamisKausiKoodiUri)}` : ''}</TableCell>
<TableCell>0</TableCell>
<TableCell>{haku.hakukohteita}</TableCell>
</TableRow>
))}
</TableBody>
Expand Down
7 changes: 4 additions & 3 deletions src/app/lib/kouta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ export type Haku = {
tila: Tila,
alkamisVuosi: number,
alkamisKausiKoodiUri: string,
hakutapaKoodiUri: string
hakutapaKoodiUri: string,
hakukohteita: number
}

export type Hakukohde = {
Expand Down Expand Up @@ -70,10 +71,10 @@ export async function getHaut(active: boolean = true) {
const response = await axios.get(configuration.hautUrl, {
headers,
});
const haut: Haku[] = response.data.map((h: { oid: string, nimi: TranslatedName, tila: string, hakutapaKoodiUri: string, hakuvuosi: string, hakukausi: string}) => {
const haut: Haku[] = response.data.map((h: { oid: string, nimi: TranslatedName, tila: string, hakutapaKoodiUri: string, hakuvuosi: string, hakukausi: string, hakukohdeOids: string[]}) => {
const haunTila: Tila = Tila[h.tila.toUpperCase() as keyof typeof Tila];
return {oid: h.oid, nimi: h.nimi, tila: haunTila, hakutapaKoodiUri: h.hakutapaKoodiUri,
alkamisVuosi: parseInt(h.hakuvuosi), alkamisKausiKoodiUri: h.hakukausi};
alkamisVuosi: parseInt(h.hakuvuosi), alkamisKausiKoodiUri: h.hakukausi, hakukohteita: h.hakukohdeOids.length};
});
return haut;
}
Expand Down

0 comments on commit 7e851fd

Please sign in to comment.