MCPcopy Create free account
hub / github.com/codecombat/codecombat / resolveActivityStatus

Method resolveActivityStatus

app/models/User.js:675–686  ·  view source on GitHub ↗

* Read activity — hydrates local cache from me.activity when missing or stale. * @returns {{ first: number, last?: number, count?: number } | null}

(activityName)

Source from the content-addressed store, hash-verified

673 * @returns {{ first: number, last?: number, count?: number } | null}
674 */
675 resolveActivityStatus (activityName) {
676 const userId = this.get('_id') || this.id
677 if (!userId) { return null }
678
679 const local = userUtils.readActivityFromCache(userId, activityName)
680 const activity = userUtils.reconcileActivity(local, this.get('activity')?.[activityName])
681 if (activity && (!local || local.count !== activity.count || local.last !== activity.last || local.first !== activity.first)) {
682 userUtils.writeActivityToCache(userId, activityName, activity)
683 }
684
685 return activity
686 }
687
688 /**
689 * Mark an activity as seen — writes local cache immediately, then persists via trackActivity.

Callers

nothing calls this directly

Calls 1

getMethod · 0.95

Tested by

no test coverage detected