Skip to content

Commit

Permalink
Calendar should be an entity, consolidate like impl
Browse files Browse the repository at this point in the history
  • Loading branch information
mattruggio committed Jun 30, 2023
1 parent f9edeec commit 32e8372
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
Binary file modified docs/architecture.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion lib/basketball/season/calendar.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Basketball
module Season
# Sets boundaries for exhibition and regular season play. Add games as long as they are
# within the correct dated boundaries
class Calendar
class Calendar < Entity
class OutOfBoundsError < StandardError; end
class TeamAlreadyBookedError < StandardError; end

Expand All @@ -21,6 +21,8 @@ def initialize(
regular_end_date:,
games: []
)
super()

raise ArgumentError, 'exhibition_start_date is required' if exhibition_start_date.to_s.empty?
raise ArgumentError, 'exhibition_end_date is required' if exhibition_end_date.to_s.empty?
raise ArgumentError, 'regular_start_date is required' if regular_start_date.to_s.empty?
Expand Down
2 changes: 1 addition & 1 deletion lib/basketball/season/league.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def teams
end

def players
conferences.flat_map(&:players) + free_agents
signed_players + free_agents
end

def conference_for(team)
Expand Down
2 changes: 1 addition & 1 deletion lib/basketball/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module Basketball
VERSION = '0.0.23'
VERSION = '0.0.24'
end

0 comments on commit 32e8372

Please sign in to comment.