-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Redesigns the test overview to use the same base components as question and LO list - Adds delete test functionality Coming next: - Filters for tests (like for the qs and los) Closes #49
- Loading branch information
Showing
43 changed files
with
637 additions
and
573 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"extends": "../../../tsconfig.base.json", | ||
"include": ["src/**/*.ts"] | ||
"include": ["src/**/*.ts"], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"extends": "../../../tsconfig.base.json", | ||
"include": ["src/**/*.ts"] | ||
"include": ["src/**/*.ts"], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"extends": "../../../tsconfig.base.json", | ||
"include": ["src/**/*.ts"] | ||
"include": ["src/**/*.ts"], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"extends": "../../../tsconfig.base.json", | ||
"compilerOptions": {}, | ||
"include": ["src/**/*.ts"] | ||
"include": ["src/**/*.ts"], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { DateTime, Duration } from "luxon"; | ||
import type { Test } from "@chair-flight/base/types"; | ||
|
||
const getClockTime = (milliseconds: number) => { | ||
const duration = Duration.fromMillis(milliseconds); | ||
console.log(milliseconds, duration); | ||
return duration.toFormat("hh:mm"); | ||
}; | ||
|
||
/** | ||
* returns a bunch of derivative information from data in Test. | ||
*/ | ||
export const processTest = (test: Test) => { | ||
const correctAnswers = test.questions.reduce( | ||
(s, q) => s + (q.selectedOptionId === q.correctOptionId ? 1 : 0), | ||
0, | ||
); | ||
|
||
const rawScore = (correctAnswers / test.questions.length) * 100; | ||
const score = Math.round(Math.min(100, Math.max(0, rawScore))); | ||
|
||
const color = ((): "warning" | "success" | "danger" | "primary" => { | ||
if (test.status === "created") return "primary"; | ||
if (test.status === "started") return "warning"; | ||
if (score >= 75) return "success"; | ||
return "danger"; | ||
})(); | ||
|
||
const timeLeft = (() => { | ||
if (test.status === "finished") return "-"; | ||
if (test.mode === "study") return "-"; | ||
const tLeft = test.durationInMs - test.timeSpentInMs; | ||
return getClockTime(tLeft); | ||
})(); | ||
|
||
const timeSpent = getClockTime(test.timeSpentInMs); | ||
|
||
const timeStarted = | ||
test.startedAtEpochMs && | ||
DateTime.fromMillis(test.startedAtEpochMs).toFormat("DDD"); | ||
|
||
return { | ||
color, | ||
score, | ||
timeSpent, | ||
timeLeft, | ||
timeStarted, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"extends": "../../../tsconfig.base.json", | ||
"include": ["src/**/*.ts"], | ||
"exclude": ["src/**/*.test.*"] | ||
"exclude": ["src/**/*.test.*"], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"extends": "../../../tsconfig.base.json", | ||
"compilerOptions": { | ||
"types": ["node"] | ||
"types": ["node"], | ||
}, | ||
"include": ["src/**/*.ts"] | ||
"include": ["src/**/*.ts"], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"extends": "../../../tsconfig.base.json", | ||
"include": ["src/**/*.ts"] | ||
"include": ["src/**/*.ts"], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
ec4a1ae
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
chair-flight – ./
chair-flight-git-main-chair-flight-team.vercel.app
chair-flight-chair-flight-team.vercel.app
chair-flight.vercel.app
chair-flight.com
www.chair-flight.com