effective_committees 0.10.0 → 0.10.1
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 +4 -4
- data/app/models/concerns/effective_committees_user.rb +9 -6
- data/app/models/effective/committee.rb +5 -4
- data/app/models/effective/committee_agenda_item.rb +1 -1
- data/app/models/effective/committee_member.rb +1 -4
- data/app/views/effective/committees/_dashboard_agendas.html.haml +1 -1
- data/app/views/effective/committees/volunteers_and_committees.html.haml +2 -2
- data/lib/effective_committees/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2f8cd4e1b3dc27e4baa6206e02cfa679cae82026ab3006320c0fd3faa7b710a6
|
|
4
|
+
data.tar.gz: af3689f3c635f417988147e98edfc5bdf8f7f5e324f791965b594f21652bbf5a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c10c50b9dcdfb26a07be5072a5b76d25c7c33fe1cf1d7ffea69a6dedc7db75779ee355534c6fc4404fe545077b0df3ef5659b2d3abc71549a7286069fb5ff6b4
|
|
7
|
+
data.tar.gz: dd3865586a9442ceaa0b85ee5c1699a2153b52b055c95a08d627b56ec5ad7cfaf4745a81c784876bded93ca5e0e68bc11418576e9e2270d1d50e8046f321b8b5
|
|
@@ -16,7 +16,7 @@ module EffectiveCommitteesUser
|
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
included do
|
|
19
|
-
has_many :committee_members, -> { Effective::CommitteeMember.sorted },
|
|
19
|
+
has_many :committee_members, -> { Effective::CommitteeMember.sorted.includes(:committee) },
|
|
20
20
|
class_name: 'Effective::CommitteeMember', inverse_of: :user, dependent: :delete_all
|
|
21
21
|
|
|
22
22
|
accepts_nested_attributes_for :committee_members, allow_destroy: true
|
|
@@ -32,17 +32,20 @@ module EffectiveCommitteesUser
|
|
|
32
32
|
|
|
33
33
|
# Instance Methods
|
|
34
34
|
|
|
35
|
+
# Returns the user's currently-active term on this committee, or nil.
|
|
36
|
+
# A user may hold multiple terms on the same committee (history of past roles).
|
|
35
37
|
def committee_member(committee:)
|
|
36
|
-
committee_members.find { |
|
|
38
|
+
committee_members.select(&:active?).find { |cm| cm.committee_id == committee.id }
|
|
37
39
|
end
|
|
38
40
|
|
|
39
|
-
# Find
|
|
41
|
+
# Find-active-or-build-new. If the user has no active term, build a fresh row
|
|
42
|
+
# (expired terms are history and are not edited in place through this helper).
|
|
40
43
|
def build_committee_member(committee:)
|
|
41
44
|
committee_member(committee: committee) || committee_members.build(committee: committee)
|
|
42
45
|
end
|
|
43
46
|
|
|
44
47
|
def committees
|
|
45
|
-
committee_members.
|
|
48
|
+
committee_members.select(&:active?).map { |cm| cm.committee }.uniq
|
|
46
49
|
end
|
|
47
50
|
|
|
48
51
|
# When activity is for sequential uploaded files, group them together like: "12 files were added to Board of Directors - April 2025 Meeting"
|
|
@@ -61,8 +64,8 @@ module EffectiveCommitteesUser
|
|
|
61
64
|
# Returns an Array of Arrays where some are 1 length groups
|
|
62
65
|
# Others are multiple length groups of file changes to one folder
|
|
63
66
|
logs = logs.slice_when do |a, b|
|
|
64
|
-
(a.changes_to_id != b.changes_to_id) ||
|
|
65
|
-
(a.associated_type != b.associated_type) ||
|
|
67
|
+
(a.changes_to_id != b.changes_to_id) ||
|
|
68
|
+
(a.associated_type != b.associated_type) ||
|
|
66
69
|
(b.associated_type == "Effective::CommitteeFolder") ||
|
|
67
70
|
(a.associated.try(:committee_folder_id) != b.associated.try(:committee_folder_id))
|
|
68
71
|
end
|
|
@@ -55,12 +55,13 @@ module Effective
|
|
|
55
55
|
# Returns the user's currently-active term on this committee, or nil.
|
|
56
56
|
# For the full history including expired terms, use committee_members_for(user:).
|
|
57
57
|
def committee_member(user:)
|
|
58
|
-
committee_members.find { |
|
|
58
|
+
committee_members.find { |cm| cm.user_id == user.id && cm.active? }
|
|
59
59
|
end
|
|
60
60
|
|
|
61
61
|
# All terms (active and expired) a user has served on this committee.
|
|
62
|
+
# Do not add uniq here
|
|
62
63
|
def committee_members_for(user:)
|
|
63
|
-
committee_members.select { |
|
|
64
|
+
committee_members.select { |cm| cm.user_id == user.id }
|
|
64
65
|
end
|
|
65
66
|
|
|
66
67
|
# Find-active-or-build-new. If the user has no active term, build a fresh row
|
|
@@ -70,11 +71,11 @@ module Effective
|
|
|
70
71
|
end
|
|
71
72
|
|
|
72
73
|
def users
|
|
73
|
-
committee_members.
|
|
74
|
+
committee_members.map(&:user).uniq
|
|
74
75
|
end
|
|
75
76
|
|
|
76
77
|
def emails
|
|
77
|
-
committee_members.
|
|
78
|
+
committee_members.select(&:active?).map(&:email).compact.uniq.join(', ')
|
|
78
79
|
end
|
|
79
80
|
|
|
80
81
|
def children
|
|
@@ -28,7 +28,7 @@ module Effective
|
|
|
28
28
|
end
|
|
29
29
|
|
|
30
30
|
scope :sorted, -> { order(:position) }
|
|
31
|
-
scope :deep, -> { includes(:rich_text_body) }
|
|
31
|
+
scope :deep, -> { includes(:committee, :committee_folder, :rich_text_body) }
|
|
32
32
|
|
|
33
33
|
validates :title, presence: true, length: { maximum: 250 }
|
|
34
34
|
validates :position, presence: true
|
|
@@ -61,11 +61,8 @@ module Effective
|
|
|
61
61
|
validates :user, presence: true
|
|
62
62
|
validates :position, presence: true
|
|
63
63
|
|
|
64
|
-
validates :user_id, if: -> { user_id && user_type && committee_id && committee_type },
|
|
65
|
-
uniqueness: { scope: [:committee_id, :committee_type], message: 'already belongs to this committee' }
|
|
66
|
-
|
|
67
64
|
validate(if: -> { start_on && end_on }) do
|
|
68
|
-
|
|
65
|
+
errors.add(:end_on, 'must be after start date') unless end_on > start_on
|
|
69
66
|
end
|
|
70
67
|
|
|
71
68
|
def to_s
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
- agenda_committees = current_user.committees.select(&:agenda_mode?)
|
|
2
2
|
- upcoming = agenda_committees.flat_map { |c| Effective::CommitteeFolder.where(committee: c).upcoming_meetings.limit(5) }.sort_by(&:meeting_date).first(5)
|
|
3
3
|
|
|
4
|
-
- if upcoming.
|
|
4
|
+
- if upcoming.present?
|
|
5
5
|
%h3 Upcoming Meetings
|
|
6
6
|
|
|
7
7
|
- if upcoming.any?
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
= render('layout') do
|
|
2
2
|
- @committees.each do |committee|
|
|
3
3
|
%h3= committee
|
|
4
|
-
= committee.body
|
|
4
|
+
= committee.body
|
|
5
5
|
|
|
6
|
-
- members = committee.committee_members.select(&:active?).
|
|
6
|
+
- members = committee.committee_members.select(&:active?).uniq(&:user_id)
|
|
7
7
|
%ul
|
|
8
8
|
- members.each do |member|
|
|
9
9
|
%li
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: effective_committees
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.10.
|
|
4
|
+
version: 0.10.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Code and Effect
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-06-09 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|