Fixes wrong algo
This commit is contained in:
parent
6755df4482
commit
de92125967
|
@ -204,7 +204,7 @@ public class ObjectivesFragment extends SubscriberFragment {
|
|||
return 1;
|
||||
} else if (objectiveStartedTime > 0 && !enableFakeValue
|
||||
&& objectiveAccomplishedTime == 0
|
||||
&& !(objectiveStartedTime + durationInDays * 24 * 60 * 60 * 1000 >= now && requirementsMet)) {
|
||||
&& !(objectiveStartedTime + durationInDays * 24 * 60 * 60 * 1000 < now && requirementsMet)) {
|
||||
return 2;
|
||||
} else if (objectiveAccomplishedTime == 0) {
|
||||
return 3;
|
||||
|
|
|
@ -35,25 +35,10 @@ public class ObjectivesFragmentTest {
|
|||
objectiveStartedTime, durationInDays, objectiveAccomplishedTime, requirementsMet, enableFakeValue));
|
||||
|
||||
// started
|
||||
// time calculation is false, requirements met is false
|
||||
// time calculation is true, requirements met is true
|
||||
objectiveStartedTime = 10;
|
||||
durationInDays = 0;
|
||||
requirementsMet = true;
|
||||
assertEquals(2, fragment.modifyVisibility(currentPosition, prevObjectiveAccomplishedTime,
|
||||
objectiveStartedTime, durationInDays, objectiveAccomplishedTime, requirementsMet, enableFakeValue));
|
||||
|
||||
// started
|
||||
// time calculation is false, requirements met is true
|
||||
objectiveStartedTime = 10;
|
||||
durationInDays = 999999;
|
||||
requirementsMet = true;
|
||||
assertEquals(2, fragment.modifyVisibility(currentPosition, prevObjectiveAccomplishedTime,
|
||||
objectiveStartedTime, durationInDays, objectiveAccomplishedTime, requirementsMet, enableFakeValue));
|
||||
|
||||
// started, after duration, requirements met --> show verify
|
||||
objectiveStartedTime = Long.MAX_VALUE;
|
||||
durationInDays = 0;
|
||||
requirementsMet = true;
|
||||
assertEquals(3, fragment.modifyVisibility(currentPosition, prevObjectiveAccomplishedTime,
|
||||
objectiveStartedTime, durationInDays, objectiveAccomplishedTime, requirementsMet, enableFakeValue));
|
||||
|
||||
|
|
Loading…
Reference in a new issue