diff --git a/src/main/java/de/philliphow/covidimpfde/logic/VaccinationDataInterpretation.java b/src/main/java/de/philliphow/covidimpfde/logic/VaccinationDataInterpretation.java index 076d46f..26b6a2a 100644 --- a/src/main/java/de/philliphow/covidimpfde/logic/VaccinationDataInterpretation.java +++ b/src/main/java/de/philliphow/covidimpfde/logic/VaccinationDataInterpretation.java @@ -63,6 +63,20 @@ public VaccinationDataRow getLatestUpdate() { public int getLatestUpdateShotsToday() { return latestUpdate.getShotsToday(); } + + /** + * @return how many first doeses have been issued on the last day + */ + public int getLatestUpdateNewFirstShots() { + return latestUpdate.getFirstShotsToday(); + } + + /** + * @return how many second doeses have been issued on the last day + */ + public int getLatestUpdateNewSecondShots() { + return latestUpdate.getSecondShotsToday(); + } /** * @return the difference between the shots issued on the last day and the day @@ -323,4 +337,5 @@ public List getLastNWeeklySummarys(int n) { } + } \ No newline at end of file diff --git a/src/main/java/de/philliphow/covidimpfde/strings/messagegenerators/VaccinationUpdateString.java b/src/main/java/de/philliphow/covidimpfde/strings/messagegenerators/VaccinationUpdateString.java index 68f7e2b..8236957 100644 --- a/src/main/java/de/philliphow/covidimpfde/strings/messagegenerators/VaccinationUpdateString.java +++ b/src/main/java/de/philliphow/covidimpfde/strings/messagegenerators/VaccinationUpdateString.java @@ -82,12 +82,16 @@ private String getFirstSecondShotUpdate() { String shotsTotal = StrUtil.number(dataInterpreter.getTotalShots()); String firstShotNumber = StrUtil.number(dataInterpreter.getTotalPersonsVaccinatedOnce()); - String personsVaccinatedTwice = StrUtil.number(dataInterpreter.getTotalPersonsVaccintedTwice()); + String firstShotsDiff = StrUtil.difference(dataInterpreter.getLatestUpdateNewFirstShots()); + String secondShotsNumber = StrUtil.number(dataInterpreter.getTotalPersonsVaccintedTwice()); + String secondShotsDiff = StrUtil.difference(dataInterpreter.getLatestUpdateNewSecondShots()); String firstShotsPercent = StrUtil.percent(dataInterpreter.getPopulationQuotaVaccinatedOnce()); String secondShotsPercent = StrUtil.percent(dataInterpreter.getPopulationQuotaVaccinatedFull()); + - return String.format("Dosen insgesamt: *%s*\n1/2 Dosen: *%s* (*%s*)\n2/2 Dosen: *%s* (*%s*)\n\n", shotsTotal, - firstShotNumber, firstShotsPercent, personsVaccinatedTwice, secondShotsPercent); + return String.format("Dosen insgesamt: *%s*\n1/2 Dosen: *%s* (*%s*), *%s*\n2/2 Dosen: *%s* (*%s*), *%s*\n\n", + shotsTotal, + firstShotNumber, firstShotsPercent, firstShotsDiff, secondShotsNumber, secondShotsPercent, secondShotsDiff); } private String getVaccinesUpdate() { diff --git a/src/test/java/de/philliphow/de/philliphow/covidimpfde/VaccinationDataInterpretationTest.java b/src/test/java/de/philliphow/de/philliphow/covidimpfde/VaccinationDataInterpretationTest.java index b0c550d..58beacc 100644 --- a/src/test/java/de/philliphow/de/philliphow/covidimpfde/VaccinationDataInterpretationTest.java +++ b/src/test/java/de/philliphow/de/philliphow/covidimpfde/VaccinationDataInterpretationTest.java @@ -7,6 +7,7 @@ import static de.philliphow.covidimpfde.api.models.VaccinationDataRow.VaccinationsDataField.POPULATION_QUOTA_SECOND_SHOT; import static de.philliphow.covidimpfde.api.models.VaccinationDataRow.VaccinationsDataField.SHOTS_TODAY; import static de.philliphow.covidimpfde.api.models.VaccinationDataRow.VaccinationsDataField.SHOTS_TODAY_FIRST; +import static de.philliphow.covidimpfde.api.models.VaccinationDataRow.VaccinationsDataField.SHOTS_TODAY_SECOND; import static de.philliphow.covidimpfde.api.models.VaccinationDataRow.VaccinationsDataField.SHOTS_TOTAL; import static de.philliphow.covidimpfde.api.models.VaccinationDataRow.VaccinationsDataField.SHOTS_TOTAL_ASTRA; import static de.philliphow.covidimpfde.api.models.VaccinationDataRow.VaccinationsDataField.SHOTS_TOTAL_BIONTECH; @@ -110,6 +111,24 @@ public void getTotalShotsIsCorrect() { assertEquals(200, interpretation.getTotalShots()); } + + @Test + public void getNewFirstDosesIsCorrect() { + interpretation = getInterpretationFor( + new VaccinationDataRowMockBuilder().with(DATE, daysAgo(2)).with(SHOTS_TODAY_FIRST, 100).get(), + new VaccinationDataRowMockBuilder().with(DATE, daysAgo(1)).with(SHOTS_TODAY_FIRST, 200).get()); + + assertEquals(200, interpretation.getLatestUpdateNewFirstShots()); + } + + @Test + public void getNewSecondDoesesIsCorrect() { + interpretation = getInterpretationFor( + new VaccinationDataRowMockBuilder().with(DATE, daysAgo(2)).with(SHOTS_TODAY_SECOND, 100).get(), + new VaccinationDataRowMockBuilder().with(DATE, daysAgo(1)).with(SHOTS_TODAY_SECOND, 200).get()); + + assertEquals(200, interpretation.getLatestUpdateNewSecondShots()); + } @Test public void getTotalPersonsVaccinatedOnceIsCorrect() {