a a vibe-coded abomination experiment of a fragrance review platform built on the atmosphere. drydown.social

applying default preferences globally

+12 -11
+6 -5
src/utils/preferenceUtils.ts
··· 1 import { AtpBaseClient } from '../client/index' 2 import type { UserPreferencesForScoring } from './reviewUtils' 3 import { cache, TTL } from '../services/cache' 4 5 /** 6 * Fetches another user's preference settings from their PDS. ··· 70 userPrefs: UserPreferencesForScoring, 71 otherPrefs: UserPreferencesForScoring 72 ): number { 73 - // Default to neutral value (3) if any preference is undefined 74 const distances = [ 75 - Math.abs((userPrefs.presenceStyle ?? 3) - (otherPrefs.presenceStyle ?? 3)), 76 - Math.abs((userPrefs.longevityPriority ?? 3) - (otherPrefs.longevityPriority ?? 3)), 77 - Math.abs((userPrefs.complexityPreference ?? 3) - (otherPrefs.complexityPreference ?? 3)), 78 - Math.abs((userPrefs.scoringApproach ?? 3) - (otherPrefs.scoringApproach ?? 3)), 79 ] 80 81 const avgDistance = distances.reduce((sum, d) => sum + d, 0) / 4
··· 1 import { AtpBaseClient } from '../client/index' 2 import type { UserPreferencesForScoring } from './reviewUtils' 3 import { cache, TTL } from '../services/cache' 4 + import { DEFAULT_PREFERENCES } from '../data/preferenceDefinitions' 5 6 /** 7 * Fetches another user's preference settings from their PDS. ··· 71 userPrefs: UserPreferencesForScoring, 72 otherPrefs: UserPreferencesForScoring 73 ): number { 74 + // Use DEFAULT_PREFERENCES if any preference is undefined 75 const distances = [ 76 + Math.abs((userPrefs.presenceStyle ?? DEFAULT_PREFERENCES.presenceStyle) - (otherPrefs.presenceStyle ?? DEFAULT_PREFERENCES.presenceStyle)), 77 + Math.abs((userPrefs.longevityPriority ?? DEFAULT_PREFERENCES.longevityPriority) - (otherPrefs.longevityPriority ?? DEFAULT_PREFERENCES.longevityPriority)), 78 + Math.abs((userPrefs.complexityPreference ?? DEFAULT_PREFERENCES.complexityPreference) - (otherPrefs.complexityPreference ?? DEFAULT_PREFERENCES.complexityPreference)), 79 + Math.abs((userPrefs.scoringApproach ?? DEFAULT_PREFERENCES.scoringApproach) - (otherPrefs.scoringApproach ?? DEFAULT_PREFERENCES.scoringApproach)), 80 ] 81 82 const avgDistance = distances.reduce((sum, d) => sum + d, 0) / 4
+6 -6
src/utils/reviewUtils.ts
··· 36 } 37 38 import type { IdealScores, PropertyImportance } from '../data/preferenceDefinitions' 39 - import { BASE_PROPERTY_IMPORTANCE } from '../data/preferenceDefinitions' 40 41 /** 42 * Convert user preferences to ideal scores. ··· 182 * @deprecated Use calculateIdealBasedScore for personalized scoring 183 */ 184 export function calculateWeightedScore(review: any): number { 185 - // Use ideal-based scoring with default preferences (all 3s = balanced) 186 const defaultPreferences: UserPreferencesForScoring = { 187 - presenceStyle: 3, 188 - longevityPriority: 3, 189 - complexityPreference: 3, 190 - scoringApproach: 3, 191 } 192 193 return calculateIdealBasedScore(review, defaultPreferences)
··· 36 } 37 38 import type { IdealScores, PropertyImportance } from '../data/preferenceDefinitions' 39 + import { BASE_PROPERTY_IMPORTANCE, DEFAULT_PREFERENCES } from '../data/preferenceDefinitions' 40 41 /** 42 * Convert user preferences to ideal scores. ··· 182 * @deprecated Use calculateIdealBasedScore for personalized scoring 183 */ 184 export function calculateWeightedScore(review: any): number { 185 + // Use ideal-based scoring with default preferences 186 const defaultPreferences: UserPreferencesForScoring = { 187 + presenceStyle: DEFAULT_PREFERENCES.presenceStyle, 188 + longevityPriority: DEFAULT_PREFERENCES.longevityPriority, 189 + complexityPreference: DEFAULT_PREFERENCES.complexityPreference, 190 + scoringApproach: DEFAULT_PREFERENCES.scoringApproach, 191 } 192 193 return calculateIdealBasedScore(review, defaultPreferences)