Skip to content

Commit

Permalink
feat: Update checkmark logic
Browse files Browse the repository at this point in the history
  • Loading branch information
RudraPatel2003 committed Jan 21, 2025
1 parent b74657d commit fd20777
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { useState } from "react";

import { ClientUser, ProgramEnrollment } from "@/types";
import dayjsUtil from "@/utils/dayjsUtil";
import getClosestPastSunday from "@/utils/getClosestPastSunday";

export type Row = {
id?: string;
Expand All @@ -28,7 +29,13 @@ const createRowFromHealthyHabitsProgramEnrollment = (

if (user.healthyHabitsTrackingForms.length > 0) {
const latestFormSubmission = user.healthyHabitsTrackingForms[0];
completed = date.isSame(lastSunday, "day");
const latestFormSubmissionWeek = dayjsUtil(
latestFormSubmission.weekOfSubmission,
);

const lastSunday = getClosestPastSunday();

completed = latestFormSubmissionWeek.isSame(lastSunday, "day");
}

return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
import { Box, Tab, Tabs, Typography } from "@mui/material";
import { useState } from "react";

import HealthyHabitsClientDashboard from "@/components/AdminDashboard/HealthyHabitsDashboard/HealthyHabitsClientDashboard";
import HealthyHabitsMetrics from "@/components/AdminDashboard/HealthyHabitsDashboard/HealthyHabitsMetrics";
import { ProgramEnrollment } from "@/types";

import HealthyHabitsClientDashboard from "./HealthyHabitsClientDashboard";
import HealthyHabitsMetrics from "./HealthyHabitsMetrics";

type HealthyHabitsSections = "clients" | "metrics";

type HealthyHabitsDashboardProps = {
Expand Down

0 comments on commit fd20777

Please sign in to comment.