next_sges 0.1.4 → 0.1.6
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5705f53ab15600584e06babc0bca55d3f25b2976
|
|
4
|
+
data.tar.gz: ad46b931f15b7ba67430281329cf02ba32f09d30
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: '058c6df08526616b9f8ef1b8a55e86776a654dffe10e47ff38ada2a853b39d125b200f1bd4edab5fdb11c770548af3623e0d0cea4e244891327f153819ffc951'
|
|
7
|
+
data.tar.gz: 3fdab0c54c7caa6f371ef8d4aad2f87668df67899abaa4be9cab248a68f2cb65670383517e26df4bf02eb5f76e45e3764fc78dbedda4391d7539cfd7e42b67d6
|
|
@@ -9,6 +9,11 @@ module NextSges
|
|
|
9
9
|
enum status: {inactive: 0, active: 1}
|
|
10
10
|
# END
|
|
11
11
|
|
|
12
|
+
def self.latest_codes
|
|
13
|
+
latest_ids = NextSges::CollectionType.all.group_by{|type| type.code}.map{|code, types| types.sort_by{|type| type.created_at}.last.id}.flatten.compact.uniq
|
|
14
|
+
where(id: latest_ids)
|
|
15
|
+
end
|
|
16
|
+
|
|
12
17
|
# BEGIN instance methods
|
|
13
18
|
def map_for_select(method_name = :name)
|
|
14
19
|
super(:name)
|
|
@@ -23,8 +28,8 @@ module NextSges
|
|
|
23
28
|
# END
|
|
24
29
|
|
|
25
30
|
# BEGIN Validations
|
|
26
|
-
validates_presence_of :name, :value, :frequency, :category, :school_id, :status
|
|
27
|
-
validates_uniqueness_of :name
|
|
31
|
+
validates_presence_of :name, :value, :frequency, :category, :school_id, :status, :code
|
|
32
|
+
# validates_uniqueness_of :name, scope: [:school_id]
|
|
28
33
|
validates :value, numericality: {greater_than: 0}
|
|
29
34
|
validates :first_fine_percentage, :first_fine_after, :second_fine_percentage, :second_fine_after, :second_child_discount, :third_child_discount, :annual_payment_discount, numericality: {greater_then_or_equal: 0}
|
|
30
35
|
# END
|
|
@@ -32,5 +37,14 @@ module NextSges
|
|
|
32
37
|
# BEGIN Validation methods
|
|
33
38
|
# END
|
|
34
39
|
|
|
40
|
+
before_create :increment_code
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def increment_code
|
|
44
|
+
if code == 0 || code.nil?
|
|
45
|
+
self.code = (NextSges::CollectionType.all.sort_by(&:code).last&.code || 0) + 1
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
35
49
|
end
|
|
36
50
|
end
|
|
@@ -8,7 +8,7 @@ module NextSges
|
|
|
8
8
|
has_many :student_responsible_periods, through: :student_responsibles, class_name: StudentResponsiblePeriod.name
|
|
9
9
|
has_and_belongs_to_many :collection_types, association_foreign_key: :next_sges_collection_type_id, foreign_key: :next_sges_student_id
|
|
10
10
|
enum relation: {son: 0, other: 1}
|
|
11
|
-
enum identification_type: {identification_card: 0}
|
|
11
|
+
enum identification_type: {identification_card: 0, identification: 1, passport: 2}
|
|
12
12
|
enum gender: {male: 0, female: 1}
|
|
13
13
|
|
|
14
14
|
attr_accessor :aux_types_ids
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
class AddCodeToNextSgesCollectionTypes < ActiveRecord::Migration[5.1]
|
|
2
|
+
def change
|
|
3
|
+
add_column :next_sges_collection_types, :code, :integer, default: 0, null: false
|
|
4
|
+
NextSges::CollectionType.all.each_with_index do |type, index|
|
|
5
|
+
type.update_columns(code: index + 1)
|
|
6
|
+
end
|
|
7
|
+
end
|
|
8
|
+
end
|
data/lib/next_sges/version.rb
CHANGED
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.1.
|
|
4
|
+
version: 0.1.6
|
|
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-
|
|
11
|
+
date: 2018-03-05 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|
|
@@ -199,6 +199,7 @@ files:
|
|
|
199
199
|
- db/migrate/20180227075126_fix_responisble_on_deposit.rb
|
|
200
200
|
- db/migrate/20180227232928_add_colletion_date_to_next_sges_schools.rb
|
|
201
201
|
- db/migrate/20180228104835_add_email_text_settings_to_next_sges_schools.rb
|
|
202
|
+
- db/migrate/20180301082915_add_code_to_next_sges_collection_types.rb
|
|
202
203
|
- lib/next_sges.rb
|
|
203
204
|
- lib/next_sges/engine.rb
|
|
204
205
|
- lib/next_sges/version.rb
|