next_sges 0.2.2 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: df66c2c0390289a5e7b4b05569f27245c371cd3d
4
- data.tar.gz: 79b4397c1294fa862c3a25597c5c77be01639638
3
+ metadata.gz: cf0dabd109e84f0fc850fc01b880059ccf61a873
4
+ data.tar.gz: 481b5311f0aebe524cec1ae7e5cd0faefbd79089
5
5
  SHA512:
6
- metadata.gz: 1e7478dc15e482cbf7ed1630389b3fea1656f5c1f261ad8a8d03471b9714cd9fba208a0c5c31c6d97019f5d6c6b29824d5ce2833f5ebe68d2d2eeb20258cd122
7
- data.tar.gz: 6b23d2c5615b62e6822453601cd1699343002aab6a23f33df31387c3d017041bfa0139b784b7b03eba3457d220ef49c3cc566a331d577e8d788ab3b31cbf3255
6
+ metadata.gz: ad5bf153899d4b6fd68884bb00e280dfadde4a08f58b752410917eb9cc1bb69975850eec05223e114b28ee01756f653feef2d47aae2f0eb4758441c3b467f2cd
7
+ data.tar.gz: 74a45526f526b5117f4832996dccd05e064d4dd39b1550b310419157cd9c13adf84036a77990c886a20a012cb1fc50f7ca5515a53663863917b534c287f278e3
@@ -7,6 +7,14 @@ module NextSges
7
7
  has_many :responsibles, through: :student
8
8
  has_many :collection_note_responsibles
9
9
 
10
+ scope :collection_note_number, -> (data) {data.present? ? where(id: [data].flatten.compact.uniq.map{|f| f.split(',,,')}.flatten.uniq) : all}
11
+ scope :collection_note_status, -> (data){data.present? ? where(status: data) : all}
12
+ scope :student_name, -> (data){data.present? ? where(student_id: data) : all}
13
+
14
+
15
+ scope :from_date, -> (data) {data.present? ? where("date >= ?", data) : all}
16
+ scope :to_date, -> (data) {data.present? ? where("date <= ?", data) : all}
17
+
10
18
  enum status: {inactive: 0, active: 1, paid: 2}
11
19
  INITIAL_LETTER = "F"
12
20
 
@@ -25,6 +25,10 @@ module NextSges
25
25
  "#{number} - #{name}"
26
26
  end
27
27
 
28
+ def receive_value
29
+ collection_notes.where(status: 2).sum(:value).to_kwanza
30
+ end
31
+
28
32
  validates_presence_of :name, :number
29
33
  validates_uniqueness_of :name, :number
30
34
  validates_format_of :email, :with => MAIL_REGEX
@@ -15,6 +15,10 @@ module NextSges
15
15
  enum relation: {son: 0, other: 1}
16
16
  enum identification_type: {identification_card: 0, identification: 1, passport: 2}
17
17
  enum gender: {male: 0, female: 1}
18
+ scope :student_name, -> (data) {data.present? ? where(id: [data].flatten.compact.uniq.map{|f| f.split(',,,')}.flatten.uniq) : all}
19
+ scope :student_number, -> (data) {data.present? ? where(number: [data].flatten.compact.uniq.map{|f| f.split(',,,')}.flatten.uniq) : all}
20
+
21
+
18
22
 
19
23
  attr_accessor :aux_types_ids
20
24
  INITIAL_LETTER = "A"
@@ -1,3 +1,3 @@
1
1
  module NextSges
2
- VERSION = '0.2.2'
2
+ VERSION = '0.2.3'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: next_sges
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - NEXTBSS
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-16 00:00:00.000000000 Z
11
+ date: 2018-03-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails