Handle no conflicts

This commit is contained in:
Petko Bordjukov 2020-10-16 00:15:35 +03:00
parent ff701f1c83
commit b2687682a4
1 changed files with 3 additions and 3 deletions

View File

@ -10,7 +10,7 @@ class Summary
end end
def most_conflicts def most_conflicts
Conflicts.where(left: talk_ids, right: talk_ids).most.conflicts Conflicts.where(left: talk_ids, right: talk_ids).most&.conflicts || 0
end end
def least_conflicts def least_conflicts
@ -32,10 +32,10 @@ class Summary
private private
def least_conflicts_for_single_talk def least_conflicts_for_single_talk
ConflictsForTalk.where(talk_id: talk_ids).least.conflicts ConflictsForTalk.where(talk_id: talk_ids).least&.conflicts || 0
end end
def least_conflicts_between_two_talks def least_conflicts_between_two_talks
Conflicts.where(left: talk_ids, right: talk_ids).least.conflicts Conflicts.where(left: talk_ids, right: talk_ids).least&.conflicts || 0
end end
end end