diff --git a/app/Actions/Tabulation/RankAuditionEntries.php b/app/Actions/Tabulation/RankAuditionEntries.php
index 77fd90d..1f64d56 100644
--- a/app/Actions/Tabulation/RankAuditionEntries.php
+++ b/app/Actions/Tabulation/RankAuditionEntries.php
@@ -42,13 +42,19 @@ class RankAuditionEntries
private function get_seating_ranks(Audition $audition): Collection
{
+ if ($audition->bonusScore()->count() > 0) {
+ $totalColumn = 'seating_total_with_bonus';
+ } else {
+ $totalColumn = 'seating_total';
+ }
+
$sortedEntries = $audition->entries()
->whereHas('totalScore')
->with('totalScore')
->with('student.school')
->with('audition')
->join('entry_total_scores', 'entries.id', '=', 'entry_total_scores.entry_id')
- ->orderBy('entry_total_scores.seating_total', 'desc')
+ ->orderBy('entry_total_scores.'.$totalColumn, 'desc')
->orderByRaw('COALESCE(JSON_EXTRACT(entry_total_scores.seating_subscore_totals, "$[0]"), -999999) DESC')
->orderByRaw('COALESCE(JSON_EXTRACT(entry_total_scores.seating_subscore_totals, "$[1]"), -999999) DESC')
->orderByRaw('COALESCE(JSON_EXTRACT(entry_total_scores.seating_subscore_totals, "$[2]"), -999999) DESC')
diff --git a/resources/views/tabulation/auditionSeating.blade.php b/resources/views/tabulation/auditionSeating.blade.php
index 1a66854..6e1f3e8 100644
--- a/resources/views/tabulation/auditionSeating.blade.php
+++ b/resources/views/tabulation/auditionSeating.blade.php
@@ -17,8 +17,7 @@
@if($audition->bonusScore()->count() > 0)