Skip to content

Commit

Permalink
Merge pull request #85 from synyx/reverse_add
Browse files Browse the repository at this point in the history
add, make sure entries get added in order
  • Loading branch information
dgrammlich authored Feb 14, 2022
2 parents ca55bb0 + b2a9f4b commit 144b677
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/buchungsstreber/parser/buch_timesheet.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ def parse
end

def add(entries)
entries.each do |e|
# as entries get added on top, reverse the entries before
entries.reverse.each do |e|
iso_date = e[:date].to_s
days = @model.map
.with_index { |line, idx| [Date.parse($1), idx] if line =~ /^(\d\d\d\d-\d\d-\d\d)/ }
Expand Down
3 changes: 2 additions & 1 deletion lib/buchungsstreber/parser/yaml_timesheet.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ def parse
end

def add(entries)
entries.each do |e|
# as entries get added on top, reverse the entries before
entries.reverse.each do |e|
iso_date = e[:date].to_s
days = @model.map
.with_index { |line, idx| [Date.parse($1), idx] if line =~ /^(\d\d\d\d-\d\d-\d\d)/ }
Expand Down

0 comments on commit 144b677

Please sign in to comment.