fix ProfileSwitch loading
This commit is contained in:
parent
8ae817cdda
commit
3d1b500395
1 changed files with 8 additions and 1 deletions
|
@ -1531,7 +1531,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||||
//add last one without duration
|
//add last one without duration
|
||||||
ProfileSwitch last = getLastProfileSwitchWithoutDuration();
|
ProfileSwitch last = getLastProfileSwitchWithoutDuration();
|
||||||
if (last != null) {
|
if (last != null) {
|
||||||
if (!profileSwitches.contains(last))
|
if (!isInList(profileSwitches, last))
|
||||||
profileSwitches.add(last);
|
profileSwitches.add(last);
|
||||||
}
|
}
|
||||||
return profileSwitches;
|
return profileSwitches;
|
||||||
|
@ -1541,6 +1541,13 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean isInList(List<ProfileSwitch> profileSwitches, ProfileSwitch last) {
|
||||||
|
for (ProfileSwitch ps : profileSwitches) {
|
||||||
|
if (ps.isEqual(last)) return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
private ProfileSwitch getLastProfileSwitchWithoutDuration() {
|
private ProfileSwitch getLastProfileSwitchWithoutDuration() {
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in a new issue