Skip to content

Commit a8e0828

Browse files
committed
add rankcache getter
1 parent 73823c2 commit a8e0828

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

webapp/src/Entity/RankCache.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,28 @@ public function getTotalOptscoreMinPublic(): float
184184
return $this->totaloptscore_min_public;
185185
}
186186

187+
public function getTotalOptscore(bool $restricted): float
188+
{
189+
if ($this->contest->getOptScoreOrder() == 'asc') return $restricted
190+
? $this->getTotalOptscoreMinRestricted()
191+
: $this->getTotalOptscoreMinPublic();
192+
else return $restricted
193+
? $this->getTotalOptscoreMaxRestricted()
194+
: $this->getTotalOptscoreMaxPublic();
195+
}
196+
197+
public function getTotalOptscoreRestricted(): float
198+
{
199+
if ($this->contest->getOptScoreOrder() == 'asc') return $this->getTotalOptscoreMinRestricted();
200+
else return $this->getTotalOptscoreMaxRestricted();
201+
}
202+
203+
public function getTotalOptscorePublic(): float
204+
{
205+
if ($this->contest->getOptScoreOrder() == 'asc') return $this->getTotalOptscoreMinPublic();
206+
else return $this->getTotalOptscoreMaxPublic();
207+
}
208+
187209
public function setContest(?Contest $contest = null): RankCache
188210
{
189211
$this->contest = $contest;

0 commit comments

Comments
 (0)