feat(falukant): implement score threshold logic and enhance UI feedback for certificate progression
All checks were successful
Deploy to production / deploy (push) Successful in 3m3s
All checks were successful
Deploy to production / deploy (push) Successful in 3m3s
- Added a new function to calculate score thresholds based on certificate levels, improving the logic for determining promotion eligibility. - Updated the FalukantService to include new properties for score and requirement checks, enhancing the decision-making process for certificate readiness. - Enhanced the OverviewView component to display detailed hints and states regarding certificate progression, providing users with clearer feedback on their status. - Localized new strings in multiple languages to support the updated UI elements and hints, improving user experience across different languages.
This commit is contained in:
@@ -208,6 +208,14 @@ function getTargetCertificateByScore(score) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
function getScoreThresholdForCertificate(level) {
|
||||
if (level >= 5) return 3.8;
|
||||
if (level === 4) return 2.8;
|
||||
if (level === 3) return 1.8;
|
||||
if (level === 2) return 0.9;
|
||||
return 0;
|
||||
}
|
||||
|
||||
async function calcRegionalSellPrice(product, knowledgeFactor, regionId, worthPercent = null) {
|
||||
// Wenn worthPercent nicht übergeben wurde, hole es aus der Datenbank
|
||||
if (worthPercent === null) {
|
||||
@@ -2944,6 +2952,7 @@ class FalukantService extends BaseService {
|
||||
const targetCertificate = getTargetCertificateByScore(score);
|
||||
const nextCertificate = Math.min(5, currentCertificate + 1);
|
||||
const nextThreshold = CERTIFICATE_THRESHOLDS[nextCertificate] || null;
|
||||
const nextScoreThreshold = getScoreThresholdForCertificate(nextCertificate);
|
||||
|
||||
const currentValues = {
|
||||
avgKnowledge,
|
||||
@@ -3000,17 +3009,22 @@ class FalukantService extends BaseService {
|
||||
}] : []),
|
||||
] : [];
|
||||
|
||||
const minimumRequirementsMet = nextRequirements.every((requirement) => requirement.met)
|
||||
&& (!statusRequirement || statusRequirement.fulfilled);
|
||||
const scoreRequirementMet = nextCertificate <= targetCertificate;
|
||||
|
||||
return {
|
||||
currentCertificate,
|
||||
nextCertificate,
|
||||
score: Number(score.toFixed(2)),
|
||||
targetCertificate,
|
||||
nextScoreThreshold,
|
||||
currentValues,
|
||||
nextRequirements,
|
||||
statusRequirement,
|
||||
readyForNextCertificate: nextCertificate <= targetCertificate
|
||||
&& nextRequirements.every((requirement) => requirement.met)
|
||||
&& (!statusRequirement || statusRequirement.fulfilled),
|
||||
scoreRequirementMet,
|
||||
minimumRequirementsMet,
|
||||
readyForNextCertificate: scoreRequirementMet && minimumRequirementsMet,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user