diff --git a/.gitignore b/.gitignore index 719b4a9..0fa1bee 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,8 @@ .gitignore .env +.depall.sh +.depfe.sh +.depbe.sh node_modules node_modules/* backend/.env diff --git a/backend/services/falukantService.js b/backend/services/falukantService.js index 5e1caf6..5f0598e 100644 --- a/backend/services/falukantService.js +++ b/backend/services/falukantService.js @@ -1718,13 +1718,15 @@ class FalukantService extends BaseService { if (!traits.length) { throw new Error('noTraits'); } - const traitAvg = traits.reduce((sum, ct) => sum + ct.suitability, 0) / traits.length; + // Finde den höchsten Charakterwert (wie im Frontend) + const highestCharacterValue = Math.max(...traits.map(ct => ct.suitability)); const moodRecord = gift.promotionalgiftmoods[0]; if (!moodRecord) { throw new Error('noMoodData'); } const moodSuitability = moodRecord.suitability; - const changeValue = Math.round(traitAvg + moodSuitability - 5); + // Gleiche Berechnung wie im Frontend: (moodValue + highestCharacterValue) / 2 + const changeValue = Math.round((moodSuitability + highestCharacterValue) / 2); await updateFalukantUserMoney(user.id, -cost, 'Gift cost', user.id); await relation.update({ nextStepProgress: relation.nextStepProgress + changeValue }); await PromotionalGiftLog.create({