<NME> block_date_manager.rb
<BEF> # frozen_string_literal: true

require_dependency "#{Rails.root}/lib/course_meetings_manager"

class BlockDateManager
  def initialize(block, meetings_manager = nil)
    @block = block
    @week = @block.week
    @course = @block.course
    @meetings_manager = meetings_manager
  end

  def date
    weekdays_until_first_meeting = @course.weekdays.index('1') || 0
    (@course.timeline_start + weeks_from_start.weeks)
      .to_date.beginning_of_week(:sunday) + weekdays_until_first_meeting.days
  end

  def due_date
    return @block.due_date if @block.due_date.present?
    # an assignment due the end of the first week
    # is due the end of the week the timeline starts
    # (0 weeks from timeline start)
    (@course.timeline_start + weeks_from_start.weeks)
      .to_date.end_of_week(:sunday)
  end

  private

  DAYS_OF_THE_WEEK = {
    0 => :sunday,
    1 => :monday,
    2 => :tuesday,
    3 => :wednesday,
    4 => :thursday,
    5 => :friday,
    6 => :saturday
  }.freeze
  def first_meeting_of_week
    # Find the first selected — 1 — weekday from the seven-digit weekdays string
    DAYS_OF_THE_WEEK[@course.weekdays.index('1')]
  end

  def weeks_from_start
    return @weeks_from_start unless @weeks_from_start.nil?
    weeks_from_start = (@week.order - 1).to_i
    weeks_from_start += meetings_manager.blackout_weeks_prior_to(@week)
    @weeks_from_start = weeks_from_start
    @weeks_from_start
  end

  def meetings_manager
    @meetings_manager ||= @course.meetings_manager
  end
end

<MSG> Remove dead code

<DFF> @@ -27,20 +27,6 @@ class BlockDateManager
 
   private
 
-  DAYS_OF_THE_WEEK = {
-    0 => :sunday,
-    1 => :monday,
-    2 => :tuesday,
-    3 => :wednesday,
-    4 => :thursday,
-    5 => :friday,
-    6 => :saturday
-  }.freeze
-  def first_meeting_of_week
-    # Find the first selected — 1 — weekday from the seven-digit weekdays string
-    DAYS_OF_THE_WEEK[@course.weekdays.index('1')]
-  end
-
   def weeks_from_start
     return @weeks_from_start unless @weeks_from_start.nil?
     weeks_from_start = (@week.order - 1).to_i

{'commit': "diff --git a/lib/block_date_manager.rb b/lib/block_date_manager.rb\nindex ba7915f72..1028b85d6 100644\n--- a/lib/block_date_manager.rb\n+++ b/lib/block_date_manager.rb\n@@ -27,20 +27,6 @@ class BlockDateManager\n \n   private\n \n-  DAYS_OF_THE_WEEK = {\n-    0 => :sunday,\n-    1 => :monday,\n-    2 => :tuesday,\n-    3 => :wednesday,\n-    4 => :thursday,\n-    5 => :friday,\n-    6 => :saturday\n-  }.freeze\n-  def first_meeting_of_week\n-    # Find the first selected — 1 — weekday from the seven-digit weekdays string\n-    DAYS_OF_THE_WEEK[@course.weekdays.index('1')]\n-  end\n-\n   def weeks_from_start\n     return @weeks_from_start unless @weeks_from_start.nil?\n     weeks_from_start = (@week.order - 1).to_i\n", 'commit_subject': 'Remove dead code', 'repo_name': 'WikiEducationFoundation/WikiEduDashboard', 'committer': {'name': 'Sage Ross', 'email': '0bc9f67b2b08dbd979104ac630343507d3de0edf@gmail.com', 'time_sec': '1491587304', 'tz_offset': '-420', 'date': {'seconds': '1491587304'}}, 'commit_tree': 'be6365d5e4be4e017577b485663906841053ba5f', 'commit_message': 'Remove dead code\n', 'language_name': 'Shell', 'license': 'mit', 'hunks': "@@ -27,20 +27,6 @@ class BlockDateManager\n \n   private\n \n-  DAYS_OF_THE_WEEK = {\n-    0 => :sunday,\n-    1 => :monday,\n-    2 => :tuesday,\n-    3 => :wednesday,\n-    4 => :thursday,\n-    5 => :friday,\n-    6 => :saturday\n-  }.freeze\n-  def first_meeting_of_week\n-    # Find the first selected — 1 — weekday from the seven-digit weekdays string\n-    DAYS_OF_THE_WEEK[@course.weekdays.index('1')]\n-  end\n-\n   def weeks_from_start\n     return @weeks_from_start unless @weeks_from_start.nil?\n     weeks_from_start = (@week.order - 1).to_i\n", 'addition_count': 0, 'deletion_count': 14, 'src_file': 'a/lib/block_date_manager.rb', 'tgt_file': 'b/lib/block_date_manager.rb', 'file_extension': '.rb', 'before_file': '# frozen_string_literal: true\n\nrequire_dependency "#{Rails.root}/lib/course_meetings_manager"\n\nclass BlockDateManager\n  def initialize(block, meetings_manager = nil)\n    @block = block\n    @week = @block.week\n    @course = @block.course\n    @meetings_manager = meetings_manager\n  end\n\n  def date\n    weekdays_until_first_meeting = @course.weekdays.index(\'1\') || 0\n    (@course.timeline_start + weeks_from_start.weeks)\n      .to_date.beginning_of_week(:sunday) + weekdays_until_first_meeting.days\n  end\n\n  def due_date\n    return @block.due_date if @block.due_date.present?\n    # an assignment due the end of the first week\n    # is due the end of the week the timeline starts\n    # (0 weeks from timeline start)\n    (@course.timeline_start + weeks_from_start.weeks)\n      .to_date.end_of_week(:sunday)\n  end\n\n  private\n\n  DAYS_OF_THE_WEEK = {\n    0 => :sunday,\n    1 => :monday,\n    2 => :tuesday,\n    3 => :wednesday,\n    4 => :thursday,\n    5 => :friday,\n    6 => :saturday\n  }.freeze\n  def first_meeting_of_week\n    # Find the first selected — 1 — weekday from the seven-digit weekdays string\n    DAYS_OF_THE_WEEK[@course.weekdays.index(\'1\')]\n  end\n\n  def weeks_from_start\n    return @weeks_from_start unless @weeks_from_start.nil?\n    weeks_from_start = (@week.order - 1).to_i\n    weeks_from_start += meetings_manager.blackout_weeks_prior_to(@week)\n    @weeks_from_start = weeks_from_start\n    @weeks_from_start\n  end\n\n  def meetings_manager\n    @meetings_manager ||= @course.meetings_manager\n  end\nend\n', 'message': 'Remove dead code\n', 'author_name': 'Sage Ross', 'lang': 'rb'}