MCPcopy Create free account
hub / github.com/dailydotdev/apps / addPatchyActivity

Function addPatchyActivity

packages/shared/src/features/patchy/patchyDay.ts:67–79  ·  view source on GitHub ↗
(
  day: PatchyDay,
  activity: PatchyActivity,
  now: Date,
)

Source from the content-addressed store, hash-verified

65
66// Pure: the day after one more activity.
67export const addPatchyActivity = (
68 day: PatchyDay,
69 activity: PatchyActivity,
70 now: Date,
71): PatchyDay => {
72 const base = day.day === getPatchyDayKey(now) ? day : createPatchyDay(now);
73 const counter = counterFor[activity];
74 const next: PatchyDay = { ...base };
75 if (counter) {
76 next[counter] = base[counter] + 1;
77 }
78 return next;
79};
80
81const storageKey = (userId: string) => `patchy_day:${userId}`;
82

Callers 2

patchyDay.spec.tsFile · 0.90
recordPatchyActivityFunction · 0.85

Calls 2

getPatchyDayKeyFunction · 0.85
createPatchyDayFunction · 0.85

Tested by

no test coverage detected