From 0e04e19c1b1351efe096866e705e31bc387d4f54 Mon Sep 17 00:00:00 2001 From: Victor Batischev Date: Mon, 22 Apr 2024 17:00:37 +0300 Subject: [PATCH] total day hours --- .../ProfileCalendar/ProfileCalendarComponent.jsx | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/components/ProfileCalendar/ProfileCalendarComponent.jsx b/src/components/ProfileCalendar/ProfileCalendarComponent.jsx index 8e24284c..3bfc1706 100644 --- a/src/components/ProfileCalendar/ProfileCalendarComponent.jsx +++ b/src/components/ProfileCalendar/ProfileCalendarComponent.jsx @@ -14,7 +14,6 @@ import { import { calendarHelper, correctDay, - currentMonthAndDay, getCorrectDate, getReports, hourOfNum @@ -29,7 +28,6 @@ import BaseButton from "@components/Common/BaseButton/BaseButton"; import arrowLeft from "assets/icons/arrows/arrowCalendar_left.png"; import arrowRight from "assets/icons/arrows/arrowCalendar_right.png"; import calendarIcon from "assets/icons/calendar.svg"; -// import close from "assets/icons/closeProjectPersons.svg"; import rectangle from "assets/images/rectangle__calendar.png"; export const ProfileCalendarComponent = React.memo( @@ -174,9 +172,14 @@ export const ProfileCalendarComponent = React.memo( }); } - // function errorr(TotalRangeHours) { - // console.error(TotalRangeHours); - // } + const countHours = (day) => { + let hours = + reports + .find((item) => moment(item.created_at).isSame(day, "date")) + ?.task.reduce((acc, task) => acc + task.hours_spent, 0) || 0; + return `${hours} ${hourOfNum(hours)}`; + }; + return (
@@ -265,10 +268,9 @@ export const ProfileCalendarComponent = React.memo(
{day.format("D")}
- 7/Час + {countHours(day)}
- {/* {currentMonthAndDay(day)} */} ))