Skip to content

Commit

Permalink
clean up after review
Browse files Browse the repository at this point in the history
  • Loading branch information
daveotengo committed Sep 17, 2024
1 parent 1d09aa6 commit 394a5e2
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 79 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ public DateFilterOption getActionDateFilterOption() {
return actionDateFilterOption;
}

public enum DateType {
public enum DateType {
EVENT,
EVENT_SIGNAL_EVOLUTION,
ACTION_CHANGE,
Expand Down
11 changes: 0 additions & 11 deletions sormas-api/src/main/java/de/symeda/sormas/api/i18n/Strings.java
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,6 @@ public interface Strings {
String confirmationVaccinationStatusUpdate = "confirmationVaccinationStatusUpdate";
String confirmExternalMessageCorrectionThrough = "confirmExternalMessageCorrectionThrough";
String confirmNetworkDiagramTooManyContacts = "confirmNetworkDiagramTooManyContacts";
String confirmPassword = "confirmPassword";
String currentPassword = "currentPassword";
String date = "date";
String day = "day";
String DefaultPassword_newPassword = "DefaultPassword.newPassword";
Expand Down Expand Up @@ -462,7 +460,6 @@ public interface Strings {
String headingcasesWithReferenceDefinitionFulfilled = "headingcasesWithReferenceDefinitionFulfilled";
String headingCaution = "headingCaution";
String headingChangeCaseDisease = "headingChangeCaseDisease";
String headingChangePassword = "headingChangePassword";
String headingChangePathogenTestResult = "headingChangePathogenTestResult";
String headingClinicalMeasurements = "headingClinicalMeasurements";
String headingClinicalVisitsDeleted = "headingClinicalVisitsDeleted";
Expand Down Expand Up @@ -846,7 +843,6 @@ public interface Strings {
String headingUpdatedPersonInformation = "headingUpdatedPersonInformation";
String headingUpdatedSampleInformation = "headingUpdatedSampleInformation";
String headingUpdatePassword = "headingUpdatePassword";
String headingUpdatePasswordFailed = "headingUpdatePasswordFailed";
String headingUpdatePersonContactDetails = "headingUpdatePersonContactDetails";
String headingUploadSuccess = "headingUploadSuccess";
String headingUserData = "headingUserData";
Expand Down Expand Up @@ -1394,8 +1390,6 @@ public interface Strings {
String messageMissingDateFilter = "messageMissingDateFilter";
String messageMissingEpiWeekFilter = "messageMissingEpiWeekFilter";
String messageMultipleSampleReports = "messageMultipleSampleReports";
String messageNewPasswordDoesNotMatchFailed = "messageNewPasswordDoesNotMatchFailed";
String messageNewPasswordFailed = "messageNewPasswordFailed";
String messageNoCaseFound = "messageNoCaseFound";
String messageNoCaseFoundToLinkImmunization = "messageNoCaseFoundToLinkImmunization";
String messageNoCasesSelected = "messageNoCasesSelected";
Expand Down Expand Up @@ -1433,8 +1427,6 @@ public interface Strings {
String messageNoVisitsSelected = "messageNoVisitsSelected";
String messageOtherDeleteReasonNotFilled = "messageOtherDeleteReasonNotFilled";
String messageOutbreakSaved = "messageOutbreakSaved";
String messagePasswordChange = "messagePasswordChange";
String messagePasswordFailed = "messagePasswordFailed";
String messagePasswordReset = "messagePasswordReset";
String messagePasswordResetEmailLink = "messagePasswordResetEmailLink";
String messagePathogenTestSaved = "messagePathogenTestSaved";
Expand Down Expand Up @@ -1546,7 +1538,6 @@ public interface Strings {
String messageVisitsDeleted = "messageVisitsDeleted";
String messageVisitsWithWrongStatusNotCancelled = "messageVisitsWithWrongStatusNotCancelled";
String messageVisitsWithWrongStatusNotSetToLost = "messageVisitsWithWrongStatusNotSetToLost";
String messageWrongCurrentPassword = "messageWrongCurrentPassword";
String messageWrongFileType = "messageWrongFileType";
String messageWrongTemplateFileType = "messageWrongTemplateFileType";
String min = "min";
Expand Down Expand Up @@ -1612,7 +1603,6 @@ public interface Strings {
String of = "of";
String on = "on";
String or = "or";
String passwordStrength = "passwordStrength";
String pathogenTestDeletedDuringLabMessageConversion = "pathogenTestDeletedDuringLabMessageConversion";
String pleaseSpecify = "pleaseSpecify";
String populationDataByArea = "populationDataByArea";
Expand Down Expand Up @@ -1764,7 +1754,6 @@ public interface Strings {
String unsavedChanges_warningMessage = "unsavedChanges.warningMessage";
String unsavedChanges_warningTitle = "unsavedChanges.warningTitle";
String until = "until";
String updatePassword = "updatePassword";
String uuidOf = "uuidOf";
String warningDashboardMapTooManyMarkers = "warningDashboardMapTooManyMarkers";
String warningNetworkDiagramTooManyContacts = "warningNetworkDiagramTooManyContacts";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1072,7 +1072,8 @@ public boolean exists(String uuid) {
@Override
public boolean doesExternalTokenExist(String externalToken, String personUuid) {
return service.exists(
(cb, personRoot, cq) -> and(cb, cb.equal(personRoot.get(Person.EXTERNAL_TOKEN), externalToken), cb.notEqual(personRoot.get(Person.UUID), personUuid)));
(cb, personRoot, cq) -> CriteriaBuilderHelper
.and(cb, cb.equal(personRoot.get(Person.EXTERNAL_TOKEN), externalToken), cb.notEqual(personRoot.get(Person.UUID), personUuid)));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@
import de.symeda.sormas.backend.util.ModelConstants;
import de.symeda.sormas.backend.util.Pseudonymizer;
import de.symeda.sormas.backend.util.QueryHelper;
import static de.symeda.sormas.backend.common.CriteriaBuilderHelper.and;
import static de.symeda.sormas.backend.common.CriteriaBuilderHelper.or;
import java.math.BigInteger;
import javax.persistence.Query;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ public static String buildCaptionForNotification(User user) {
return caption;
}

static class UserListener {
static class UserListener {

@PostPersist
@PostUpdate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ else if (DashboardType.CONTACTS.equals(e.getProperty().getValue())) {
}
else if (DashboardType.DISEASE.equals(e.getProperty().getValue())) {
SormasUI.get().getNavigator().navigateTo(DiseaseDetailsView.VIEW_NAME);
}
}
else {
SormasUI.get().getNavigator().navigateTo(CampaignDashboardView.VIEW_NAME);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,12 @@ private void addTopLayout(Disease disease, Long casesCount, Long previousCasesCo
nameLayout.setWidth(100, Unit.PERCENTAGE);
nameLayout.setHeight(100, Unit.PERCENTAGE);
Label nameLabel = new Label(disease.toShortString());
nameLabel.addStyleNames(CssStyles.LABEL_WHITE,
nameLabel.getValue().length() > 12 ? CssStyles.LABEL_LARGE : CssStyles.LABEL_XLARGE,
CssStyles.LABEL_BOLD, CssStyles.ALIGN_CENTER, CssStyles.LABEL_UPPERCASE);
nameLabel.addStyleNames(
CssStyles.LABEL_WHITE,
nameLabel.getValue().length() > 12 ? CssStyles.LABEL_LARGE : CssStyles.LABEL_XLARGE,
CssStyles.LABEL_BOLD,
CssStyles.ALIGN_CENTER,
CssStyles.LABEL_UPPERCASE);
nameLayout.addComponent(nameLabel);
nameLayout.setComponentAlignment(nameLabel, Alignment.MIDDLE_CENTER);
nameAndOutbreakLayout.addComponent(nameLayout);
Expand Down Expand Up @@ -104,8 +107,8 @@ private void addTopLayout(Disease disease, Long casesCount, Long previousCasesCo
countLayout.setWidth(100, Unit.PERCENTAGE);

Label countLabel = new Label(casesCount.toString());
countLabel.addStyleNames(CssStyles.LABEL_WHITE, CssStyles.LABEL_BOLD, CssStyles.LABEL_XXXLARGE,
CssStyles.ALIGN_CENTER, CssStyles.VSPACE_TOP_4);
countLabel
.addStyleNames(CssStyles.LABEL_WHITE, CssStyles.LABEL_BOLD, CssStyles.LABEL_XXXLARGE, CssStyles.ALIGN_CENTER, CssStyles.VSPACE_TOP_4);
countLayout.addComponent(countLabel);
countLayout.setComponentAlignment(countLabel, Alignment.BOTTOM_CENTER);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,13 @@ public class RegionalDiseaseBurdenGrid extends Grid {

Grid.Column regionDistrictColumn;
Grid.Column totalColumn;

Grid.Column totalCountColumn;

Grid.Column activeCaseColumn;

Grid.Column activeCaseCountColumn;

Grid.Column recoveredCasesColumn;
Grid.Column recoveredCasesCountColumn;

Grid.Column deathColumn;
Grid.Column deathCountColumn;

Grid.Column otherColumn;
Grid.Column otherCountColumn;

Expand Down Expand Up @@ -72,23 +66,18 @@ public RegionalDiseaseBurdenGrid(DashboardDataProvider dashboardDataProvider) {
regionDistrictColumn = getColumn(DiseaseBurdenDto.CASES_REGION);

totalCountColumn = getColumn(DiseaseBurdenDto.CASES_COUNT_TOTAL);

totalColumn = getColumn(DiseaseBurdenDto.CASES_TOTAL);

activeCaseCountColumn = getColumn(DiseaseBurdenDto.ACTIVE_COUNT_CASE);

activeCaseColumn = getColumn(DiseaseBurdenDto.ACTIVE_CASE);

recoveredCasesCountColumn = getColumn(DiseaseBurdenDto.RECOVERED_COUNT_CASES);

recoveredCasesColumn = getColumn(DiseaseBurdenDto.RECOVERED_CASES);

deathCountColumn = getColumn(DiseaseBurdenDto.DEATH_COUNT);

deathColumn = getColumn(DiseaseBurdenDto.DEATH);

otherCountColumn = getColumn(DiseaseBurdenDto.OTHER_COUNT);

otherColumn = getColumn(DiseaseBurdenDto.OTHER);

}
Expand All @@ -110,41 +99,29 @@ public void reload() {
regionDistrictColumn.setHeaderCaption("REGION NAME");

totalCountColumn.setRenderer(new HtmlRenderer()).setWidth(100);

totalColumn.setRenderer(new HtmlRenderer()).setWidth(100);

totalColumn.setHeaderCaption("TOTAL %");

activeCaseCountColumn.setRenderer(new HtmlRenderer()).setWidth(100);

activeCaseColumn.setRenderer(new HtmlRenderer()).setWidth(100);

activeCaseColumn.setHeaderCaption("ACTIVE CASES %");

recoveredCasesCountColumn.setRenderer(new HtmlRenderer()).setWidth(100);

recoveredCasesCountColumn.setHeaderCaption("RECOVER COUNT");
recoveredCasesColumn.setRenderer(new HtmlRenderer()).setWidth(100);

recoveredCasesColumn.setHeaderCaption("RECOVER CASES %");


deathCountColumn.setRenderer(new HtmlRenderer()).setWidth(100);

deathColumn.setRenderer(new HtmlRenderer()).setWidth(100);

deathColumn.setHeaderCaption("DEATH CASES %");

otherCountColumn.setRenderer(new HtmlRenderer()).setWidth(100);

otherColumn.setRenderer(new HtmlRenderer()).setWidth(100);

otherColumn.setHeaderCaption("OTHER CASES %");

if(dashboardDataProvider.getRegion()!=null) {

regionDistrictColumn.setHeaderCaption("DISTRICT NAME");

setCaption(I18nProperties.getCaption(Captions.dashboardDistrictDiseaseBurden));

String regionUuid=dashboardDataProvider.getRegion().getUuid();
Expand All @@ -167,41 +144,24 @@ public void reload() {


String total = diseaseBurdenDto.getTotal();

String activeCases = diseaseBurdenDto.getActiveCases();

String recovered = diseaseBurdenDto.getRecovered();

String deaths = diseaseBurdenDto.getDeaths();

String other = diseaseBurdenDto.getOther();

RegionDto regionDto = new RegionDto();

regionDto.setName(districtDto.getCaption());

diseaseBurdenDto.setRegion(regionDto);

diseaseBurdenDto.setTotal(makeDIvs(Long.parseLong(total), casePercental, "#5a95f4bf","#2f7df9"));

diseaseBurdenDto.setTotalCount(makeDIvsCount(total));

diseaseBurdenDto.setActiveCases(makeDIvs(Long.parseLong(activeCases), casePercental, "#feba0199", "#dfa507"));

diseaseBurdenDto.setActiveCount(makeDIvsCount(activeCases));

diseaseBurdenDto.setRecovered(makeDIvs(Long.parseLong(recovered), casePercental, "#00e0a19c", "#038d66"));

diseaseBurdenDto.setRecoveredCount(makeDIvsCount(recovered));

diseaseBurdenDto.setDeaths(makeDIvs(Long.parseLong(deaths), casePercental,"#FFAEAE", "#FF4040"));

diseaseBurdenDto.setDeathsCount(makeDIvsCount(deaths));

diseaseBurdenDto.setOther(makeDIvs(Long.parseLong(other), casePercental,"#bf8678ba", "#91675d"));

diseaseBurdenDto.setOtherCount(makeDIvsCount(other));

diseaseBurdenDtoList.add(diseaseBurdenDto);
}
}else {
Expand All @@ -220,35 +180,21 @@ public void reload() {
);

String total = diseaseBurdenDto.getTotal();

String activeCases = diseaseBurdenDto.getActiveCases();

String recovered = diseaseBurdenDto.getRecovered();

String deaths = diseaseBurdenDto.getDeaths();

String other = diseaseBurdenDto.getOther();

diseaseBurdenDto.setTotal(makeDIvs(Long.parseLong(total), casePercental, "#5a95f4bf","#2f7df9"));

diseaseBurdenDto.setTotalCount(makeDIvsCount(total));

diseaseBurdenDto.setActiveCases(makeDIvs(Long.parseLong(activeCases), casePercental, "#feba0199", "#dfa507"));

diseaseBurdenDto.setActiveCount(makeDIvsCount(activeCases));

diseaseBurdenDto.setRecovered(makeDIvs(Long.parseLong(recovered), casePercental, "#00e0a19c", "#038d66"));

diseaseBurdenDto.setRecoveredCount(makeDIvsCount(recovered));

diseaseBurdenDto.setDeaths(makeDIvs(Long.parseLong(deaths), casePercental,"#FFAEAE", "#FF4040"));

diseaseBurdenDto.setDeathsCount(makeDIvsCount(deaths));

diseaseBurdenDto.setOther(makeDIvs(Long.parseLong(other), casePercental,"#bf8678ba", "#91675d"));

diseaseBurdenDto.setOtherCount(makeDIvsCount(other));

diseaseBurdenDtoList.add(diseaseBurdenDto);
}
}
Expand Down Expand Up @@ -307,8 +253,7 @@ public String element(String type, String style, String content) {
sb.append(content);

sb.append("</").append(type).append(">");

return sb.toString();

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,9 @@
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.mockito.ArgumentMatchers.any;
Expand Down

0 comments on commit 394a5e2

Please sign in to comment.