et_fake_ccd 1.0.4 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/et_fake_ccd/ecm_service.rb +5 -12
- data/lib/et_fake_ccd/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6e08f42381f699dd1162eb4918819f72ba0271c4ca3aedb5010aa4ac35f4af38
|
4
|
+
data.tar.gz: 91148e9f12ab4a6342191541285c162140be9ffbfa51549a1dfef19d50bfe51f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f746897d1a9ab5fd1c606bb037a3ba696770fbea3c97851c72cceb3572bebe0420695eef3fc55b8f2d20e15aa89666ed45fd0f856e7ab81c948806343e03efb3
|
7
|
+
data.tar.gz: 985d3be8c217a4a6fb0ceb03e122230bcf9643b5b2eef6774d5ac932db75a77ee94ca028db84752e7cf45b3ca609d290ffdb4bee610e1f4e2eb9f43916a4fc3c
|
data/Gemfile.lock
CHANGED
@@ -18,8 +18,7 @@ module EtFakeCcd
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def call
|
21
|
-
adapter.reserve_reference_numbers_for(command.case_type_id, quantity: command.case_ref_number_count)
|
22
|
-
start_reference = adapter.last_case_reference(command.case_type_id) - command.case_ref_number_count
|
21
|
+
start_reference = adapter.reserve_reference_numbers_for(command.case_type_id, quantity: command.case_ref_number_count)
|
23
22
|
formatted_ref = "#{office_code_for(command.case_type_id)}#{start_reference.to_s.rjust(5, '0')}/#{Time.now.year}"
|
24
23
|
formatted_multiple = "#{office_code_for(command.case_type_id)}#{adapter.build_multiple_reference(command.case_type_id).to_s.rjust(5, '0')}/#{Time.now.year}"
|
25
24
|
Response.new(command.case_ref_number_count, formatted_ref, formatted_multiple).freeze
|
@@ -46,18 +45,12 @@ module EtFakeCcd
|
|
46
45
|
self.data = {}
|
47
46
|
end
|
48
47
|
|
49
|
-
def last_case_reference(case_type_id)
|
50
|
-
last_ref = data.dig(case_type_id, :case_reference)
|
51
|
-
raise "Case reference not generated for #{case_type_id}" if last_ref.nil?
|
52
|
-
|
53
|
-
last_ref
|
54
|
-
end
|
55
|
-
|
56
|
-
|
57
48
|
def reserve_reference_numbers_for(case_type_id, quantity:)
|
58
49
|
data[case_type_id] ||= {}
|
59
|
-
data[case_type_id][:
|
60
|
-
data[case_type_id][:
|
50
|
+
data[case_type_id][:next_case_reference] ||= 1
|
51
|
+
start = data[case_type_id][:next_case_reference]
|
52
|
+
data[case_type_id][:next_case_reference] += quantity
|
53
|
+
start
|
61
54
|
end
|
62
55
|
|
63
56
|
def build_multiple_reference(case_type_id)
|
data/lib/et_fake_ccd/version.rb
CHANGED