Added the timeSpent to the stats

This commit is contained in:
Tiago Ribeiro
2023-10-16 00:18:45 +01:00
parent e8b44ee10e
commit 635c92791c
5 changed files with 119 additions and 43 deletions

View File

@@ -153,6 +153,8 @@ export default function History({user}: {user: User}) {
level: calculateBandScore(x.correct, x.total, x.module, user.focus),
}));
const timeSpent = dateStats[0].timeSpent;
const selectExam = () => {
const examPromises = uniqBy(dateStats, "exam").map((stat) => getExamById(stat.module, stat.exam));
@@ -184,7 +186,14 @@ export default function History({user}: {user: User}) {
onClick={selectExam}
role="button">
<div className="w-full flex justify-between items-center">
<span className="font-medium">{formatTimestamp(timestamp)}</span>
<div className="flex gap-2 items-center">
<span className="font-medium">{formatTimestamp(timestamp)}</span>
{timeSpent && (
<>
<span className="text-sm">{Math.floor(timeSpent / 60)} minutes</span>
</>
)}
</div>
<span
className={clsx(
correct / total >= 0.7 && "text-mti-purple",