From e639d76c7d8ceb110b73e5dea0721f7069689e83 Mon Sep 17 00:00:00 2001 From: tfhuhtal Date: Fri, 27 Sep 2024 17:06:22 +0300 Subject: [PATCH] fix --- .../FacultyMonitoringOverview/ModalAnswer.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/client/components/FacultyMonitoringView/FacultyMonitoringOverview/ModalAnswer.js b/client/components/FacultyMonitoringView/FacultyMonitoringOverview/ModalAnswer.js index f1b8285d..33e0c844 100644 --- a/client/components/FacultyMonitoringView/FacultyMonitoringOverview/ModalAnswer.js +++ b/client/components/FacultyMonitoringView/FacultyMonitoringOverview/ModalAnswer.js @@ -12,9 +12,8 @@ const ModalAnswer = ({ question, faculty }) => { return answers ? answers.find(answer => answer.programme === faculty)?.data || {} : {} }, [answers, faculty]) const [showAll, setShowAll] = useState(false) - const lightsHistory = facultyAnswers[`${question.id}_lights_history`]?.reverse() || [] - const displayedHistory = showAll ? lightsHistory : lightsHistory?.slice(0, 4).reverse() - + const lightsHistory = facultyAnswers[`${question.id}_lights_history`] || [] + const displayedHistory = showAll ? lightsHistory : lightsHistory.slice(Math.max(lightsHistory.length - 4, 0)) const formatDate = date => { return new Date(date) .toLocaleString('en-GB', { day: '2-digit', month: '2-digit', year: 'numeric' })