Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Math Tutor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jannik Wurche
Math Tutor
Commits
46bf1c9d
Commit
46bf1c9d
authored
9 months ago
by
Jannik Wurche
Browse files
Options
Downloads
Patches
Plain Diff
add comments
parent
29a52e69
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/Types.elm
+28
-15
28 additions, 15 deletions
src/Types.elm
with
28 additions
and
15 deletions
src/Types.elm
+
28
−
15
View file @
46bf1c9d
...
...
@@ -17,31 +17,34 @@ type alias Model =
,
runTime
:
Bool
}
type
Msg
=
SendQuizRequest
|
ReceiveQuiz
(
Result
Json
.
Decode
.
Error
Quiz
)
|
ReceivePartialQuiz
(
Result
Json
.
Decode
.
Error
PartialQuiz
)
|
ReceiveError
String
|
LinkClicked
Browser
.
UrlRequest
|
UrlChanged
Url
.
Url
|
UpdateQuizId
String
|
AnswerQuestion
Int
String
|
Tick
Time
.
Posix
|
GoToQuestion
Int
|
GoToNextQuestion
|
GoToPrevQuestion
|
ResetQuizID
|
ResetCurTime
=
SendQuizRequest
-- Message to send a quiz request
|
ReceivePartialQuiz
(
Result
Json
.
Decode
.
Error
PartialQuiz
)
-- Message for receiving a partial quiz
|
ReceiveError
String
-- Message for receiving an error
|
LinkClicked
Browser
.
UrlRequest
-- Message for handling a clicked link
|
UrlChanged
Url
.
Url
-- Message for handling a URL change
|
UpdateQuizId
String
-- Message for updating the quiz ID
|
AnswerQuestion
Int
String
-- Message for answering a question
|
Tick
Time
.
Posix
-- Message for ticking the timer
|
GoToQuestion
Int
-- Message for navigating to a specific question
|
GoToNextQuestion
-- Message for navigating to the next question
|
GoToPrevQuestion
-- Message for navigating to the previous question
|
ResetQuizID
-- Message for resetting the quiz ID
|
ResetCurTime
-- Message for resetting the current time
-- The different routes in the application.
type
Route
=
HomeRoute
|
QuestionRoute
Int
|
ResultRoute
|
NotFound
-- Represents a graph, including its window and functions.
type
alias
Graph
=
{
window
:
Window
,
functions
:
List
MathFunction
}
-- The window of a graph, specifying its boundaries.
type
alias
Window
=
{
xMin
:
Int
,
yMin
:
Int
...
...
@@ -49,6 +52,7 @@ type alias Window =
,
yMax
:
Int
}
-- The different types of mathematical functions.
type
MathFunction
=
Const
Float
|
X
...
...
@@ -65,6 +69,7 @@ type MathFunction
|
Tan
MathFunction
|
Exp
MathFunction
-- Represents a quiz, including its ID, name, duration, and questions.
type
alias
Quiz
=
{
id
:
String
,
name
:
String
...
...
@@ -72,6 +77,7 @@ type alias Quiz =
,
questions
:
List
Question
}
-- Represents a single question in a quiz.
type
alias
Question
=
{
id
:
Int
,
task
:
String
...
...
@@ -82,15 +88,22 @@ type alias Question =
,
questionType
:
QuestionType
}
-- The different types of questions that can be asked.
type
QuestionType
=
MCQ
{
choices
:
List
String
,
correct
:
List
String
,
userSelection
:
List
String
}
|
SCQ
{
choices
:
List
String
,
correct
:
String
,
userSelection
:
String
}
|
Input
{
correct
:
List
String
,
sensitive
:
Bool
,
userSelection
:
String
}
{-
-
- Representing partial Types, which we get from the server:
-
-}
type
alias
PartialQuiz
=
{
id
:
String
,
name
:
String
,
duration
:
Maybe
Int
-- Duration in minutes
,
duration
:
Maybe
Int
,
questions
:
List
PartialQuestion
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment