mirror of
https://github.com/bitwarden/browser
synced 2026-02-10 05:30:01 +00:00
bugfixes
This commit is contained in:
@@ -13,9 +13,11 @@ function active(
|
||||
return pipe(
|
||||
// refresh when an achievement is earned, but not when metrics
|
||||
// update; this may cause metrics to overrun
|
||||
withLatestFrom(metrics$),
|
||||
combineLatestWith(earned$),
|
||||
map(([[monitors, metrics], earned]) => {
|
||||
withLatestFrom(metrics$),
|
||||
|
||||
// filter validators to active set
|
||||
map(([[monitors, earned], metrics]) => {
|
||||
// compute list of active achievements
|
||||
const active = monitors.filter((m) => {
|
||||
// 🧠 the filters could be lifted into a function argument & delivered
|
||||
|
||||
@@ -89,7 +89,7 @@ const ThreeItemsCreatedValidator = {
|
||||
name: "Three times a charm",
|
||||
description: "Add three items to your vault",
|
||||
validator: Type.Threshold,
|
||||
active: { metric: ItemCreatedProgress, low: 2, high: 3 },
|
||||
active: { metric: ItemCreatedProgress, low: 1, high: 3 },
|
||||
hidden: false,
|
||||
trigger(item) {
|
||||
return item.action === "vault-item-added";
|
||||
@@ -99,8 +99,8 @@ const ThreeItemsCreatedValidator = {
|
||||
return [progressEvent(ItemCreatedProgress, value)];
|
||||
},
|
||||
award(_measured, progress) {
|
||||
const value = progress.get(ItemCreatedProgress) ?? 0;
|
||||
return value >= 3 ? [earnedEvent(ItemCreatedAchievement)] : [];
|
||||
const value = progress.get(ItemCreatedProgress);
|
||||
return value === 3 ? [earnedEvent(ThreeItemsCreatedAchievement)] : [];
|
||||
},
|
||||
} satisfies AchievementValidator;
|
||||
|
||||
@@ -109,7 +109,7 @@ const FiveItemsCreatedValidator = {
|
||||
name: "fiiivvve GoOoOoOolllllllD RIIIIIINGS!!!!!!",
|
||||
description: "Add five items to your vault",
|
||||
validator: Type.Threshold,
|
||||
active: { metric: ItemCreatedProgress, low: 3, high: 5 },
|
||||
active: { metric: ItemCreatedProgress, low: 3, high: 6 },
|
||||
hidden: false,
|
||||
trigger(item) {
|
||||
return item.action === "vault-item-added";
|
||||
@@ -119,8 +119,8 @@ const FiveItemsCreatedValidator = {
|
||||
return [progressEvent(ItemCreatedProgress, value)];
|
||||
},
|
||||
award(_measured, progress) {
|
||||
const value = progress.get(ItemCreatedProgress) ?? 0;
|
||||
return value >= 5 ? [earnedEvent(ItemCreatedAchievement)] : [];
|
||||
const value = progress.get(ItemCreatedProgress);
|
||||
return value === 5 ? [earnedEvent(FiveItemsCreatedAchievement)] : [];
|
||||
},
|
||||
} satisfies AchievementValidator;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user