Removed the DatePicker from the stats

This commit is contained in:
Tiago Ribeiro
2023-10-09 11:06:26 +01:00
parent d4c4546c88
commit cb3790dc1d

View File

@@ -60,16 +60,16 @@ export default function Stats() {
if (user) setStatsUserId(user.id); if (user) setStatsUserId(user.id);
}, [user]); }, [user]);
useEffect(() => { // useEffect(() => {
if (stats && stats.length > 0) { // if (stats && stats.length > 0) {
const sortedStats = stats.sort((a, b) => a.date - b.date); // const sortedStats = stats.sort((a, b) => a.date - b.date);
const firstStat = sortedStats.shift()!; // const firstStat = sortedStats.shift()!;
setStartDate(moment.unix(firstStat.date).toDate()); // setStartDate(moment.unix(firstStat.date).toDate());
console.log(stats.filter((x) => moment.unix(x.date).isAfter(startDate))); // console.log(stats.filter((x) => moment.unix(x.date).isAfter(startDate)));
console.log(stats.filter((x) => moment.unix(x.date).isBefore(endDate))); // console.log(stats.filter((x) => moment.unix(x.date).isBefore(endDate)));
} // }
}, [stats]); // }, [stats]);
const calculateTotalScorePerSession = () => { const calculateTotalScorePerSession = () => {
const groupedBySession = groupBySession(stats); const groupedBySession = groupBySession(stats);
@@ -210,7 +210,7 @@ export default function Stats() {
/> />
)} )}
</> </>
<DatePicker {/* <DatePicker
dateFormat="dd/MM/yyyy" dateFormat="dd/MM/yyyy"
startDate={startDate} startDate={startDate}
endDate={endDate} endDate={endDate}
@@ -220,7 +220,7 @@ export default function Stats() {
setStartDate(initialDate); setStartDate(initialDate);
setEndDate(finalDate); setEndDate(finalDate);
}} }}
/> /> */}
</div> </div>
<div className="flex gap-4 flex-wrap"> <div className="flex gap-4 flex-wrap">
{/* Exams per module */} {/* Exams per module */}