<commit_before>.row
    .col-md-12
        %h3
            %span= emojify @card.icon
            = @card.name
            .btn-group.pull-right
                = link_to new_punchcard_record_path(@card), class: 'btn btn-sm btn-default' do
                    %i.fa.fa-calendar-check-o
                    Punch
                    
                = link_to [:edit, @card], class: 'btn btn-sm btn-default' do
                    %i.fa.fa-pencil
                    
                = link_to punchcard_path, method: :delete, data: { confirm: 'Are you sure?' }, class: 'btn btn-sm btn-danger' do
                    %i.fa.fa-trash

        /%p.text-center= auto_link(@card.description)

        // INSERT CAL HEAT MAP
        .row
            .col-md-12
                .panel.panel-default
                    .panel-body
                        .row
                            .col-md-6.col-md-offset-1
                                #cal-heatmap{ "data-id" => "#{@card.id}" }
                                    :javascript
                                        /* Get the corresponding Punchcard ID */
                                        var punchcard_id = $("#cal-heatmap").attr('data-id');
                                        
                                        /* Construct a REST path for this punchcard */
                                        var path = Routes.punchcard_records_path(punchcard_id, {format: 'json'});
                                        
                                        var cal = new CalHeatMap();
                                        cal.init({
                                            data: path,
                                            start: new Date().setMonth(new Date().getMonth() - 6),
                                            minDate: new Date().setMonth(new Date().getMonth() - 6),
                                            maxDate: new Date(),
                                            domain: "month",
                                            subDomain: "day",
                                            itemName: ["hour", "hours"],
                                            cellSize: 12,
                                            range: 7,
                                            rowLimit: 7,
                                            highlight: "now",
                                            legendVerticalPosition: "bottom",
                                            legendHorizontalPosition: "right",
                                            tooltip: true,
                                            weekStartOnMonday: false,
                                            domainLabelFormat: "%b",
                                            label: {
                                                position: "top"
                                            },
                                            legend: [1, 3, 5],
                                            
                                            onClick: function(date, nb) {
                                        		// Parse the date for ActiveRecord
                                        		date = moment(date).format('YYYY-MM-DD HH:mm:ss');
                                    
                                        		/* Make an AJAX Call to retrieve the ActiveRecord Record object
                                        		   associated with the date of the cell */
                                        		if ( nb != null ) {
                                        		    $.ajax({
                                                        url: '/search_record',
                                                        data: {record_date: date, pcard_id: punchcard_id},
                                                        dataType: 'json'
                                                    }).done(function (data) {
                                                        // Redirect to the obtained record show view
                                                        var record_id = data
                                                        window.location.href = Routes.punchcard_record_path(punchcard_id, record_id)
                                                    });
                                        		}
                                        	}
                                        });
                        
                        // STATS
                        .row.cal-footer
                            .col-md-6.cal-footer-column
                                - unless @card.records.first.nil?
                                    .text-center
                                        %h5
                                            %small Total Hours
                                        
                                        %big.lead
                                            = @card.total_hours
                                            hours
                                            
                                        %h5
                                            %small
                                                = @card.records.first.created_at.strftime("%B %d %Y")
                                                –
                                                = Time.current.strftime("%B %d %Y")
                                    
                            .col-md-6
                                - unless @card.records.first.nil?
                                    .text-center
                                        %h5
                                            %small Total Entries
                                        
                                        %big.lead
                                            = @card.records.count
                                            entries
                                            
                                        %h5
                                            %small
                                                = @card.records.first.created_at.strftime("%B %d %Y")
                                                –
                                                = Time.current.strftime("%B %d %Y")
                        
        %hr
        
        #record_area
            %h3 Latest Entries
            
            .text-center
                %p.small
                    = link_to punchcard_records_path(@card) do
                        %i.fa.fa-eye
                        View All Entries
            
            %ul.list-group
                - @records.each do |record|
                    %li.list-group-item
                        %h4.list-group-item-heading
                            = link_to record.date.strftime("%A %B %d %Y"), [@card, record]
                            %span.badge
                                %i.fa.fa-clock-o
                                = record.hours
                                
                            
                            .btn-group.pull-right
                                = link_to [:edit, @card, record], class: 'btn btn-xs btn-default' do
                                    %i.fa.fa-pencil
                                = link_to [@card, record], method: :delete, data: { confirm: 'Are you sure?' }, class: 'btn btn-xs btn-danger' do
                                    %i.fa.fa-trash
                        
                        .list-group-item-text
                            = record.description.html_safe<commit_msg>Change tabs to 2 spaces and re-work view<commit_after>.row
  .col-md-12
    %h3
      %span= emojify @card.icon
      = @card.name
      .btn-group.pull-right
        = link_to new_punchcard_record_path(@card), class: 'btn btn-sm btn-default' do
          %i.fa.fa-calendar-check-o
          Punch

        = link_to [:edit, @card], class: 'btn btn-sm btn-default' do
          %i.fa.fa-pencil

        = link_to punchcard_path, method: :delete, data: { confirm: 'Are you sure?' }, class: 'btn btn-sm btn-danger' do
          %i.fa.fa-trash

    /%p.text-center= auto_link(@card.description)

    // CalHeatMap
    .row
      .col-md-12
        .panel.panel-default
          .panel-body
            .row
              .col-md-6.col-md-offset-1
                #cal-heatmap{ "data-id" => "#{@card.id}" }

            // STATS
            .row.cal-footer
              .col-md-6.cal-footer-column
                - unless @card.records.first.nil?
                  .text-center
                    %h5
                      %small Total Hours
                    %big.lead
                      = @card.total_hours
                      hours
                    %h5
                      %small
                        = @card.records.first.created_at.strftime("%B %d %Y")
                        –
                        = Time.current.strftime("%B %d %Y")
              .col-md-6
                - unless @card.records.first.nil?
                  .text-center
                    %h5
                      %small Total Entries
                    %big.lead
                      = @card.records.count
                      entries
                    %h5
                      %small
                        = @card.records.first.created_at.strftime("%B %d %Y")
                        –
                        = Time.current.strftime("%B %d %Y")

    %hr

    #record_area
      .panel.panel-primary
        .panel-heading Latest Entries
        %ul.list-group
          - @records.each do |record|
            %li.list-group-item
              %h5.list-group-item-heading
                %strong= link_to record.date.strftime("%A %B %d %Y"), [@card, record]
                .pull-right.text-muted
                  %i.fa.fa-clock-o
                  %strong= record.hours

              %p.list-group-item-text= record.description.html_safe

:javascript
  /* Get the corresponding Punchcard ID */
  var punchcard_id = $("#cal-heatmap").attr('data-id');

  /* Construct a REST path for this punchcard */
  var path = Routes.punchcard_records_path(punchcard_id, {format: 'json'});

  var cal = new CalHeatMap();
  cal.init({
    data: path,
    start: new Date().setMonth(new Date().getMonth() - 6),
    minDate: new Date().setMonth(new Date().getMonth() - 6),
    maxDate: new Date(),
    domain: "month",
    subDomain: "day",
    itemName: ["hour", "hours"],
    cellSize: 12,
    range: 7,
    rowLimit: 7,
    highlight: "now",
    legendVerticalPosition: "bottom",
    legendHorizontalPosition: "right",
    tooltip: true,
    weekStartOnMonday: false,
    domainLabelFormat: "%b",
    label: {
      position: "top"
    },
    legend: [1, 3, 5],

    onClick: function(date, nb) {
      // Parse the date for ActiveRecord
      date = moment(date).format('YYYY-MM-DD HH:mm:ss');

      // Retrieve the ActiveRecord Record object associated with the date of the cell
      if ( nb != null ) {
        $.ajax({
          url: '/search_record',
          data: {record_date: date, pcard_id: punchcard_id},
          dataType: 'json'
        }).done(function (data) {
          // Redirect to the obtained record show view
          var record_id = data
          window.location.href = Routes.punchcard_record_path(punchcard_id, record_id)
        });
      }
    }
  });
{'fraction_non_alphanumeric': 0.08885555457513457, 'fraction_numerical': 0.004235418688784964, 'mean_word_length': 0.6984864378840102, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 136, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1201875', 'n_tokens_mistral': 2540, 'n_tokens_neox': 2360, 'n_words': 537}