Skip to content

Commit

Permalink
/vaccination fix lastUpdate (#542)
Browse files Browse the repository at this point in the history
* add new vaccine "Comirnaty Omicron XBB.1.5" mapped to "biontechBivalent"

* fix linting

* fix lastUpdate

* fix linting
  • Loading branch information
Rubber1Duck authored Oct 10, 2023
1 parent 03d359d commit 3327721
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions src/data-requests/vaccination.ts
Original file line number Diff line number Diff line change
Expand Up @@ -601,23 +601,23 @@ export async function getVaccinationCoverage(): Promise<
});
}
);
const apiUrlCommitsMain = new URL(
`https://api.github.com/repos/robert-koch-institut/COVID-19-Impfungen_in_Deutschland/commits/main`
// get last commit of Deutschland_Bundeslaender_COVID-19-Impfungen.csv
const apiDBUrl = new URL(
"https://api.github.com/repos/robert-koch-institut/COVID-19-Impfungen_in_Deutschland/commits?path=Deutschland_Bundeslaender_COVID-19-Impfungen.csv"
);
const apiResponse: { lastUpdate: Date; sha: string } = await GetApiCommit(
apiUrlCommitsMain.href,
apiUrlCommitsMain.pathname
const lastCommitData: { lastUpdate: Date; sha: string } = await GetApiCommit(
apiDBUrl.href,
apiDBUrl.pathname
).then((apiData) => {
const lastUpdate = new Date(apiData.commit.author.date);
const sha = apiData.sha;
return { lastUpdate, sha };
return {
lastUpdate: new Date(apiData[0].commit.author.date),
sha: apiData[0].sha,
};
});
const lastUpdate = apiResponse.lastUpdate;
const sha = apiResponse.sha;

// finde den letzten Datansatz bevor dem aktuellen
// finde den letzten Datansatz vor dem aktuellen
const apiUrlTreesSha = new URL(
`https://api.github.com/repos/robert-koch-institut/COVID-19-Impfungen_in_Deutschland/git/trees/${sha}`
`https://api.github.com/repos/robert-koch-institut/COVID-19-Impfungen_in_Deutschland/git/trees/${lastCommitData.sha}`
);
const filesResponse = await GetApiTrees(
apiUrlTreesSha.href,
Expand Down Expand Up @@ -1165,7 +1165,7 @@ export async function getVaccinationCoverage(): Promise<

return {
data: coverage,
lastUpdate: lastUpdate,
lastUpdate: lastCommitData.lastUpdate,
};
}

Expand Down

0 comments on commit 3327721

Please sign in to comment.