Skip to content

Commit

Permalink
Merge pull request #4 from PhillipHow/show-first-second-dose-difference
Browse files Browse the repository at this point in the history
Show first/second dose difference
  • Loading branch information
PhillipHow authored May 22, 2021
2 parents 61d82e5 + 340507f commit ab1e20c
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -323,4 +337,5 @@ public List<WeeklySummary> getLastNWeeklySummarys(int n) {

}


}
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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() {
Expand Down

0 comments on commit ab1e20c

Please sign in to comment.