module PunchStats

Constants

PUNCH_EXECUTABLE
PUNCH_PATH
ROOT
VERSION

Public Class Methods

json_months() click to toggle source
# File lib/punch_stats.rb, line 41
def self.json_months
  months.map do |month|
    hash = {}

    hash[:name] = month.name
    hash[:year] = month.year
    hash[:number] = month.number
    hash[:total] = month.total

    hash[:days] = month.days.map do |day|
      {
        date: day.to_time.to_date,
        total: day.total,
        blocks: day.blocks.map do |b|
          { start: b.start, end: b.finish, total: b.total }
        end
      }
    end

    hash
  end.to_json
end
months() click to toggle source

@return [Array<Month>]

# File lib/punch_stats.rb, line 35
def self.months
  Dir["#{Punch.config.hours_folder}/*.txt"]
    .map { |f| Month.from_file(f) }
    .reject(&:empty?)
end
root() click to toggle source
# File lib/punch_stats.rb, line 26
def self.root
  ROOT
end
ui_dist() click to toggle source
# File lib/punch_stats.rb, line 30
def self.ui_dist
  File.join(ROOT, 'ui/dist')
end