<commit_before><!DOCTYPE html>
<html lang="en">
<head>
<title><%= trello.organization_name %> Releases Overview</title>
<script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js?ver=3.8.1'></script>
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" type="text/css" rel="stylesheet" media="screen">
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>
<link href='https://fonts.googleapis.com/css?family=Open+Sans:400,300,600,800,700' rel='stylesheet' type='text/css'>
<link href="stylesheets/trello.css" rel="stylesheet" type="text/css">
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
<meta name="viewport" content="width=device-width">
<style type="text/css">

.table>tbody>tr.in-progress>th {
  background-color: #94cc75;
  border-top: 1px solid #94cc75;
}
.table>tbody>tr.next>th {
  background-color: #c4e3b3;
  border-top: 1px solid #c4e3b3;
}
.table>tbody>tr.backlog>th {
  background-color: #dbedfe;
  border-top: 1px solid #dbedfe;
}
.table.table-rows>tbody>tr>th,
.table.table-rows>tbody>tr>td {
  padding: 15px;
}

</style>

</head>

<body>
  <div class="navbar navbar-default navbar-fixed-top" role="navigation">
      <div class="container">
        <div class="navbar-header">
          <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
          <div class="brand" style="background: transparent url('<%=trello.logo%>') no-repeat left -5px; background-size: 200px auto">
          </div>
        </div>
        <div class="navbar-collapse collapse">
          <ul class="nav navbar-nav">
              <% LINKS.each do |page_name, page_title|
                if page_name != 'releases_overview' %>
                  <li><a href='<%=page_name%>.html'><%=page_title%></a></li>
                <%else%>
                  <li><a class="active" href='<%=page_name%>.html'><%=page_title%></a></li>
                <%end
                end%>
          </ul>
        </div><!--/.nav-collapse -->
      </div>
    </div>

  <div class="container">

    <h2 class="visible-xs"><%= trello.organization_name %> Releases Overview</h2>

<%
      release_data = {}
      releases = []
      search_list_info = []
      trello.teams.keys.map{ |team_name| team_name.to_s }.each do |team_name|
        trello.team_boards(team_name).each do |board|
          trello.board_lists(board).each do |list|
            search_list_info << [team_name, board, list]
          end
        end
      end

      trello.roadmap_boards.each do |board|
        trello.board_lists(board).each do |list|
          if list.name == 'New'
            search_list_info << ['roadmap', board, list]
            break
          end
        end
      end

      search_list_info.each do |list_info|
        team_name = list_info[0]
        board = list_info[1]
        list = list_info[2]
        list_name = list.name
        complete = false
        status = 'Planned'
        pos_adjustment = TrelloHelper::LIST_POSITION_ADJUSTMENT[list_name]
        if list_name == 'Accepted' || list_name =~ /^Sprint \d+/
          pos_adjustment = 0
          status = 'Complete'
          complete = true
        elsif list_name == 'In Progress' || list_name == 'Complete'
          status = 'In Progress'
        else
          pos_adjustment = TrelloHelper::MAX_LIST_POSITION_ADJUSTMENT
        end
        cards = trello.list_cards(list)
        cards.each_with_index do |card, index|
          labels = trello.card_labels(card)
          label_names = labels.map{ |label| label.name }
          label_names.each do |label_name|
            if label_name =~ RELEASE_LABEL_REGEX
              state = $1
              release = $2
              major = $3.to_i
              minor = $5.to_i
              patch = $7.to_i
              orig_state = state
              if complete
                state = 'committed'
              end
              pos = index + pos_adjustment
              releases << [release, major, minor, patch] unless release_data[release]
              release_data[release] = {} unless release_data[release]
              release_data[release][state] = [] unless release_data[release][state]
              release_data[release][state] << [card, status, board, team_name, orig_state, pos]
            end
          end
        end
      end

      tag_to_epics = trello.tag_to_epics

      releases.sort_by!{ |release| [release[1], release[2], release[3]] }

      state_titles = {
        'committed' => "Committed in plan to be delivered and/or already complete",
        'targeted' => "Targeted to be delivered but not yet committed",
        'proposed' => "Proposed to be delivered and awaiting approval",
      }
%>
<h2>Table of Contents</h2>
<ul>
<%
      releases.each do |release|
        release_name = release[0]
%>
  <li><a href='#<%=release_name%>'><%=release_name%></a></li>
  <ul>
<%
        states = release_data[release_name]
        ['committed', 'targeted', 'proposed'].each do |state|
          release_cards = states[state]
          next unless release_cards
%>
    <li><a href='#<%="#{state}-#{release_name}"%>'><%=TrelloHelper::RELEASE_STATE_DISPLAY_NAME[state]%></a> (<%=release_cards.length%> cards)</li>
    <ul>
<%
          previous_team_name = nil
          release_cards.each do |release_card|
            team_name = release_card[3]
            if previous_team_name != team_name
              previous_team_name = team_name
%>
      <li><a href='#<%="#{state}-#{release_name}-#{team_name}"%>'><%=team_name.upcase%></a></li>
<%
            end
          end
%>
    </ul>
<%
        end
%>
  </ul>
<%
      end
%>
</ul>
<br />
<hr>
<%
      releases.each do |release|
        release_name = release[0]
        release_complete_sizing_total = 0
        release_remaining_sizing_total = 0
        team_complete_sizing_totals = {}
        team_remaining_sizing_totals = {}
%>
<h2 class="anchor" id="<%=release_name%>"><%=release_name.upcase%></h2>
<div class="container">
<%
        states = release_data[release_name]
        ['committed', 'targeted', 'proposed'].each do |state|
          release_cards = states[state]
          next unless release_cards

          state_complete_sizing_total = 0
          state_remaining_sizing_total = 0
          sorted_by_title = nil
          position_title = nil
          if state == 'committed'
            release_cards.sort_by! {|release_card| [release_card[1], release_card[3], release_card[5]]}
            sorted_by_title = '(sorted by status, team, position)'
            position_title = 'Team Position Within Status'
          else
            release_cards.sort_by! {|release_card| [release_card[3], release_card[5]]}
            sorted_by_title = '(sorted by team, position)'
            position_title = 'Team Position'
          end
%>
<h5 title="<%="#{state_titles[state]} #{sorted_by_title}"%>" class="anchor" id="<%="#{state}-#{release_name}"%>"><%=TrelloHelper::RELEASE_STATE_DISPLAY_NAME[state]%> (<%=release_name%>)<span class="pficon-help"></span></h5>
<div class="container">
<div class="table-responsive">
<table class="table table-normal table-condensed">
  <tr><th title="Card Name">Scenario</th><th title="<%=position_title%>">Position<span class="pficon-help"></span></th><th title="Corresponding Board">Board</th><th title="Planned, In Progress, or Complete">Status<span class="pficon-help"></span></th><th title="Associated Epics">Epic(s)</th><th title="Sizing in Story Points (Team Rolling Total)">Sizing<span class="pficon-help"></span></th></tr>
<%
          previous_team_name = nil
          team_positions = {}
          team_sizing_totals = {}
          release_cards.each do |release_card|
            card = release_card[0]
            status = release_card[1]
            board = release_card[2]
            team_name = release_card[3]
            orig_state = release_card[4]
            if previous_team_name != team_name
              team_positions[team_name] = 0 unless team_positions[team_name]
              team_sizing_totals[team_name] = 0 unless team_sizing_totals[team_name]
              previous_team_name = team_name
            end
            team_positions[team_name] += 1
            labels = trello.card_labels(card)
            label_names = labels.map{ |label| label.name }
            epics = []
            label_names.each do |label_name|
              if label_name.start_with? 'epic-'
                epic_card = nil
                if tag_to_epics[label_name]
                  epic_card = tag_to_epics[label_name].first
                end
                epics << [label_name[5..-1], epic_card ? epic_card.url : nil]
              end
            end
            name = card.name.strip
            sizing = nil
            team_complete_sizing_totals[team_name] = 0 unless team_complete_sizing_totals[team_name]
            team_remaining_sizing_totals[team_name] = 0 unless team_remaining_sizing_totals[team_name]
            if name =~ /\((\d+|\?)\)(.*)/
              sizing = $1.to_i
              team_sizing_totals[team_name] += sizing
              name = $2
              if status == 'Complete'
                state_complete_sizing_total += sizing
                team_complete_sizing_totals[team_name] += sizing
              else
                state_remaining_sizing_total += sizing
                team_remaining_sizing_totals[team_name] += sizing
              end
            end
%>
<tr>
<td><div class="anchor" id="<%="#{state}-#{release_name}-#{team_name}"%>"><a href='<%=card.url%>'><%=name%></a></div></td>
<td title="<%=position_title%>"><%=team_positions[team_name]%></td>
<td><a href='<%=board.url%>'><%=board.name%></a></td>
<td title="Plan State: <%=orig_state%>"><%=status%></td>
<td><%epics.each_with_index do |epic, index|
        separator = (index == epics.length - 1) ? '' : ', '
        if epic[1]
%>
<a href='<%=epic[1]%>'><%=epic[0]%></a><%=separator%>
<%
        else
%>
<%="#{epic[0]}#{separator}"%>
<%
        end
%>
<%end%></td>
<td title="Sizing in Story Points (Team Rolling Total)" nowrap><%=sizing ? "#{sizing} (#{team_sizing_totals[team_name]})" : ''%></td>
</tr>
<%
          end

          release_complete_sizing_total += state_complete_sizing_total
          release_remaining_sizing_total += state_remaining_sizing_total
          completed_details = nil
          if state == 'committed'
            completed_details = "Completed Points (#{state}): #{state_complete_sizing_total} of #{state_complete_sizing_total + state_remaining_sizing_total}"
          else
            completed_details = "Total Points (#{state}): #{state_remaining_sizing_total}"
          end
%>
</table>
<i><%=completed_details%></i><br />
<br />
<br />
</div>
</div>
<%
        end
%>
<h4 class="anchor" id="<%=release_name%>_completed_points"><a href="#<%=release_name%>_completed_points" title="Link to this section"><%=release_name%> Completed Points:</a></h4>
<div class="container">
<%
        team_complete_sizing_totals.each do |team_name, complete_sizing|
%>
<%=team_name.upcase%>: <%="#{complete_sizing} of #{complete_sizing + team_remaining_sizing_totals[team_name]}"%><br />
<%
        end
%>
<strong>Total: <%="#{release_complete_sizing_total} of #{release_complete_sizing_total + release_remaining_sizing_total}"%></strong><br />
</div>
</div>
<br />
<br />
<%

      end
%>


  </div><!-- /container -->
</body>
</html>
<commit_msg>Fix pos adjustment<commit_after><!DOCTYPE html>
<html lang="en">
<head>
<title><%= trello.organization_name %> Releases Overview</title>
<script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js?ver=3.8.1'></script>
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" type="text/css" rel="stylesheet" media="screen">
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>
<link href='https://fonts.googleapis.com/css?family=Open+Sans:400,300,600,800,700' rel='stylesheet' type='text/css'>
<link href="stylesheets/trello.css" rel="stylesheet" type="text/css">
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
<meta name="viewport" content="width=device-width">
<style type="text/css">

.table>tbody>tr.in-progress>th {
  background-color: #94cc75;
  border-top: 1px solid #94cc75;
}
.table>tbody>tr.next>th {
  background-color: #c4e3b3;
  border-top: 1px solid #c4e3b3;
}
.table>tbody>tr.backlog>th {
  background-color: #dbedfe;
  border-top: 1px solid #dbedfe;
}
.table.table-rows>tbody>tr>th,
.table.table-rows>tbody>tr>td {
  padding: 15px;
}

</style>

</head>

<body>
  <div class="navbar navbar-default navbar-fixed-top" role="navigation">
      <div class="container">
        <div class="navbar-header">
          <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
          <div class="brand" style="background: transparent url('<%=trello.logo%>') no-repeat left -5px; background-size: 200px auto">
          </div>
        </div>
        <div class="navbar-collapse collapse">
          <ul class="nav navbar-nav">
              <% LINKS.each do |page_name, page_title|
                if page_name != 'releases_overview' %>
                  <li><a href='<%=page_name%>.html'><%=page_title%></a></li>
                <%else%>
                  <li><a class="active" href='<%=page_name%>.html'><%=page_title%></a></li>
                <%end
                end%>
          </ul>
        </div><!--/.nav-collapse -->
      </div>
    </div>

  <div class="container">

    <h2 class="visible-xs"><%= trello.organization_name %> Releases Overview</h2>

<%
      release_data = {}
      releases = []
      search_list_info = []
      trello.teams.keys.map{ |team_name| team_name.to_s }.each do |team_name|
        trello.team_boards(team_name).each do |board|
          trello.board_lists(board).each do |list|
            search_list_info << [team_name, board, list]
          end
        end
      end

      trello.roadmap_boards.each do |board|
        trello.board_lists(board).each do |list|
          if list.name == 'New'
            search_list_info << ['roadmap', board, list]
            break
          end
        end
      end

      search_list_info.each do |list_info|
        team_name = list_info[0]
        board = list_info[1]
        list = list_info[2]
        list_name = list.name
        complete = false
        status = 'Planned'
        pos_adjustment = TrelloHelper::LIST_POSITION_ADJUSTMENT[list_name]
        if list_name == 'Accepted' || list_name =~ /^Sprint \d+/
          pos_adjustment = 0
          status = 'Complete'
          complete = true
        elsif list_name == 'In Progress' || list_name == 'Complete'
          status = 'In Progress'
        end
        pos_adjustment = TrelloHelper::MAX_LIST_POSITION_ADJUSTMENT unless pos_adjustment
        cards = trello.list_cards(list)
        cards.each_with_index do |card, index|
          labels = trello.card_labels(card)
          label_names = labels.map{ |label| label.name }
          label_names.each do |label_name|
            if label_name =~ RELEASE_LABEL_REGEX
              state = $1
              release = $2
              major = $3.to_i
              minor = $5.to_i
              patch = $7.to_i
              orig_state = state
              if complete
                state = 'committed'
              end
              pos = index + pos_adjustment
              releases << [release, major, minor, patch] unless release_data[release]
              release_data[release] = {} unless release_data[release]
              release_data[release][state] = [] unless release_data[release][state]
              release_data[release][state] << [card, status, board, team_name, orig_state, pos]
            end
          end
        end
      end

      tag_to_epics = trello.tag_to_epics

      releases.sort_by!{ |release| [release[1], release[2], release[3]] }

      state_titles = {
        'committed' => "Committed in plan to be delivered and/or already complete",
        'targeted' => "Targeted to be delivered but not yet committed",
        'proposed' => "Proposed to be delivered and awaiting approval",
      }
%>
<h2>Table of Contents</h2>
<ul>
<%
      releases.each do |release|
        release_name = release[0]
%>
  <li><a href='#<%=release_name%>'><%=release_name%></a></li>
  <ul>
<%
        states = release_data[release_name]
        ['committed', 'targeted', 'proposed'].each do |state|
          release_cards = states[state]
          next unless release_cards
%>
    <li><a href='#<%="#{state}-#{release_name}"%>'><%=TrelloHelper::RELEASE_STATE_DISPLAY_NAME[state]%></a> (<%=release_cards.length%> cards)</li>
    <ul>
<%
          previous_team_name = nil
          release_cards.each do |release_card|
            team_name = release_card[3]
            if previous_team_name != team_name
              previous_team_name = team_name
%>
      <li><a href='#<%="#{state}-#{release_name}-#{team_name}"%>'><%=team_name.upcase%></a></li>
<%
            end
          end
%>
    </ul>
<%
        end
%>
  </ul>
<%
      end
%>
</ul>
<br />
<hr>
<%
      releases.each do |release|
        release_name = release[0]
        release_complete_sizing_total = 0
        release_remaining_sizing_total = 0
        team_complete_sizing_totals = {}
        team_remaining_sizing_totals = {}
%>
<h2 class="anchor" id="<%=release_name%>"><%=release_name.upcase%></h2>
<div class="container">
<%
        states = release_data[release_name]
        ['committed', 'targeted', 'proposed'].each do |state|
          release_cards = states[state]
          next unless release_cards

          state_complete_sizing_total = 0
          state_remaining_sizing_total = 0
          sorted_by_title = nil
          position_title = nil
          if state == 'committed'
            release_cards.sort_by! {|release_card| [release_card[1], release_card[3], release_card[5]]}
            sorted_by_title = '(sorted by status, team, position)'
            position_title = 'Team Position Within Status'
          else
            release_cards.sort_by! {|release_card| [release_card[3], release_card[5]]}
            sorted_by_title = '(sorted by team, position)'
            position_title = 'Team Position'
          end
%>
<h5 title="<%="#{state_titles[state]} #{sorted_by_title}"%>" class="anchor" id="<%="#{state}-#{release_name}"%>"><%=TrelloHelper::RELEASE_STATE_DISPLAY_NAME[state]%> (<%=release_name%>)<span class="pficon-help"></span></h5>
<div class="container">
<div class="table-responsive">
<table class="table table-normal table-condensed">
  <tr><th title="Card Name">Scenario</th><th title="<%=position_title%>">Position<span class="pficon-help"></span></th><th title="Corresponding Board">Board</th><th title="Planned, In Progress, or Complete">Status<span class="pficon-help"></span></th><th title="Associated Epics">Epic(s)</th><th title="Sizing in Story Points (Team Rolling Total)">Sizing<span class="pficon-help"></span></th></tr>
<%
          previous_team_name = nil
          team_positions = {}
          team_sizing_totals = {}
          release_cards.each do |release_card|
            card = release_card[0]
            status = release_card[1]
            board = release_card[2]
            team_name = release_card[3]
            orig_state = release_card[4]
            if previous_team_name != team_name
              team_positions[team_name] = 0 unless team_positions[team_name]
              team_sizing_totals[team_name] = 0 unless team_sizing_totals[team_name]
              previous_team_name = team_name
            end
            team_positions[team_name] += 1
            labels = trello.card_labels(card)
            label_names = labels.map{ |label| label.name }
            epics = []
            label_names.each do |label_name|
              if label_name.start_with? 'epic-'
                epic_card = nil
                if tag_to_epics[label_name]
                  epic_card = tag_to_epics[label_name].first
                end
                epics << [label_name[5..-1], epic_card ? epic_card.url : nil]
              end
            end
            name = card.name.strip
            sizing = nil
            team_complete_sizing_totals[team_name] = 0 unless team_complete_sizing_totals[team_name]
            team_remaining_sizing_totals[team_name] = 0 unless team_remaining_sizing_totals[team_name]
            if name =~ /\((\d+|\?)\)(.*)/
              sizing = $1.to_i
              team_sizing_totals[team_name] += sizing
              name = $2
              if status == 'Complete'
                state_complete_sizing_total += sizing
                team_complete_sizing_totals[team_name] += sizing
              else
                state_remaining_sizing_total += sizing
                team_remaining_sizing_totals[team_name] += sizing
              end
            end
%>
<tr>
<td><div class="anchor" id="<%="#{state}-#{release_name}-#{team_name}"%>"><a href='<%=card.url%>'><%=name%></a></div></td>
<td title="<%=position_title%>"><%=team_positions[team_name]%></td>
<td><a href='<%=board.url%>'><%=board.name%></a></td>
<td title="Plan State: <%=orig_state%>"><%=status%></td>
<td><%epics.each_with_index do |epic, index|
        separator = (index == epics.length - 1) ? '' : ', '
        if epic[1]
%>
<a href='<%=epic[1]%>'><%=epic[0]%></a><%=separator%>
<%
        else
%>
<%="#{epic[0]}#{separator}"%>
<%
        end
%>
<%end%></td>
<td title="Sizing in Story Points (Team Rolling Total)" nowrap><%=sizing ? "#{sizing} (#{team_sizing_totals[team_name]})" : ''%></td>
</tr>
<%
          end

          release_complete_sizing_total += state_complete_sizing_total
          release_remaining_sizing_total += state_remaining_sizing_total
          completed_details = nil
          if state == 'committed'
            completed_details = "Completed Points (#{state}): #{state_complete_sizing_total} of #{state_complete_sizing_total + state_remaining_sizing_total}"
          else
            completed_details = "Total Points (#{state}): #{state_remaining_sizing_total}"
          end
%>
</table>
<i><%=completed_details%></i><br />
<br />
<br />
</div>
</div>
<%
        end
%>
<h4 class="anchor" id="<%=release_name%>_completed_points"><a href="#<%=release_name%>_completed_points" title="Link to this section"><%=release_name%> Completed Points:</a></h4>
<div class="container">
<%
        team_complete_sizing_totals.each do |team_name, complete_sizing|
%>
<%=team_name.upcase%>: <%="#{complete_sizing} of #{complete_sizing + team_remaining_sizing_totals[team_name]}"%><br />
<%
        end
%>
<strong>Total: <%="#{release_complete_sizing_total} of #{release_complete_sizing_total + release_remaining_sizing_total}"%></strong><br />
</div>
</div>
<br />
<br />
<%

      end
%>


  </div><!-- /container -->
</body>
</html>

{'fraction_non_alphanumeric': 0.1549970077797726, 'fraction_numerical': 0.008805676669231427, 'mean_word_length': 2.6520449578520138, 'pattern_counts': {'":': 0, '<': 453, '<?xml version=': 0, '>': 469, 'https://': 8, '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': '2991492', 'n_tokens_mistral': 7900, 'n_tokens_neox': 7530, 'n_words': 1355}