<commit_before>class Scheduler.ShowSprintView extends Backbone.View
  className: 'hide-completed'
  
  events:
    'click .check-out-button': 'toggleCheckOut'
    'click #show_completed_tickets': 'toggleShowCompleted'
  
  initialize: ->
    @sprintId = @options.sprintId
    @template = HandlebarsTemplates['houston-scheduler/sprints/show']
    
    $.get "/scheduler/sprints/#{@sprintId}", (tickets)=>
      for ticket in tickets
        ticket.checkedOut = ticket.checkedOutBy?
        ticket.checkedOutByMe = ticket.checkedOutBy && ticket.checkedOutBy.id == window.user.id
      @tickets = tickets
      @render()
    
    super
  
  render: ->
    return @ unless @tickets
    html = @template(tickets: @tickets)
    @$el.html html
    
    @renderBurndownChart(@tickets)
    @updateTotalEffort()
    
    @$el.loadTicketDetailsOnClick()
    
    $.tablesorter.addParser
      id: 'integerBlankLast'
      is: (s)-> false # return false so this parser is not auto detected 
      format: (s)->
        s = $.trim(s)
        return Number.POSITIVE_INFINITY if s.length == 0
        +s
      type: 'numeric'
    $('.table-sortable').tablesorter
      headers:
        0:
          sorter: 'integerBlankLast'
    @
  
  
  
  renderBurndownChart: (tickets)->
    
    # Sum progress by day;
    # Find the total amount of effort to accomplish
    progressByDay = {}
    totalEffort = 0
    for ticket in tickets
      effort = +ticket.estimatedEffort
      if ticket.firstReleaseAt
        day = @truncateDate new Date(ticket.firstReleaseAt)
        progressByDay[day] = (progressByDay[day] || 0) + effort
      totalEffort += effort
    
    thisWeek = []
    today = new Date()
    daysSinceMonday = 1 - today.getWeekday() 
    monday = @truncateDate daysSinceMonday.days().after(today)
    days = (i.days().after(monday) for i in [0..4])
    
    # Transform into remaining effort by day:
    # Iterate by day in case there are some days<commit_msg>[skip] Removed trailing whitespace (1m)<commit_after>class Scheduler.ShowSprintView extends Backbone.View
  className: 'hide-completed'
  
  events:
    'click .check-out-button': 'toggleCheckOut'
    'click #show_completed_tickets': 'toggleShowCompleted'
  
  initialize: ->
    @sprintId = @options.sprintId
    @template = HandlebarsTemplates['houston-scheduler/sprints/show']
    
    $.get "/scheduler/sprints/#{@sprintId}", (tickets)=>
      for ticket in tickets
        ticket.checkedOut = ticket.checkedOutBy?
        ticket.checkedOutByMe = ticket.checkedOutBy && ticket.checkedOutBy.id == window.user.id
      @tickets = tickets
      @render()
    
    super
  
  render: ->
    return @ unless @tickets
    html = @template(tickets: @tickets)
    @$el.html html
    
    @renderBurndownChart(@tickets)
    @updateTotalEffort()
    
    @$el.loadTicketDetailsOnClick()
    
    $.tablesorter.addParser
      id: 'integerBlankLast'
      is: (s)-> false # return false so this parser is not auto detected 
      format: (s)->
        s = $.trim(s)
        return Number.POSITIVE_INFINITY if s.length == 0
        +s
      type: 'numeric'
    $('.table-sortable').tablesorter
      headers:
        0:
          sorter: 'integerBlankLast'
    @
  
  
  
  renderBurndownChart: (tickets)->
    
    # Sum progress by day;
    # Find the total amount of effort to accomplish
    progressByDay = {}
    totalEffort = 0
    for ticket in tickets
      effort = +ticket.estimatedEffort
      if ticket.firstReleaseAt
        day = @truncateDate new Date(ticket.firstReleaseAt)
        progressByDay[day] = (progressByDay[day] || 0) + effort
      totalEffort += effort
    
    thisWeek = []
    today = new Date()
    daysSinceMonday = 1 - today.getWeekday()
    monday = @truncateDate daysSinceMonday.days().after(today)
    days = (i.days().after(monday) for i in [0..4])
    
    # Transform into remaining effort by day:
    # Iterate by day in case there are some days
{'fraction_non_alphanumeric': 0.10983981693363844, 'fraction_numerical': 0.0038138825324180014, 'mean_word_length': 2.5959780621572213, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, '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': '2144584', 'n_tokens_mistral': 1271, 'n_tokens_neox': 1227, 'n_words': 293}