Skip to content

Commit

Permalink
Merge f98724c into b8702e8
Browse files Browse the repository at this point in the history
  • Loading branch information
jufemaiz committed Mar 10, 2020
2 parents b8702e8 + f98724c commit 82a2166
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 14 deletions.
12 changes: 6 additions & 6 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
aemo (0.3.4)
aemo (0.3.6)
activesupport (>= 4.2.6, < 5.2)
httparty (~> 0.15, >= 0.15.6)
json (>= 1.7.5, < 3)
Expand All @@ -21,7 +21,7 @@ GEM
awesome_print (1.8.0)
builder (3.2.3)
coderay (1.1.2)
concurrent-ruby (1.1.5)
concurrent-ruby (1.1.6)
coveralls (0.8.23)
json (>= 1.8, < 3)
simplecov (~> 0.16.1)
Expand Down Expand Up @@ -63,7 +63,7 @@ GEM
highline (2.0.2)
httparty (0.16.2)
multi_xml (>= 0.5.2)
i18n (1.6.0)
i18n (1.8.2)
concurrent-ruby (~> 1.0)
jeweler (2.3.9)
builder
Expand All @@ -86,7 +86,7 @@ GEM
method_source (0.9.2)
mime-types (2.99.3)
mini_portile2 (2.4.0)
minitest (5.11.3)
minitest (5.14.0)
multi_json (1.13.1)
multi_xml (0.6.0)
multipart-post (2.1.1)
Expand Down Expand Up @@ -153,7 +153,7 @@ GEM
thread_safe (0.3.6)
timecop (0.9.1)
tins (1.21.1)
tzinfo (1.2.5)
tzinfo (1.2.6)
thread_safe (~> 0.1)
unicode-display_width (1.6.0)
webmock (3.6.2)
Expand Down Expand Up @@ -183,4 +183,4 @@ DEPENDENCIES
yard (~> 0.9, >= 0.9.11)!

BUNDLED WITH
2.0.2
2.1.4
28 changes: 22 additions & 6 deletions lib/aemo/nem12.rb
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ def parse_nem12_300(line, options = {})
if csv[intervals_offset + 3].match(/\d{14}/).nil? || csv[intervals_offset + 3] != Time.parse(csv[intervals_offset + 3].to_s).strftime('%Y%m%d%H%M%S')
raise ArgumentError, 'UpdateDateTime is not valid'
end
if !csv[intervals_offset + 4].nil? && csv[intervals_offset + 4].match(/\d{14}/).nil? || csv[intervals_offset + 4] != Time.parse(csv[intervals_offset + 4].to_s).strftime('%Y%m%d%H%M%S')
if !csv[intervals_offset + 4].blank? && csv[intervals_offset + 4].match(/\d{14}/).nil? || !csv[intervals_offset + 4].blank? && csv[intervals_offset + 4] != Time.parse(csv[intervals_offset + 4].to_s).strftime('%Y%m%d%H%M%S')
raise ArgumentError, 'MSATSLoadDateTime is not valid'
end
end
Expand All @@ -397,7 +397,23 @@ def parse_nem12_300(line, options = {})
flag[:reason_code] = csv[intervals_offset + 1].to_i unless csv[intervals_offset + 1].nil?
end

base_interval = { data_details: @data_details.last, datetime: Time.parse("#{csv[1]}000000+1000"), value: nil, flag: flag }
# Deal with updated_at & msats_load_at
updated_at = nil
msats_load_at = nil

if options[:strict]
updated_at = Time.parse(csv[intervals_offset + 3]) unless csv[intervals_offset + 3].blank?
msats_load_at = Time.parse(csv[intervals_offset + 4]) unless csv[intervals_offset + 4].blank?
end

base_interval = {
data_details: @data_details.last,
datetime: Time.parse("#{csv[1]}000000+1000"),
value: nil,
flag: flag,
updated_at: updated_at,
msats_load_at: msats_load_at
}

intervals = []
(2..(number_of_intervals + 1)).each do |i|
Expand Down Expand Up @@ -522,13 +538,13 @@ def self.parse_nem12(contents, strict = true)
nem12s << AEMO::NEM12.new('')
nem12s.last.parse_nem12_200(line, strict: strict)
when 300
nem12s.last.parse_nem12_300(line)
nem12s.last.parse_nem12_300(line, strict: strict)
when 400
nem12s.last.parse_nem12_400(line)
nem12s.last.parse_nem12_400(line, strict: strict)
# when 500
# nem12s.last.parse_nem12_500(line)
# nem12s.last.parse_nem12_500(line, strict: strict)
# when 900
# nem12s.last.parse_nem12_900(line)
# nem12s.last.parse_nem12_900(line, strict: strict)
end
end
# Return the array of NEM12 groups
Expand Down
2 changes: 1 addition & 1 deletion lib/aemo/nmi/allocation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ def find_by_nmi(nmi)
def initialize(title, type, opts = {})
@title = title
@type = parse_allocation_type(type)
@identifier = opts.fetch(:identifier, title.upcase)
@identifier = opts.fetch(:participant_id, title.upcase)
@friendly_title = opts.fetch(:friendly_title, title)
@exclude_nmi_patterns = opts.fetch(:excludes, [])
@include_nmi_patterns = opts.fetch(:includes, [])
Expand Down
2 changes: 1 addition & 1 deletion lib/aemo/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
# @author Joel Courtney <euphemize@gmail.com>
module AEMO
# aemo version
VERSION = '0.3.5'
VERSION = '0.3.6'

# aemo version split amongst different revisions
MAJOR_VERSION, MINOR_VERSION, REVISION = VERSION.split('.').map(&:to_i)
Expand Down

0 comments on commit 82a2166

Please sign in to comment.