Entkopple Partnersuche vom Altersabstand und entferne garantierte Schwangerschaften
All checks were successful
Deploy to production / deploy (push) Successful in 2m41s

This commit is contained in:
Torsten Schulz (local)
2026-11-04 15:09:49 +01:00
parent 0178d33a21
commit 6e31a114cf
4 changed files with 98 additions and 148 deletions

View File

@@ -0,0 +1,20 @@
import { Op, Sequelize } from 'sequelize';
// One calendar day is one game year. Only the minimum age restricts age;
// neither the age difference nor the date the character was created matters.
export function buildPartnerCandidateQuery({ characterId, gender, regionId, titleId, minimumAge, now = new Date() }) {
const minimumAgeCutoff = new Date(now);
minimumAgeCutoff.setHours(0, 0, 0, 0);
minimumAgeCutoff.setDate(minimumAgeCutoff.getDate() - minimumAge + 1);
return {
where: {
id: { [Op.ne]: characterId },
gender: { [Op.ne]: gender },
regionId,
birthdate: { [Op.lt]: minimumAgeCutoff },
titleOfNobility: { [Op.between]: [titleId - 1, titleId + 1] },
},
order: Sequelize.literal('random()'),
limit: 5,
};
}