From 46bf1c9d710741e6ef54009ba94b244aa3ce34bd Mon Sep 17 00:00:00 2001 From: aqquq <jannik.wurche@student.uni-halle.de> Date: Tue, 2 Jul 2024 18:18:20 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9C=20add=20comments?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Types.elm | 43 ++++++++++++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 15 deletions(-) diff --git a/src/Types.elm b/src/Types.elm index 6792211..3e9417d 100644 --- a/src/Types.elm +++ b/src/Types.elm @@ -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 } -- GitLab