Skip to content

Commit

Permalink
wip little changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexandre-Monney authored and VincentHardouin committed Dec 10, 2024
1 parent e5e4dde commit 09115c0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
4 changes: 3 additions & 1 deletion orga/app/components/statistics/cover-rate-gauge.gjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { guidFor } from '@ember/object/internals';
import Component from '@glimmer/component';
import { t } from 'ember-intl';

const MAX_REACHABLE_LEVEL = 8;

export default class CoverRateGauge extends Component {
get id() {
return guidFor(this);
Expand All @@ -24,7 +26,7 @@ export default class CoverRateGauge extends Component {
};

gaugeSize = (level) => {
return (level / 8) * 100;
return (level / MAX_REACHABLE_LEVEL) * 100;
};

<template>
Expand Down
15 changes: 11 additions & 4 deletions orga/app/components/statistics/tag-level.gjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,20 @@ import PixTag from '@1024pix/pix-ui/components/pix-tag';
import Component from '@glimmer/component';
import { t } from 'ember-intl';

const MAX_LEVEL = {
novice: 3,
independent: 4,
advanced: 6,
expert: 8,
};

export default class TagLevel extends Component {
get category() {
const parsedLevel = Math.ceil(parseFloat(this.args.level));
if (parsedLevel < 3) return 'pages.statistics.level.novice';
if (parsedLevel < 4) return 'pages.statistics.level.independent';
if (parsedLevel < 6) return 'pages.statistics.level.advanced';
if (parsedLevel < 8) return 'pages.statistics.level.expert';
if (parsedLevel < MAX_LEVEL.novice) return 'pages.statistics.level.novice';
if (parsedLevel < MAX_LEVEL.independent) return 'pages.statistics.level.independent';
if (parsedLevel < MAX_LEVEL.advanced) return 'pages.statistics.level.advanced';
if (parsedLevel < MAX_LEVEL.expert) return 'pages.statistics.level.expert';
return null;
}

Expand Down

0 comments on commit 09115c0

Please sign in to comment.