fix profile recommendation bug with grouped kinks
This commit is contained in:
parent
997ca81c4d
commit
c713d7be7e
|
@ -2,6 +2,7 @@
|
|||
|
||||
## 1.23.4
|
||||
* Hotfix to address slowdown issues
|
||||
* Fixed Profile Helper failing to detect stock kinks grouped inside custom kinks
|
||||
|
||||
## 1.23.3
|
||||
* Hotfix to fix color picker not disappearing
|
||||
|
|
|
@ -940,8 +940,8 @@ export class Matcher {
|
|||
|
||||
|
||||
private resolveKinkBucketScore(bucket: 'all' | 'favorite' | 'yes' | 'maybe' | 'no' | 'positive' | 'negative'): KinkBucketScore {
|
||||
const yourKinks = this.getAllStandardKinks(this.you);
|
||||
const theirKinks = this.getAllStandardKinks(this.them);
|
||||
const yourKinks = Matcher.getAllStandardKinks(this.you);
|
||||
const theirKinks = Matcher.getAllStandardKinks(this.them);
|
||||
|
||||
// let missed = 0;
|
||||
|
||||
|
@ -1014,7 +1014,7 @@ export class Matcher {
|
|||
// );
|
||||
// }
|
||||
|
||||
private getAllStandardKinks(c: Character): { [key: number]: KinkChoice } {
|
||||
static getAllStandardKinks(c: Character): { [key: number]: KinkChoice } {
|
||||
const kinks = _.pickBy(c.kinks, _.isString);
|
||||
|
||||
// Avoid using _.forEach on c.customs because lodash thinks it is an array
|
||||
|
@ -1029,6 +1029,24 @@ export class Matcher {
|
|||
return kinks as any;
|
||||
}
|
||||
|
||||
static findKinkById(c: Character, kinkId: number): KinkChoice | number | undefined {
|
||||
if (kinkId in c.kinks) {
|
||||
return c.kinks[kinkId];
|
||||
}
|
||||
|
||||
for (const custom of Object.values(c.customs)) {
|
||||
if (custom) {
|
||||
const children = (custom as any).children ?? [];
|
||||
|
||||
if (children.includes(kinkId)) {
|
||||
return custom.choice;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
|
||||
private getKinkMatchScore(aValue: string, bValue: string): number {
|
||||
return _.get(kinkMatchScoreMap, `${aValue}.${bValue}`, 0) * 7; // forces range above 1.0
|
||||
|
@ -1053,17 +1071,14 @@ export class Matcher {
|
|||
}
|
||||
|
||||
static getKinkPreference(c: Character, kinkId: number): KinkPreference | null {
|
||||
if (!(kinkId in c.kinks))
|
||||
return null;
|
||||
|
||||
const kinkVal = c.kinks[kinkId];
|
||||
const kinkVal = Matcher.findKinkById(c, kinkId);
|
||||
|
||||
if (kinkVal === undefined) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (typeof kinkVal === 'string') {
|
||||
return kinkMapping[c.kinks[kinkId] as string];
|
||||
return kinkMapping[kinkVal];
|
||||
}
|
||||
|
||||
const custom = c.customs[kinkVal];
|
||||
|
|
|
@ -111,7 +111,9 @@ export class ProfileRecommendationAnalyzer {
|
|||
}
|
||||
|
||||
protected checkKinkCounts(): void {
|
||||
const counts = _.reduce(this.profile.character.kinks, (accum, kinkLevel) => {
|
||||
const kinks = Matcher.getAllStandardKinks(this.profile.character);
|
||||
|
||||
const counts = _.reduce(kinks, (accum, kinkLevel) => {
|
||||
if (_.isString(kinkLevel) && kinkLevel) {
|
||||
accum[kinkLevel as keyof typeof accum] += 1;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue