<commit_before>module PT
  module Action
    def show_story(story)
      title('========================================='.red)
      title story.name.red
      title('========================================='.red)
      estimation = [-1, nil].include?(story.estimate) ? "Unestimated" : "#{story.estimate} points"
      requester = story.requested_by ? story.requested_by.initials : @local_config[:user_name]
      message "#{story.current_state.capitalize} #{story.story_type} | #{estimation} | Req: #{requester} | Owners: #{story.owners.map(&:initials).join(',')} | ID: #{story.id}"

      if story.labels.present?
        message "Labels: " + story.labels.map(&:name).join(', ')
      end
      message story.description.green unless story.description.nil? || story.description.empty?
      message "View on pivotal: #{story.url}"

      if story.tasks.present?
        title('tasks'.yellow)
        story.tasks.each{ |t| compact_message "- #{t.complete ? "[done]" : ""} #{t.description}" }
      end


      story.comments.each do |n|
        title('......................................'.blue)
        text = ">> #{n.person.initials}: #{n.text}"
        text << "[#{n.file_attachment_ids.size}F]" if n.file_attachment_ids
        message text
      end
      save_recent_task( story.id )
    end

    def tasks_story(story)
      story_task = get_open_story_task_from_params(story)
      if story_task.position == -1
        description = ask('Title for new task')
        story.create_task(:description => description)
        congrats("New todo task added to \"#{story.name}\"")
      else
        edit_story_task story_task
      end
    end

    def open_story story
      `open #{story.url}`
    end

    def assign_story story
      members = @client.get_members
      table = PersonsTable.new(members.map(&:person))
      owner = select("Please select a member to assign him the story", table)

      congrats("story assigned to #{owner.initials}, thanks!")
    end

    def comment_story(story)
      comment = ask("Write your comment")
      if @client.comment_task(story, comment)
        congrats("Comment sent, thanks!")
        save_recent_task( story.id )
      else
        error("Ummm, something went wrong.")
      end
    end

    def label_story(story)
      label = ask("Which label?")
      @client.add_label(story, label );
      show_story(task_by_id_or_pt_id(story.id))
    end

    def estimate_story(story)
      estimation ||= ask("How many points you estimate for it? (#{project.point_scale})")
      @client.estimate_story(story, estimation)
      congrats("Task estimated, thanks!")
    end

    def start_story story
      @client.mark_task_as(story, 'started')
      congrats("story started, go for it!")
    end

    def finish_story story
      if story.story_type == 'chore'
        @client.mark_task_as(story, 'accepted')
      else
        @client.mark_task_as(story, 'finished')
      end
      congrats("Another story bites the dust, yeah!")
    end

    def deliver_story story
      return if story.story_type == 'chore'
      @client.mark_task_as(story, 'delivered')
      congrats("story delivered, congrats!")
    end

    def accept_story story
      @client.mark_task_as(story, 'accepted')
      congrats("Accepted")
    end

    def reject_story(story)
      comment = ask("Please explain why are you rejecting the story.")
      if @client.comment_task(story, comment)
        @client.mark_task_as(story, 'rejected')
        congrats("story rejected, thanks!")
      else
        error("Ummm, something went wrong.")
      end
    end

    def done_story(story)
      #we need this for finding again later
      story_id = story.id

      start_story story

      finish_story story

      deliver_story story
    end

  end
end
<commit_msg>add interactive mode for show story<commit_after>module PT
  module Action
    def show_story(story)
      title('========================================='.red)
      title story.name.red
      title('========================================='.red)
      estimation = [-1, nil].include?(story.estimate) ? "Unestimated" : "#{story.estimate} points"
      requester = story.requested_by ? story.requested_by.initials : @local_config[:user_name]
      message "#{story.current_state.capitalize} #{story.story_type} | #{estimation} | Req: #{requester} | Owners: #{story.owners.map(&:initials).join(',')} | ID: #{story.id}"

      if story.labels.present?
        message "Labels: " + story.labels.map(&:name).join(', ')
      end
      message story.description.green unless story.description.nil? || story.description.empty?
      message "View on pivotal: #{story.url}"

      if story.tasks.present?
        title('tasks'.yellow)
        story.tasks.each{ |t| compact_message "- #{t.complete ? "[done]" : ""} #{t.description}" }
      end


      story.comments.each do |n|
        title('......................................'.blue)
        text = ">> #{n.person.initials}: #{n.text}"
        text << "[#{n.file_attachment_ids.size}F]" if n.file_attachment_ids
        message text
      end
      save_recent_task( story.id )
      say '---------------------------------------------------------'.magenta
      choice = ask "Please choose action ([b]:back to table | [m]:show menu | [q] quit)"
      case choice
      when 'q'
        quit
      when 'm'
        choose_action(story)
      when 'b'
        say('back to table ....')
      end
    end

    def tasks_story(story)
      story_task = get_open_story_task_from_params(story)
      if story_task.position == -1
        description = ask('Title for new task')
        story.create_task(:description => description)
        congrats("New todo task added to \"#{story.name}\"")
      else
        edit_story_task story_task
      end
    end

    def open_story story
      `open #{story.url}`
    end

    def assign_story story
      members = @client.get_members
      table = PersonsTable.new(members.map(&:person))
      owner = select("Please select a member to assign him the story", table)

      congrats("story assigned to #{owner.initials}, thanks!")
    end

    def comment_story(story)
      comment = ask("Write your comment")
      if @client.comment_task(story, comment)
        congrats("Comment sent, thanks!")
        save_recent_task( story.id )
      else
        error("Ummm, something went wrong.")
      end
    end

    def label_story(story)
      label = ask("Which label?")
      @client.add_label(story, label );
      show_story(task_by_id_or_pt_id(story.id))
    end

    def estimate_story(story)
      estimation ||= ask("How many points you estimate for it? (#{project.point_scale})")
      @client.estimate_story(story, estimation)
      congrats("Task estimated, thanks!")
    end

    def start_story story
      @client.mark_task_as(story, 'started')
      congrats("story started, go for it!")
    end

    def finish_story story
      if story.story_type == 'chore'
        @client.mark_task_as(story, 'accepted')
      else
        @client.mark_task_as(story, 'finished')
      end
      congrats("Another story bites the dust, yeah!")
    end

    def deliver_story story
      return if story.story_type == 'chore'
      @client.mark_task_as(story, 'delivered')
      congrats("story delivered, congrats!")
    end

    def accept_story story
      @client.mark_task_as(story, 'accepted')
      congrats("Accepted")
    end

    def reject_story(story)
      comment = ask("Please explain why are you rejecting the story.")
      if @client.comment_task(story, comment)
        @client.mark_task_as(story, 'rejected')
        congrats("story rejected, thanks!")
      else
        error("Ummm, something went wrong.")
      end
    end

    def done_story(story)
      start_story story

      finish_story story

      deliver_story story
    end

  end
end

{'fraction_non_alphanumeric': 0.15396360860160327, 'fraction_numerical': 0.0005089706069474488, 'mean_word_length': 2.5662431941923773, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5766813', 'n_tokens_mistral': 2365, 'n_tokens_neox': 2324, 'n_words': 566}