Änderung: Aktualisierung der .gitignore und Anpassung der Berechnung im FalukantService
Änderungen: - Hinzufügung von neuen Skripten (.depall.sh, .depfe.sh, .depbe.sh) zur .gitignore, um unerwünschte Dateien vom Tracking auszuschließen. - Anpassung der Berechnung des `changeValue` im FalukantService, um den höchsten Charakterwert anstelle des Durchschnitts zu verwenden, was die Konsistenz mit der Frontend-Logik verbessert. Diese Anpassungen optimieren die Dateiverwaltung und verbessern die Logik zur Berechnung von Werten im Backend.
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1,5 +1,8 @@
|
|||||||
.gitignore
|
.gitignore
|
||||||
.env
|
.env
|
||||||
|
.depall.sh
|
||||||
|
.depfe.sh
|
||||||
|
.depbe.sh
|
||||||
node_modules
|
node_modules
|
||||||
node_modules/*
|
node_modules/*
|
||||||
backend/.env
|
backend/.env
|
||||||
|
|||||||
@@ -1718,13 +1718,15 @@ class FalukantService extends BaseService {
|
|||||||
if (!traits.length) {
|
if (!traits.length) {
|
||||||
throw new Error('noTraits');
|
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];
|
const moodRecord = gift.promotionalgiftmoods[0];
|
||||||
if (!moodRecord) {
|
if (!moodRecord) {
|
||||||
throw new Error('noMoodData');
|
throw new Error('noMoodData');
|
||||||
}
|
}
|
||||||
const moodSuitability = moodRecord.suitability;
|
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 updateFalukantUserMoney(user.id, -cost, 'Gift cost', user.id);
|
||||||
await relation.update({ nextStepProgress: relation.nextStepProgress + changeValue });
|
await relation.update({ nextStepProgress: relation.nextStepProgress + changeValue });
|
||||||
await PromotionalGiftLog.create({
|
await PromotionalGiftLog.create({
|
||||||
|
|||||||
Reference in New Issue
Block a user