-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcomment_template.md.erb
144 lines (118 loc) · 3.22 KB
/
comment_template.md.erb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
<% if popolo_files.empty? %>
No Popolo files were changed in this pull request.
<% else %>
<% popolo_files.each do |file| %>
Summary of changes in `<%= file.path %>`:
## People
### Added
<% if file.people_added.any? %>
<% file.people_added.each do |person| %>
- `<%= person.id %>` - <%= person.name %>
<% end %>
<% else %>
No people added
<% end %>
### Removed
<% if file.people_removed.any? %>
<% file.people_removed.each do |person| %>
- `<%= person.id %>` - <%= person.name %>
<% end %>
<% else %>
No people removed
<% end %>
### Name Changes
<% if file.people_name_changes.any? %>
<% file.people_name_changes.each do |r| %>
- `<%= r[:id] %>`: <%= r[:was] %> → <%= r[:now] %>
<% end %>
<% else %>
No name changes
<% end %>
### Additional Name Changes
<% if file.people_additional_name_changes.any? %>
<% file.people_additional_name_changes.each do |r| %>
- `<%= r[:id] %>` (<%= r[:name] %>): <% if r[:removed].any? %>Removed: <%= r[:removed].join(" ﹠ ") %>. <% end %><% if r[:added].any? %>Added: <%= r[:added].join(" ﹠ ") %>.<% end %>
<% end %>
<% else %>
No name changes
<% end %>
### Wikidata Changes
<% if file.wikidata_links_changed.any? %>
<% file.wikidata_links_changed.each do |r| %>
- `<%= r[:id] %>`: <%= r[:was] %> → <%= r[:now] %>
<% end %>
<% else %>
No changes
<% end %>
## Organizations
### Added
<% if file.organizations_added.any? %>
<% file.organizations_added.each do |org| %>
- `<%= org.id %>` - <%= org.name %>
<% end %>
<% else %>
No organizations added
<% end %>
### Removed
<% if file.organizations_removed.any? %>
<% file.organizations_removed.each do |org| %>
- `<%= org.id %>` - <%= org.name %>
<% end %>
<% else %>
No organizations removed
<% end %>
## Memberships
### Added
<% if file.memberships_added.any? %>
<% file.memberships_added.group_by(&:legislative_period_id).sort_by { |t, _| t }.each do |t, ms| %>
#### <%= t %>
<% ms.sort_by { |m| m.person.sort_name }.each do |m| %>
- <%= m.person.name %> <% if m.start_date || m.end_date %>(<%= m.start_date %> - <%= m.end_date %>)<% end %>
<% end %>
<% end %>
<% else %>
No memberships added
<% end %>
### Removed
<% if file.memberships_removed.any? %>
<% file.memberships_removed.group_by(&:legislative_period_id).sort_by { |t, _| t }.each do |t, ms| %>
#### <%= t %>
<% ms.sort_by { |m| m.person.sort_name }.each do |m| %>
- <%= m.person.name %> <% if m.start_date || m.end_date %>(<%= m.start_date %> - <%= m.end_date %>)<% end %>
<% end %>
<% end %>
<% else %>
No memberships removed
<% end %>
<% if file.terms_added.any? || file.terms_removed.any? %>
## Terms
<% end %>
<% if file.terms_added.any? %>
### Added
<% file.terms_added.each do |term| %>
- `<%= term.id %>` - <%= term.name %>
<% end %>
<% end %>
<% if file.terms_removed.any? %>
### Removed
<% file.terms_removed.each do |term| %>
- `<%= term.id %>` - <%= term.name %>
<% end %>
<% end %>
<% if file.elections_added.any? || file.elections_removed.any? %>
## Elections
<% end %>
<% if file.elections_added.any? %>
### Added
<% file.elections_added.each do |election| %>
- `<%= election.id %>` - <%= election.name %>
<% end %>
<% end %>
<% if file.elections_removed.any? %>
### Removed
<% file.elections_removed.each do |election| %>
- `<%= election.id %>` - <%= election.name %>
<% end %>
<% end %>
<% end %>
<% end %>