From 59105e10766351a384dd39586a14eb8166e1e91d Mon Sep 17 00:00:00 2001 From: Malaber <32635600+Malaber@users.noreply.github.com> Date: Thu, 9 May 2019 16:30:27 +0200 Subject: [PATCH] Move group_match method to public methods This is done in order to check if a match is a group match within Matches Controller --- app/models/match.rb | 8 ++++---- app/services/playoff_stage_service.rb | 7 +++++++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/app/models/match.rb b/app/models/match.rb index 6914310..0c5e676 100644 --- a/app/models/match.rb +++ b/app/models/match.rb @@ -24,6 +24,10 @@ class Match < ApplicationRecord # This should maybe be cached or put into db end + def group_match? + group.present? + end + private def evaluate_winner @@ -35,8 +39,4 @@ class Match < ApplicationRecord def stage_xor_group errors.add(:stage_xor_group, 'Stage and Group missing or both present') unless stage.present? ^ group.present? end - - def group_match? - group.present? - end end diff --git a/app/services/playoff_stage_service.rb b/app/services/playoff_stage_service.rb index 340a9a2..ed0e19a 100644 --- a/app/services/playoff_stage_service.rb +++ b/app/services/playoff_stage_service.rb @@ -70,4 +70,11 @@ class PlayoffStageService stage_count.to_int end end + + def self.populate_match_below(match) + current_stage = match.stage + next_stage = match.stage.tournament.stages. + + puts + end end