Rename work dates to planned dates
This commit is contained in:
parent
991396f68c
commit
e236a1bdac
@ -2,7 +2,7 @@ require "./spec_helper"
|
|||||||
|
|
||||||
describe Dayoff do
|
describe Dayoff do
|
||||||
it "can calc work hours" do
|
it "can calc work hours" do
|
||||||
app = Dayoff::App.new("./spec/data/work-dates.json")
|
app = Dayoff::App.new("./spec/data/planned-dates.json")
|
||||||
app.get_work_hours.should eq 20
|
app.get_work_hours.should eq 20
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -3,7 +3,7 @@ require "json"
|
|||||||
module Dayoff
|
module Dayoff
|
||||||
VERSION = "0.1.0"
|
VERSION = "0.1.0"
|
||||||
|
|
||||||
class WorkDate
|
class PlannedDate
|
||||||
JSON.mapping(
|
JSON.mapping(
|
||||||
date: String,
|
date: String,
|
||||||
hours: Int32,
|
hours: Int32,
|
||||||
@ -11,16 +11,16 @@ module Dayoff
|
|||||||
end
|
end
|
||||||
|
|
||||||
class App
|
class App
|
||||||
def initialize(wh_path)
|
def initialize(pddates_path)
|
||||||
content = File.open(wh_path) do |file|
|
content = File.open(pddates_path) do |file|
|
||||||
file.gets_to_end
|
file.gets_to_end
|
||||||
end
|
end
|
||||||
@wdates = Array(WorkDate).from_json(content)
|
@pdates = Array(PlannedDate).from_json(content)
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_work_hours
|
def get_work_hours
|
||||||
sum = 0
|
sum = 0
|
||||||
@wdates.each do |wd|
|
@pdates.each do |wd|
|
||||||
sum += wd.hours
|
sum += wd.hours
|
||||||
end
|
end
|
||||||
sum
|
sum
|
||||||
|
Loading…
Reference in New Issue
Block a user