<commit_before>
<%=define_grid @time_report_grid_monthly, hide_submit_button: true, hide_csv_button: false, hide_reset_button: true do |e|

  e.column name: 'Month', html: {style: 'text-align: center'} do |t|
    #t.week
    Time.at(t.check_in_time).strftime("%B")
    end

  e.column name: l(:field_user_id), html: {style: 'text-align: center'}, 
    :attribute => 'user_id',
    detach_with_id: 'user_filter' ,
    custom_filter: User.active.collect{|u|[u.name, u.id]}  do |t|
    t.user.name unless t.user.nil? 
    end


  e.column name: 'Total Time Checked', html: {style: 'text-align: center'}   do |t|
    unless t.time_spent.nil?
      logger.debug("TIMECHECKEDMONTH: #{t.time_spent}")
      hours = t.time_spent / 60.0 / 60.0
      hours.round(1)
    end
  end

  e.column name: 'Total Time Logged', html: {style: 'text-align: center'}   do |t|
    
    @time_spent_this_month = TimeEntry.where(['user_id = ? and spent_on between date(?) and date(?)', t.user_id,Date.today.beginning_of_month,Date.today.end_of_month]).sum(:hours)
      logger.debug("TIMELOGGEDMONTH: #{@time_spent_this_month.inspect}")
    unless @time_spent_this_month.nil?
      @time_spent_this_month.round(2)
    end
  end

end %><commit_msg>Fix bug in monthly where it always assumes today...facepalm<commit_after>
<%=define_grid @time_report_grid_monthly, hide_submit_button: true, hide_csv_button: false, hide_reset_button: true do |e|

  e.column name: 'Month', html: {style: 'text-align: center'} do |t|
    #t.week
    Time.at(t.check_in_time).strftime("%B")
    end

  e.column name: l(:field_user_id), html: {style: 'text-align: center'}, 
    :attribute => 'user_id',
    detach_with_id: 'user_filter' ,
    custom_filter: User.active.collect{|u|[u.name, u.id]}  do |t|
    t.user.name unless t.user.nil? 
    end


  e.column name: 'Total Time Checked', html: {style: 'text-align: center'}   do |t|
    unless t.time_spent.nil?
      logger.debug("TIMECHECKEDMONTH: #{t.time_spent}")
      hours = t.time_spent / 60.0 / 60.0
      hours.round(1)
    end
  end

  e.column name: 'Total Time Logged', html: {style: 'text-align: center'}   do |t|
    
    @time_spent_this_month = TimeEntry.where(['user_id = ? and spent_on between date(?) and date(?)', t.user_id,Date.parse(t.check_in_time.to_s).beginning_of_month,Date.parse(t.check_in_time.to_s).end_of_month]).sum(:hours)
      logger.debug("TIMELOGGEDMONTH: #{@time_spent_this_month.inspect}")
    unless @time_spent_this_month.nil?
      @time_spent_this_month.round(2)
    end
  end

end %>
{'fraction_non_alphanumeric': 0.15193370165745856, 'fraction_numerical': 0.006314127861089187, 'mean_word_length': 3.8377862595419847, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '3138263', 'n_tokens_mistral': 994, 'n_tokens_neox': 968, 'n_words': 194}