Fixed error in hour of challenge accomplished
This commit is contained in:
@@ -8,7 +8,6 @@
|
||||
<p class="m-0 mt-1 text-xs text-gray-500">{{ challenge.challengeDescription }}</p>
|
||||
</div>
|
||||
<div class="text-right shrink-0">
|
||||
<p class="m-0 text-xs text-gray-500">{{ converterHours(challenge.challengeDuration) }}</p>
|
||||
<p class="m-0 mt-1 text-xs text-gray-400">{{ challenge.challengeStartDate }}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -12,28 +12,4 @@ import {GetUserChallengeDto} from "../../services/api";
|
||||
})
|
||||
export class ChallengesAccomplishedComponent {
|
||||
userChallenges = input.required<GetUserChallengeDto[]>();
|
||||
|
||||
converterHours(hours: number) {
|
||||
const day = Math.floor(hours / 24);
|
||||
const week = Math.floor(day / 7);
|
||||
const month = Math.floor(week / 4);
|
||||
const year = Math.floor(month / 12);
|
||||
|
||||
switch (true) {
|
||||
case year > 0:
|
||||
return `${year} an${year > 1 ? 's' : ''}`;
|
||||
|
||||
case month > 0:
|
||||
return `${month} mois`;
|
||||
|
||||
case week > 0:
|
||||
return `${week} semaine${week > 1 ? 's' : ''}`;
|
||||
|
||||
case day > 0:
|
||||
return `${day} jour${day > 1 ? 's' : ''}`;
|
||||
|
||||
default:
|
||||
return `${hours} heure${hours > 1 ? 's' : ''}`;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user