Skip to content

Commit a96519c

Browse files
Merge pull request #13749 from SORMAS-Foundation/13730-inconsistent-behaviour-of-sormas-mobile-application
13730 inconsistent behaviour of sormas mobile application
2 parents bffe42f + deba3ce commit a96519c

File tree

4 files changed

+242
-7
lines changed

4 files changed

+242
-7
lines changed

sormas-app/app/src/main/java/de/symeda/sormas/app/backend/common/DatabaseHelper.java

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
190190
public static final String DATABASE_NAME = "sormas.db";
191191
// any time you make changes to your database objects, you may have to increase the database version
192192

193-
public static final int DATABASE_VERSION = 359;
193+
public static final int DATABASE_VERSION = 360;
194194

195195
private static DatabaseHelper instance = null;
196196

@@ -398,7 +398,7 @@ public void onUpgrade(SQLiteDatabase db, ConnectionSource connectionSource, int
398398
// IMPORTANT: table and column names are CASE SENSITIVE!
399399
int currentVersion = oldVersion;
400400
try {
401-
switch (oldVersion) {
401+
switch (newVersion) {
402402
case 91:
403403
currentVersion = 91;
404404
getDao(District.class).executeRaw("ALTER TABLE district ADD COLUMN epidCode varchar(255);");
@@ -3201,8 +3201,28 @@ public void onUpgrade(SQLiteDatabase db, ConnectionSource connectionSource, int
32013201
getDao(Symptoms.class).executeRaw("ALTER TABLE symptoms ADD COLUMN septicaemia varchar(255);");
32023202
getDao(Symptoms.class).executeRaw("ALTER TABLE symptoms ADD COLUMN whoopsound varchar(255);");
32033203

3204-
// ATTENTION: break should only be done after last version
3205-
break;
3204+
case 360:
3205+
currentVersion = 360;
3206+
getDao(Symptoms.class).executeRaw("ALTER TABLE symptoms ADD COLUMN acuteEncephalitis varchar(255);");
3207+
getDao(Symptoms.class).executeRaw("ALTER TABLE symptoms ADD COLUMN eggyBurps varchar(255);");
3208+
getDao(Symptoms.class).executeRaw("ALTER TABLE symptoms ADD COLUMN weightLoss varchar(255);");
3209+
getDao(Symptoms.class).executeRaw("ALTER TABLE symptoms ADD COLUMN weightLossAmount float8;");
3210+
getDao(Symptoms.class).executeRaw("ALTER TABLE symptoms ADD COLUMN reoccurrence varchar(255);");
3211+
getDao(Symptoms.class).executeRaw("ALTER TABLE symptoms ADD COLUMN symptomCurrentStatus varchar(255);");
3212+
getDao(Symptoms.class).executeRaw("ALTER TABLE symptoms ADD COLUMN durationOfSymptoms int;");
3213+
getDao(Symptoms.class).executeRaw("ALTER TABLE symptoms ADD COLUMN overnightStayRequired varchar(255);");
3214+
getDao(Symptoms.class).executeRaw("ALTER TABLE symptoms ADD COLUMN bloating varchar(255);");
3215+
getDao(Symptoms.class).executeRaw("ALTER TABLE symptoms ADD COLUMN difficultyBreathingDuringMeals varchar(255);");
3216+
getDao(Symptoms.class).executeRaw("ALTER TABLE symptoms ADD COLUMN paradoxicalBreathing varchar(255);");
3217+
getDao(Symptoms.class).executeRaw("ALTER TABLE symptoms ADD COLUMN respiratoryFatigue varchar(255);");
3218+
getDao(Symptoms.class).executeRaw("ALTER TABLE symptoms ADD COLUMN parentTimeOffWork varchar(255);");
3219+
getDao(Symptoms.class).executeRaw("ALTER TABLE symptoms ADD COLUMN timeOffWorkDays float8;");
3220+
getDao(Symptoms.class).executeRaw("ALTER TABLE symptoms ADD COLUMN unknownSymptom varchar(255);");
3221+
getDao(Symptoms.class).executeRaw("ALTER TABLE symptoms ADD COLUMN skinRashOnsetDate timestamp;");
3222+
3223+
3224+
// ATTENTION: break should only be done after last version
3225+
break;
32063226

32073227

32083228

sormas-app/app/src/main/java/de/symeda/sormas/app/backend/contact/ContactDao.java

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,19 @@ private QueryBuilder<Contact, Long> buildQueryBuilder(ContactCriteria contactCri
219219

220220
// Only use user filter if no restricting case is specified
221221
if (contactCriteria.getIncludeContactsFromOtherJurisdictions().equals(false)) {
222-
whereStatements.add(where.or(createJurisdictionFilterForCase(where), createJurisdictionFilter(where)));
222+
// whereStatements.add(where.or(createJurisdictionFilterForCase(where), createJurisdictionFilter(where)));
223+
Where<Contact, Long> caseJurisdictionWhere = createJurisdictionFilterForCase(where);
224+
Where<Contact, Long> jurisdictionWhere = createJurisdictionFilter(where);
225+
if (caseJurisdictionWhere != null && jurisdictionWhere != null) {
226+
whereStatements.add(where.or(caseJurisdictionWhere, jurisdictionWhere));
227+
} else {
228+
if (caseJurisdictionWhere != null) {
229+
whereStatements.add(caseJurisdictionWhere);
230+
}
231+
if (jurisdictionWhere != null) {
232+
whereStatements.add(jurisdictionWhere);
233+
}
234+
}
223235
}
224236

225237
if (contactCriteria != null) {
@@ -283,8 +295,9 @@ public Where<Contact, Long> createJurisdictionFilterForCase(Where<Contact, Long>
283295

284296
if (!whereJurisdictionFilterStatements.isEmpty()) {
285297
where.or(whereJurisdictionFilterStatements.size());
298+
return where;
286299
}
287-
return where;
300+
return null;
288301
}
289302

290303
public Where<Contact, Long> createJurisdictionFilter(Where<Contact, Long> where) throws SQLException {
@@ -316,9 +329,10 @@ public Where<Contact, Long> createJurisdictionFilter(Where<Contact, Long> where)
316329

317330
if (!whereUserFilterStatements.isEmpty()) {
318331
where.or(whereUserFilterStatements.size());
332+
return where;
319333
}
320334

321-
return where;
335+
return null;
322336
}
323337

324338
public Where<Contact, Long> createCriteriaFilter(List<Where<Contact, Long>> whereStatements, Where<Contact, Long> where, ContactCriteria criteria)

sormas-app/app/src/main/java/de/symeda/sormas/app/backend/symptoms/Symptoms.java

Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,41 @@ public class Symptoms extends PseudonymizableAdo {
473473
private SymptomState shivering;
474474
@Enumerated(EnumType.STRING)
475475
private ClinicalPresentationStatus clinicalPresentationStatus;
476+
@Enumerated(EnumType.STRING)
477+
private SymptomState acuteEncephalitis;
478+
@Enumerated(EnumType.STRING)
479+
private SymptomState eggyBurps;
480+
@Enumerated(EnumType.STRING)
481+
private SymptomState weightLoss;
482+
@Column
483+
private Float weightLossAmount;
484+
@Enumerated(EnumType.STRING)
485+
private SymptomState reoccurrence;
486+
@Enumerated(EnumType.STRING)
487+
private SymptomState symptomCurrentStatus;
488+
@Column
489+
private Integer durationOfSymptoms;
490+
@Enumerated(EnumType.STRING)
491+
private SymptomState overnightStayRequired;
492+
@Enumerated(EnumType.STRING)
493+
private SymptomState bloating;
494+
495+
@Enumerated(EnumType.STRING)
496+
private SymptomState difficultyBreathingDuringMeals;
497+
@Enumerated(EnumType.STRING)
498+
private SymptomState paradoxicalBreathing;
499+
@Enumerated(EnumType.STRING)
500+
private SymptomState respiratoryFatigue;
501+
@Enumerated(EnumType.STRING)
502+
private YesNoUnknown parentTimeOffWork;
503+
@Column
504+
private Float timeOffWorkDays;
505+
@Enumerated(EnumType.STRING)
506+
private SymptomState unknownSymptom;
507+
@DatabaseField(dataType = DataType.DATE_LONG)
508+
private Date skinRashOnsetDate;
509+
510+
476511

477512
@Override
478513
public String getI18nPrefix() {
@@ -2045,4 +2080,136 @@ public ClinicalPresentationStatus getClinicalPresentationStatus() {
20452080
public void setClinicalPresentationStatus(ClinicalPresentationStatus clinicalPresentationStatus) {
20462081
this.clinicalPresentationStatus = clinicalPresentationStatus;
20472082
}
2083+
2084+
public SymptomState getBloating() {
2085+
return bloating;
2086+
}
2087+
2088+
public void setBloating(SymptomState bloating) {
2089+
this.bloating = bloating;
2090+
}
2091+
2092+
public SymptomState getOvernightStayRequired() {
2093+
return overnightStayRequired;
2094+
}
2095+
2096+
public void setOvernightStayRequired(SymptomState overnightStayRequired) {
2097+
this.overnightStayRequired = overnightStayRequired;
2098+
}
2099+
2100+
public Integer getDurationOfSymptoms() {
2101+
return durationOfSymptoms;
2102+
}
2103+
2104+
public void setDurationOfSymptoms(Integer durationOfSymptoms) {
2105+
this.durationOfSymptoms = durationOfSymptoms;
2106+
}
2107+
2108+
public SymptomState getSymptomCurrentStatus() {
2109+
return symptomCurrentStatus;
2110+
}
2111+
2112+
public void setSymptomCurrentStatus(SymptomState symptomCurrentStatus) {
2113+
this.symptomCurrentStatus = symptomCurrentStatus;
2114+
}
2115+
2116+
public SymptomState getReoccurrence() {
2117+
return reoccurrence;
2118+
}
2119+
2120+
public void setReoccurrence(SymptomState reoccurrence) {
2121+
this.reoccurrence = reoccurrence;
2122+
}
2123+
2124+
public Float getWeightLossAmount() {
2125+
return weightLossAmount;
2126+
}
2127+
2128+
public void setWeightLossAmount(Float weightLossAmount) {
2129+
this.weightLossAmount = weightLossAmount;
2130+
}
2131+
2132+
public SymptomState getWeightLoss() {
2133+
return weightLoss;
2134+
}
2135+
2136+
public void setWeightLoss(SymptomState weightLoss) {
2137+
this.weightLoss = weightLoss;
2138+
}
2139+
2140+
public SymptomState getEggyBurps() {
2141+
return eggyBurps;
2142+
}
2143+
2144+
public void setEggyBurps(SymptomState eggyBurps) {
2145+
this.eggyBurps = eggyBurps;
2146+
}
2147+
2148+
public SymptomState getAcuteEncephalitis() {
2149+
return acuteEncephalitis;
2150+
}
2151+
2152+
public void setAcuteEncephalitis(SymptomState acuteEncephalitis) {
2153+
this.acuteEncephalitis = acuteEncephalitis;
2154+
}
2155+
2156+
public Float getTimeOffWorkDays() {
2157+
return timeOffWorkDays;
2158+
}
2159+
2160+
public void setTimeOffWorkDays(Float timeOffWorkDays) {
2161+
this.timeOffWorkDays = timeOffWorkDays;
2162+
}
2163+
2164+
public YesNoUnknown getParentTimeOffWork() {
2165+
return parentTimeOffWork;
2166+
}
2167+
2168+
public void setParentTimeOffWork(YesNoUnknown parentTimeOffWork) {
2169+
this.parentTimeOffWork = parentTimeOffWork;
2170+
}
2171+
2172+
public SymptomState getRespiratoryFatigue() {
2173+
return respiratoryFatigue;
2174+
}
2175+
2176+
public void setRespiratoryFatigue(SymptomState respiratoryFatigue) {
2177+
this.respiratoryFatigue = respiratoryFatigue;
2178+
}
2179+
2180+
public SymptomState getParadoxicalBreathing() {
2181+
return paradoxicalBreathing;
2182+
}
2183+
2184+
public void setParadoxicalBreathing(SymptomState paradoxicalBreathing) {
2185+
this.paradoxicalBreathing = paradoxicalBreathing;
2186+
}
2187+
2188+
public SymptomState getDifficultyBreathingDuringMeals() {
2189+
return difficultyBreathingDuringMeals;
2190+
}
2191+
2192+
public void setDifficultyBreathingDuringMeals(SymptomState difficultyBreathingDuringMeals) {
2193+
this.difficultyBreathingDuringMeals = difficultyBreathingDuringMeals;
2194+
}
2195+
2196+
public void setNocturnalCough(SymptomState nocturnalCough) {
2197+
this.nocturnalCough = nocturnalCough;
2198+
}
2199+
2200+
public Date getSkinRashOnsetDate() {
2201+
return skinRashOnsetDate;
2202+
}
2203+
2204+
public void setSkinRashOnsetDate(Date skinRashOnsetDate) {
2205+
this.skinRashOnsetDate = skinRashOnsetDate;
2206+
}
2207+
2208+
public SymptomState getUnknownSymptom() {
2209+
return unknownSymptom;
2210+
}
2211+
2212+
public void setUnknownSymptom(SymptomState unknownSymptom) {
2213+
this.unknownSymptom = unknownSymptom;
2214+
}
20482215
}

sormas-app/app/src/main/java/de/symeda/sormas/app/backend/symptoms/SymptomsDtoHelper.java

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,23 @@ public void fillInnerFromDto(Symptoms target, SymptomsDto source) {
235235
target.setHighOrLowBloodPressure(source.getHighOrLowBloodPressure());
236236
target.setUrinaryRetention(source.getUrinaryRetention());
237237
target.setShivering(source.getShivering());
238+
target.setAcuteEncephalitis(source.getAcuteEncephalitis());
239+
target.setEggyBurps(source.getEggyBurps());
240+
target.setWeightLoss(source.getWeightLoss());
241+
target.setWeightLossAmount(source.getWeightLossAmount());
242+
target.setReoccurrence(source.getReoccurrence());
243+
target.setSymptomCurrentStatus(source.getSymptomCurrentStatus());
244+
target.setDurationOfSymptoms(source.getDurationOfSymptoms());
245+
target.setOvernightStayRequired(source.getOvernightStayRequired());
246+
target.setBloating(source.getBloating());
247+
target.setDifficultyBreathing(source.getDifficultyBreathing());
248+
target.setParadoxicalBreathing(source.getParadoxicalBreathing());
249+
target.setRespiratoryFatigue(source.getRespiratoryFatigue());
250+
target.setParentTimeOffWork(source.getParentTimeOffWork());
251+
target.setTimeOffWorkDays(source.getTimeOffWorkDays());
252+
target.setUnknownSymptom(source.getUnknownSymptom());
253+
target.setSkinRashOnsetDate(source.getSkinRashOnsetDate());
254+
target.setAsymptomatic(source.getAsymptomatic());
238255

239256
target.setPseudonymized(source.isPseudonymized());
240257
}
@@ -421,6 +438,23 @@ public void fillInnerFromAdo(SymptomsDto target, Symptoms source) {
421438
target.setHighOrLowBloodPressure(source.getHighOrLowBloodPressure());
422439
target.setUrinaryRetention(source.getUrinaryRetention());
423440
target.setShivering(source.getShivering());
441+
target.setAcuteEncephalitis(source.getAcuteEncephalitis());
442+
target.setEggyBurps(source.getEggyBurps());
443+
target.setWeightLoss(source.getWeightLoss());
444+
target.setWeightLossAmount(source.getWeightLossAmount());
445+
target.setReoccurrence(source.getReoccurrence());
446+
target.setSymptomCurrentStatus(source.getSymptomCurrentStatus());
447+
target.setDurationOfSymptoms(source.getDurationOfSymptoms());
448+
target.setOvernightStayRequired(source.getOvernightStayRequired());
449+
target.setBloating(source.getBloating());
450+
target.setDifficultyBreathing(source.getDifficultyBreathing());
451+
target.setParadoxicalBreathing(source.getParadoxicalBreathing());
452+
target.setRespiratoryFatigue(source.getRespiratoryFatigue());
453+
target.setParentTimeOffWork(source.getParentTimeOffWork());
454+
target.setTimeOffWorkDays(source.getTimeOffWorkDays());
455+
target.setUnknownSymptom(source.getUnknownSymptom());
456+
target.setSkinRashOnsetDate(source.getSkinRashOnsetDate());
457+
target.setAsymptomatic(source.getAsymptomatic());
424458

425459
target.setPseudonymized(source.isPseudonymized());
426460
}

0 commit comments

Comments
 (0)