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

class TrainingModulePresenter
  attr_reader :training_module, :progress_manager

  def initialize(user, mod_params)
    @user = user
    @params = mod_params
    @training_module = TrainingModule.find_by(slug: @params[:module_id])
    @training_library = TrainingLibrary.find_by(slug: @params[:library_id])
    @progress_manager = TrainingProgressManager.new(@user, @training_module)
    @routes = Rails.application.routes.url_helpers
  end

  def cta_button_text
    return I18n.t('training.start') unless progress_manager.module_progress.present?
    if progress_manager.module_completed?
      I18n.t('training.view')
    else
      I18n.t('training.continue', progress: progress_manager.module_progress)
    end
  end

  def cta_button_link
    first_element = @routes.training_module_path(@params[:library_id], @params[:module_id])
    last_element = if @progress_manager.module_completed? || @progress_manager.module_progress.nil?
                     @training_module.slides.first&.slug
                   else
                     last_slide_completed
                   end
    [first_element, last_element].join('/')
  end

  def cta_button_classes
  end

  def should_show_ttc?
    training_modules_user.nil? || @progress_manager.module_completed?
  end


  private

  def training_modules_user
    return unless @user
    TrainingModulesUsers.find_by(
      user_id: @user.id,
      training_module_id: @training_module.id
    )
  end

  def last_slide_completed
    return unless @user
    training_modules_user.last_slide_completed
  end
end

<MSG> Hide 'estimated time' if module has no value for it

<DFF> @@ -35,6 +35,7 @@ class TrainingModulePresenter
   end
 
   def should_show_ttc?
+    return false unless @training_module.estimated_ttc
     training_modules_user.nil? || @progress_manager.module_completed?
   end
 

{'commit': 'diff --git a/app/presenters/training_module_presenter.rb b/app/presenters/training_module_presenter.rb\nindex b24356f36..ffccff4aa 100644\n--- a/app/presenters/training_module_presenter.rb\n+++ b/app/presenters/training_module_presenter.rb\n@@ -35,6 +35,7 @@ class TrainingModulePresenter\n   end\n \n   def should_show_ttc?\n+    return false unless @training_module.estimated_ttc\n     training_modules_user.nil? || @progress_manager.module_completed?\n   end\n \n', 'commit_subject': "Hide 'estimated time' if module has no value for it", 'repo_name': 'WikiEducationFoundation/WikiEduDashboard', 'committer': {'name': 'Sage Ross', 'email': '6dd34506bbd5e58221bbb3e4732d97c91f02277b@ragesoss.com', 'time_sec': '1486588056', 'tz_offset': '-480', 'date': {'seconds': '1486588056'}}, 'commit_tree': '5816a69163ea2e40f9d229b1e8549f83ab4fbf7e', 'commit_message': "Hide 'estimated time' if module has no value for it\n", 'language_name': 'Python', 'license': 'mit', 'hunks': '@@ -35,6 +35,7 @@ class TrainingModulePresenter\n   end\n \n   def should_show_ttc?\n+    return false unless @training_module.estimated_ttc\n     training_modules_user.nil? || @progress_manager.module_completed?\n   end\n \n', 'addition_count': 1, 'deletion_count': 0, 'src_file': 'a/app/presenters/training_module_presenter.rb', 'tgt_file': 'b/app/presenters/training_module_presenter.rb', 'file_extension': '.rb', 'before_file': "# frozen_string_literal: true\n\nclass TrainingModulePresenter\n  attr_reader :training_module, :progress_manager\n\n  def initialize(user, mod_params)\n    @user = user\n    @params = mod_params\n    @training_module = TrainingModule.find_by(slug: @params[:module_id])\n    @training_library = TrainingLibrary.find_by(slug: @params[:library_id])\n    @progress_manager = TrainingProgressManager.new(@user, @training_module)\n    @routes = Rails.application.routes.url_helpers\n  end\n\n  def cta_button_text\n    return I18n.t('training.start') unless progress_manager.module_progress.present?\n    if progress_manager.module_completed?\n      I18n.t('training.view')\n    else\n      I18n.t('training.continue', progress: progress_manager.module_progress)\n    end\n  end\n\n  def cta_button_link\n    first_element = @routes.training_module_path(@params[:library_id], @params[:module_id])\n    last_element = if @progress_manager.module_completed? || @progress_manager.module_progress.nil?\n                     @training_module.slides.first&.slug\n                   else\n                     last_slide_completed\n                   end\n    [first_element, last_element].join('/')\n  end\n\n  def cta_button_classes\n  end\n\n  def should_show_ttc?\n    training_modules_user.nil? || @progress_manager.module_completed?\n  end\n\n\n  private\n\n  def training_modules_user\n    return unless @user\n    TrainingModulesUsers.find_by(\n      user_id: @user.id,\n      training_module_id: @training_module.id\n    )\n  end\n\n  def last_slide_completed\n    return unless @user\n    training_modules_user.last_slide_completed\n  end\nend\n", 'message': "Hide 'estimated time' if module has no value for it\n", 'author_name': 'Sage Ross', 'lang': 'rb'}