cats_core 1.4.7 → 1.4.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dd88ba053bde7688e286bd43301fbd8b7d8c09eb3d76a22c5da0f70c80f8f733
4
- data.tar.gz: 3377e493badbe09bd8d152bb93aad0843b427e72fad83273eeb5177257fc7dd0
3
+ metadata.gz: 626e9d30bfefd23124b2110a3b10c4a6dcf58ac6aeb660b50803843ececd2517
4
+ data.tar.gz: e59fa35f07c89486a5840e613389dd75ed6613077cb0ae3648295134dbff7ffe
5
5
  SHA512:
6
- metadata.gz: 011ad9d0b3d1906c2cd7a3f978d5a2116c37af34bb199f1c52618682cc49064abcf533543cb088026f10d06b658cfbb40b21eccfb4d045605f4d93a55b729f47
7
- data.tar.gz: 605b33ec788fff1f0514e7093f4d03698de791f84bd49744856664f045349570bf767ed767e31eded4ef0206902f3e7d07f3686796d31e219baf4d0c21c2ecab
6
+ metadata.gz: 440d92d2388b2816b1c76b0040d4c6d2a2fe0588b94e4ba134be56058cb74344ad55510e074a9d87ee04b1bf5336a705dd98bc7de5facc7250f3638f17e9ddfd
7
+ data.tar.gz: f3adb1d2cc5edd7cf7baf0eeb4b9624602f0987bea3cb5d1b7700af7b894ac43143fc2c0108daed5622e55e5581fc789ae97bd073a2246fdd02836bcb060784a
@@ -24,6 +24,18 @@ module Cats
24
24
  quantities = transport_requisition_items.map { |item| UnitConversion.convert(item.unit, unit, item.quantity) }
25
25
  quantities.sum
26
26
  end
27
+
28
+ def approve
29
+ raise(StandardError, 'Transport requisition is already approved.') if status == APPROVED
30
+
31
+ if transport_requisition_items.count.zero?
32
+ raise(StandardError, 'Transport requisition has no requisition items.')
33
+ end
34
+
35
+ self.status = APPROVED
36
+ save!
37
+ self
38
+ end
27
39
  end
28
40
  end
29
41
  end
@@ -1,5 +1,5 @@
1
1
  module Cats
2
2
  module Core
3
- VERSION = '1.4.7'.freeze
3
+ VERSION = '1.4.8'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cats_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.7
4
+ version: 1.4.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henock L.