diff --git a/src/services/action.service.ts b/src/services/action.service.ts index 9257c982f630cb6b699c00027cab6e6ade2cfca0..1d3766a12feacb1796cd615bf016c434d642c30d 100644 --- a/src/services/action.service.ts +++ b/src/services/action.service.ts @@ -259,10 +259,9 @@ export default class ActionService { currentChallenge.action.ecogesture ) { const startDate: DateTime = currentChallenge.action.startDate - const durationInHours = - currentChallenge.action.ecogesture.actionDuration * 24 - const progressInHours = -startDate.diffNow('hours').hours - if (progressInHours > durationInHours) { + const duration = currentChallenge.action.ecogesture.actionDuration + const progress = -startDate.startOf('day').diffNow('days').days + if (progress >= duration) { const challengeService = new ChallengeService(this._client) const userChallenge: UserChallenge = await challengeService.updateUserChallenge( currentChallenge,