MCPcopy Index your code
hub / github.com/freeCodeCamp/freeCodeCamp / getCalendar

Function getCalendar

api/src/utils/progress.ts:9–24  ·  view source on GitHub ↗
(
  progressTimestamps: ProgressTimestamp[] | null
)

Source from the content-addressed store, hash-verified

7 * @returns The object with keys based on the timestamps.
8 */
9export const getCalendar = (
10 progressTimestamps: ProgressTimestamp[] | null
11): Calendar => {
12 const calendar: Calendar = {};
13
14 progressTimestamps?.forEach(progress => {
15 if (progress === null) return;
16 if (typeof progress === 'number') {
17 calendar[Math.floor(progress / 1000)] = 1;
18 } else {
19 calendar[Math.floor(progress.timestamp / 1000)] = 1;
20 }
21 });
22
23 return calendar;
24};
25
26/**
27 * Converts a ProgressTimestamp array to an integer number of points.

Callers 3

progress.test.tsFile · 0.85
userPublicGetRoutesFunction · 0.85
getSessionUserHandlerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected