adherent 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/adherent/adhesions_controller.rb +1 -1
- data/app/controllers/adherent/coords_controller.rb +2 -2
- data/app/controllers/adherent/members_controller.rb +11 -6
- data/app/controllers/adherent/payments_controller.rb +1 -1
- data/app/controllers/adherent/reglements_controller.rb +1 -1
- data/app/models/adherent/adhesion.rb +1 -1
- data/app/models/adherent/coord.rb +11 -4
- data/app/models/adherent/member.rb +4 -1
- data/app/models/organism.rb +1 -4
- data/lib/adherent/version.rb +3 -3
- data/spec/controllers/adherent/coords_controller_spec.rb +10 -3
- data/spec/dummy/app/controllers/application_controller.rb +1 -1
- data/spec/dummy/log/development.log +8207 -0
- data/spec/dummy/log/test.log +11293 -0
- metadata +31 -31
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8b29d8528df12db718332171265a6d754d2a3b26
|
4
|
+
data.tar.gz: 0353753b7acdacf51c0df287ad6dfd1a363486c7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0a1a9653e134225fca9188be266d377c12c48504e475e886e1ba0cde0cdda131ed9c2275f2e55971fc82dbb196e63d4bb86b9a62a8b9502134d6687f89f724ec
|
7
|
+
data.tar.gz: de93d76ed685af67d41d2dbc56b26bf4bba1c4c97b46cf24a763351f0caa70d51f440c5ca76f638685b1547bf0060d19d7ef6116ac74d38964955fb7759b051f
|
@@ -5,7 +5,7 @@ require_dependency "adherent/application_controller"
|
|
5
5
|
module Adherent
|
6
6
|
class CoordsController < ApplicationController
|
7
7
|
|
8
|
-
before_filter :find_member, :except=>[:index]
|
8
|
+
before_filter :find_member, :except=>[:index]
|
9
9
|
|
10
10
|
# GET /coords/1
|
11
11
|
# GET /coords/1.json
|
@@ -74,7 +74,7 @@ module Adherent
|
|
74
74
|
protected
|
75
75
|
|
76
76
|
def find_member
|
77
|
-
@member =
|
77
|
+
@member = @organism.members.find(params[:member_id])
|
78
78
|
end
|
79
79
|
|
80
80
|
def coord_params
|
@@ -4,14 +4,19 @@ require_dependency "adherent/application_controller"
|
|
4
4
|
|
5
5
|
module Adherent
|
6
6
|
class MembersController < ApplicationController
|
7
|
+
|
8
|
+
before_filter :find_member, :except=>[:index, :create, :new]
|
9
|
+
|
10
|
+
|
7
11
|
# GET /members
|
8
12
|
# GET /members.json
|
9
13
|
def index
|
10
14
|
|
11
|
-
|
15
|
+
|
12
16
|
|
13
17
|
respond_to do |format|
|
14
|
-
format.html
|
18
|
+
format.html {@members = Adherent::QueryMember.query_members(@organism) }
|
19
|
+
# index.html.erb
|
15
20
|
format.csv { send_data Adherent::QueryMember.to_csv(@organism),
|
16
21
|
:filename=>"#{@organism.title}-#{dashed_date(Date.today)}-Membres.csv" }
|
17
22
|
|
@@ -24,7 +29,7 @@ module Adherent
|
|
24
29
|
# GET /members/1
|
25
30
|
# GET /members/1.json
|
26
31
|
def show
|
27
|
-
|
32
|
+
|
28
33
|
|
29
34
|
respond_to do |format|
|
30
35
|
format.html # show.html.erb
|
@@ -45,7 +50,7 @@ module Adherent
|
|
45
50
|
|
46
51
|
# GET /members/1/edit
|
47
52
|
def edit
|
48
|
-
|
53
|
+
|
49
54
|
end
|
50
55
|
|
51
56
|
# POST /members
|
@@ -67,7 +72,7 @@ module Adherent
|
|
67
72
|
# PUT /members/1
|
68
73
|
# PUT /members/1.json
|
69
74
|
def update
|
70
|
-
|
75
|
+
|
71
76
|
|
72
77
|
respond_to do |format|
|
73
78
|
if @member.update_attributes(member_params)
|
@@ -83,7 +88,7 @@ module Adherent
|
|
83
88
|
# DELETE /members/1
|
84
89
|
# DELETE /members/1.json
|
85
90
|
def destroy
|
86
|
-
|
91
|
+
|
87
92
|
@member.destroy
|
88
93
|
|
89
94
|
respond_to do |format|
|
@@ -11,7 +11,7 @@ module Adherent
|
|
11
11
|
@payment = Payment.find(params[:payment_id])
|
12
12
|
@member = @payment.member
|
13
13
|
@reglement = @payment.reglements.new(amount:@payment.non_impute)
|
14
|
-
@unpaid_adhesions =
|
14
|
+
@unpaid_adhesions = @organism.adhesions.unpaid
|
15
15
|
end
|
16
16
|
|
17
17
|
# TODO voir pour faire les deux approches (succès et échec)
|
@@ -39,7 +39,7 @@ module Adherent
|
|
39
39
|
|
40
40
|
# liste toutes les adhésions qui ne sont pas payées.
|
41
41
|
# pour rappel un where ne fonctionne pas avec un aggrégat obligeant à utiliser la clause having
|
42
|
-
#
|
42
|
+
# FIXME doit être filtré par un organisme
|
43
43
|
scope :unpaid, -> {select('adherent_adhesions.*, sum(adherent_reglements.amount) as reglements_amount').
|
44
44
|
joins('left join adherent_reglements on adherent_adhesions.id = adherent_reglements.adhesion_id').
|
45
45
|
group('adherent_adhesions.id').
|
@@ -1,11 +1,18 @@
|
|
1
1
|
module Adherent
|
2
2
|
class Coord < ActiveRecord::Base
|
3
3
|
belongs_to :member
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
|
7
5
|
validates :member_id, :presence=>true
|
8
|
-
|
6
|
+
validates :tel, :format=>{with:NAME_REGEX},
|
7
|
+
:length=>{:maximum=>LONG_NAME_LENGTH_MAX}, :allow_blank=>true
|
8
|
+
validates :gsm, :format=>{with:NAME_REGEX},
|
9
|
+
:length=>{:maximum=>LONG_NAME_LENGTH_MAX}, :allow_blank=>true
|
10
|
+
validates :office, :format=>{with:NAME_REGEX},
|
11
|
+
:length=>{:maximum=>LONG_NAME_LENGTH_MAX}, :allow_blank=>true
|
12
|
+
validates :zip, :format=>{with:NAME_REGEX},
|
13
|
+
:length=>{:maximum=>LONG_NAME_LENGTH_MAX}, :allow_blank=>true
|
14
|
+
validates :city, :format=>{with:NAME_REGEX},
|
15
|
+
:length=>{:maximum=>LONG_NAME_LENGTH_MAX}, :allow_blank=>true
|
9
16
|
|
10
17
|
end
|
11
18
|
end
|
@@ -13,8 +13,11 @@ module Adherent
|
|
13
13
|
|
14
14
|
# TODO rajouter un before_destroy sur les paiements
|
15
15
|
|
16
|
-
validates :
|
16
|
+
validates :organism_id, :presence=>true
|
17
|
+
validates :number, :format=>{with:NAME_REGEX}, :length=>{:within=>NAME_LENGTH_LIMITS}, :presence=>true
|
17
18
|
validates_uniqueness_of :number, :scope=>:organism_id
|
19
|
+
validates :name, presence:true, :format=>{with:NAME_REGEX}, :length=>{:maximum=>LONG_NAME_LENGTH_MAX}
|
20
|
+
validates :forname, presence:true, :format=>{with:NAME_REGEX}, :length=>{:maximum=>LONG_NAME_LENGTH_MAX}
|
18
21
|
|
19
22
|
# arel des adhésions impayées par ordre de date
|
20
23
|
def unpaid_adhesions
|
data/app/models/organism.rb
CHANGED
@@ -3,6 +3,7 @@ class Organism < ActiveRecord::Base
|
|
3
3
|
|
4
4
|
has_many :members, class_name:'Adherent::Member'
|
5
5
|
has_many :payments, through: :members, class_name:'Adherent::Payment'
|
6
|
+
has_many :adhesions, through: :members, class_name:'Adherent::Adhesion'
|
6
7
|
|
7
8
|
# méthode devant être surchargée dans l'application principale
|
8
9
|
# pour avoir une capacité à gerer les limites de dates lors de la saisie des
|
@@ -13,10 +14,6 @@ class Organism < ActiveRecord::Base
|
|
13
14
|
#
|
14
15
|
# Dans l'appli compta, on redéfinit range_date pour avoir les dates
|
15
16
|
# correspondants aux exercices ouverts.
|
16
|
-
#
|
17
|
-
# TODO revoir ce sujet pour introduire un fichier de configuration
|
18
|
-
# permettant d'indiquer les limites de dates
|
19
|
-
#
|
20
17
|
def range_date
|
21
18
|
Date.today.<<(3)..Date.today.>>(3)
|
22
19
|
end
|
data/lib/adherent/version.rb
CHANGED
@@ -16,6 +16,6 @@ module Adherent
|
|
16
16
|
# VERSION = '0.2.3' # Ajout d'un champ comment pour les paiements
|
17
17
|
# VERSION = '0.2.8' # Insertion icone et action export csv xls pour members
|
18
18
|
# VERSION = '0.2.9' # Mémorisation choix longueur liste des dataTables
|
19
|
-
VERSION = '0.3.0' # Passage à Rails 4.1
|
20
|
-
|
21
|
-
end
|
19
|
+
# VERSION = '0.3.0' # Passage à Rails 4.1
|
20
|
+
VERSION = '0.3.1' # Modifications pour le passage de flc à noschema
|
21
|
+
end
|
@@ -2,21 +2,28 @@
|
|
2
2
|
|
3
3
|
require 'rails_helper'
|
4
4
|
|
5
|
+
RSpec.configure do |c|
|
6
|
+
# c.exclusion_filter = {js:true}
|
7
|
+
# c.filter = {wip:true}
|
8
|
+
end
|
9
|
+
|
5
10
|
describe Adherent::CoordsController, :type => :controller do
|
6
11
|
|
7
12
|
before(:each) do
|
8
13
|
@routes = Adherent::Engine.routes
|
9
14
|
@member = double(Adherent::Member)
|
10
|
-
allow(
|
15
|
+
allow(@controller).to receive(:find_member)
|
16
|
+
@controller.instance_variable_set('@member', @member)
|
11
17
|
end
|
12
18
|
|
13
19
|
|
14
20
|
|
15
21
|
|
16
22
|
describe "GET show" do
|
17
|
-
it 'appelle le coord' do
|
23
|
+
it 'appelle le coord' , wip:true do
|
18
24
|
expect(@member).to receive(:coord).and_return(double(Adherent::Coord))
|
19
|
-
get :show, member_id:@member.to_param
|
25
|
+
get :show, {member_id:@member.to_param}
|
26
|
+
assigns.each {|h| puts "#{h.inspect }"}
|
20
27
|
end
|
21
28
|
|
22
29
|
it 'assigne le membre et rend la vue' do
|