PlayerStats

Object for PlayerStats model

class Object
trait Matchable
class Any

Type members

Classlikes

case class PlayerStats(totalScore: Int, totalAnsweredQuestions: Int, totalCorrectAnswers: Int, totalAnswerPrecision: Int, totalAverageTimeAnswer: Double, courseInStatsList: List[CourseInStats])

Case class for PlayerStats model

Case class for PlayerStats model

Value parameters:
courseInStatsList

the list of course in stats

totalAnswerPrecision

total % answer precision

totalAnsweredQuestions

total number of answered questions

totalAverageTimeAnswer

total average time to answer

totalCorrectAnswers

total number of question answered correctly

totalScore

total user score

Value members

Concrete methods

def addQuizInGameToStats(playerStats: PlayerStats, quizInGame: QuizInGame, isCorrect: Boolean, score: Int, timeToAnswer: Double): PlayerStats

Add a QuizInGame to the PlayerStats of the current game

Add a QuizInGame to the PlayerStats of the current game

Returns:

an updated PlayerStats with the newly added quiz in game

def calculateTotalAnswerPrecision(totalAnswered: Int, totalCorrectAnswer: Int): Int

Calculates total answer precision given two value

Calculates total answer precision given two value

Returns:

an Int as percentage

def changeCourseInStatsList(playerStats: PlayerStats, courseInStatsList: List[CourseInStats]): PlayerStats

Change course in stats list

Change course in stats list

Returns:

an updated PlayerStats

def changeTotalAnswerPrecision(playerStats: PlayerStats, totalAnswerPrecision: Int): PlayerStats

Change total answer precision

Change total answer precision

Returns:

an updated PlayerStats

def changeTotalAnsweredQuestions(playerStats: PlayerStats, totalAnsweredQuestions: Int): PlayerStats

Change total answered questions

Change total answered questions

Returns:

an updated PlayerStats

def changeTotalAverageTimeAnswer(playerStats: PlayerStats, totalAverageTimeAnswer: Double): PlayerStats

Change total average time to answer

Change total average time to answer

Returns:

an updated PlayerStats

def changeTotalCorrectAnswers(playerStats: PlayerStats, totalCorrectAnswers: Int): PlayerStats

Change total correct answers

Change total correct answers

Returns:

an updated PlayerStats

def changeTotalScore(playerStats: PlayerStats, totalScore: Int): PlayerStats

Change total score in player stats

Change total score in player stats

Returns:

an updated PlayerStats

Init player stats with default values

Init player stats with default values

Returns:

a PlayerStats

def mergePlayerStats(playerStats: PlayerStats, newPlayerStats: PlayerStats): PlayerStats

Merge two PlayerStats in a new one

Merge two PlayerStats in a new one

Returns:

an updated PlayerStats

def removeUnusedStats(savedCourseList: List[SavedCourse], playerStats: PlayerStats): PlayerStats

Removes statistics that don't have a correspondent SavedCourse

Removes statistics that don't have a correspondent SavedCourse

Returns:

an updated PlayerStats

def updateCourseInStatsList(oldCourseId: CourseIdentifier, updatedCourseId: CourseIdentifier, playerStats: PlayerStats): PlayerStats

Update course in stats list in player stats

Update course in stats list in player stats

Returns:

an updated PlayerStats

def updatePlayerStats(courseInStatsList: List[CourseInStats]): PlayerStats

Update PlayerStats with all the values that can be derived

Update PlayerStats with all the values that can be derived

Returns:

an updated PlayerStats