Commit 1e4cca7d authored by Jack Stupple's avatar Jack Stupple

when on the last question you are shown the wrong profile picture

parent 855e36fc
......@@ -15,3 +15,5 @@ DB_PASSWORD=secret
CACHE_DRIVER=file
QUEUE_DRIVER=sync
QUESTIONS_PER_SEASON=3
\ No newline at end of file
......@@ -98,6 +98,13 @@ class Player extends Model
public function getSeasonRoundupPositionAttribute()
{
return floor($this->progress / 3.001); // the float is so that when you are on question 9 your roundup position isnt 3
$actual_position = floor($this->progress / (int) getenv('QUESTIONS_PER_SEASON'));
// if the question is a multiple of the questions per season and we are on the last question then the icons position would be
// incremented- but we don't want that as that means 4 icons instead of 3 and so we just remove 1 position.
if ($this->progress / (int) getenv('QUESTIONS_PER_SEASON') === 0 && $this->progress === $this->questions) {
return $actual_position - 1; // this is so that when on question 9 you are on the expected season roundup page
}
return $actual_position;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment