@opexa/portal-components 0.0.475 → 0.0.476
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -19,20 +19,21 @@ export function MultiWageringQuest() {
|
|
|
19
19
|
const quest = useQuestContext();
|
|
20
20
|
const { stages, totalStage, currentStage, progressPercentage } = useMemo(() => {
|
|
21
21
|
const currentStage = quest.stages.filter((m) => m.cleared).length;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
const progress = [];
|
|
23
|
+
const turnover = parseFloat(quest.turnover || '0');
|
|
24
|
+
let remaining = turnover;
|
|
25
|
+
const stageTargets = quest.stages.map((s) => parseFloat(s.targetTurnover));
|
|
26
|
+
for (const target of stageTargets) {
|
|
25
27
|
if (remaining <= 0) {
|
|
26
|
-
progress
|
|
28
|
+
progress.push(0);
|
|
27
29
|
}
|
|
28
|
-
else if (remaining >=
|
|
29
|
-
progress
|
|
30
|
+
else if (remaining >= target) {
|
|
31
|
+
progress.push(100);
|
|
30
32
|
}
|
|
31
33
|
else {
|
|
32
|
-
progress
|
|
34
|
+
progress.push((remaining / target) * 100);
|
|
33
35
|
}
|
|
34
|
-
remaining -=
|
|
35
|
-
return progress;
|
|
36
|
+
remaining -= target;
|
|
36
37
|
}
|
|
37
38
|
if (!quest?.stages) {
|
|
38
39
|
return {
|
|
@@ -42,9 +43,9 @@ export function MultiWageringQuest() {
|
|
|
42
43
|
progressPercentage: 0,
|
|
43
44
|
};
|
|
44
45
|
}
|
|
45
|
-
const transformedStages = quest.stages.map((stage) => ({
|
|
46
|
+
const transformedStages = quest.stages.map((stage, idx) => ({
|
|
46
47
|
...stage,
|
|
47
|
-
progressValue:
|
|
48
|
+
progressValue: progress[idx],
|
|
48
49
|
}));
|
|
49
50
|
return {
|
|
50
51
|
stages: transformedStages,
|