mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-17 07:42:23 +00:00
merge(reconcile): b5-achievements audit findings
This commit is contained in:
commit
f73bc32a72
8 files changed
+262
-33
No files matched your search
@@ -80,6 +80,32 @@ export interface AchievementDefinition {
|
||||
category: AchievementCategory;
|
||||
}
|
||||
|
||||
/**
|
||||
* v1.18.0 — module ownership for an achievement metric. Returns the
|
||||
* `ModuleKey` whose enable/disable state governs the badge, or `null`
|
||||
* when the badge belongs to a core domain (vitals, medications) or to
|
||||
* an account-wide capability (security, login, bug reports) that has no
|
||||
* toggleable module behind it.
|
||||
*
|
||||
* The string literals here intentionally mirror `MODULE_KEYS` in
|
||||
* `@/lib/modules/registry` without importing it, so this pure lib stays
|
||||
* free of the gate's transitive dependencies. The module gate (B5) reads
|
||||
* this map to skip badge categories whose owning module is turned off —
|
||||
* a sleep badge must not unlock while the sleep module is disabled.
|
||||
*/
|
||||
export function moduleForMetric(metric: AchievementMetricKey): string | null {
|
||||
switch (metric) {
|
||||
case "moodEntryCount":
|
||||
case "moodDayStreak":
|
||||
case "moodImprovementHit":
|
||||
return "mood";
|
||||
case "sleepLogDayStreak":
|
||||
return "sleep";
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* v1.4.18 — discovery flags. Predicate input for
|
||||
* `applyDiscoveryFilter`. A flag is true iff the user has at least one
|
||||
|
||||
Reference in new issue
Block a user