decidim 0.30.2 → 0.31.0.rc1
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/decidim-core/lib/decidim/{webpacker → shakapacker}/configuration.rb +4 -4
- data/decidim-core/lib/decidim/{webpacker → shakapacker}/runner.rb +3 -3
- data/decidim-core/lib/decidim/shakapacker/shakapacker.rb +8 -0
- data/decidim-core/lib/decidim/{webpacker → shakapacker}/shakapacker.yml +3 -1
- data/decidim-core/lib/decidim/{webpacker → shakapacker}/webpack/custom.js +1 -1
- data/decidim.gemspec +1 -1
- data/docs/antora.yml +1 -1
- data/docs/modules/configure/pages/environment_variables.adoc +184 -35
- data/docs/modules/configure/pages/index.adoc +2 -3
- data/docs/modules/configure/pages/initializer.adoc +45 -31
- data/docs/modules/configure/pages/system.adoc +3 -3
- data/docs/modules/customize/assets/images/social-share-modal-default.png +0 -0
- data/docs/modules/customize/pages/admin_filters.adoc +2 -2
- data/docs/modules/customize/pages/content_security_policy.adoc +1 -1
- data/docs/modules/customize/pages/images.adoc +1 -1
- data/docs/modules/customize/pages/index.adoc +1 -0
- data/docs/modules/customize/pages/javascript.adoc +5 -18
- data/docs/modules/customize/pages/localization.adoc +75 -0
- data/docs/modules/customize/pages/oauth.adoc +12 -0
- data/docs/modules/customize/pages/social_shares.adoc +0 -3
- data/docs/modules/customize/pages/styles.adoc +3 -16
- data/docs/modules/develop/assets/attachments/grafana/metadecidim-csv.json +1106 -0
- data/docs/modules/develop/assets/attachments/grafana/metadecidim-graphql.json +632 -0
- data/docs/modules/develop/assets/images/grafana/create_account_confirm.png +0 -0
- data/docs/modules/develop/assets/images/grafana/create_account_form.png +0 -0
- data/docs/modules/develop/assets/images/grafana/create_account_setup.png +0 -0
- data/docs/modules/develop/assets/images/grafana/dashboard_example_csv.png +0 -0
- data/docs/modules/develop/assets/images/grafana/dashboard_example_graphql.png +0 -0
- data/docs/modules/develop/assets/images/grafana/dashboard_import.png +0 -0
- data/docs/modules/develop/assets/images/grafana/dashboard_import_csv.png +0 -0
- data/docs/modules/develop/assets/images/grafana/dashboards.png +0 -0
- data/docs/modules/develop/assets/images/grafana/homepage.png +0 -0
- data/docs/modules/develop/pages/api.adoc +12 -2
- data/docs/modules/develop/pages/classes/models.adoc +2 -2
- data/docs/modules/develop/pages/commentable.adoc +9 -11
- data/docs/modules/develop/pages/components.adoc +10 -10
- data/docs/modules/develop/pages/elections.adoc +101 -0
- data/docs/modules/develop/pages/fixing_locales.adoc +7 -12
- data/docs/modules/develop/pages/grafana.adoc +100 -0
- data/docs/modules/develop/pages/likeable.adoc +106 -0
- data/docs/modules/develop/pages/machine_translations.adoc +6 -2
- data/docs/modules/develop/pages/maintainers/releases.adoc +40 -202
- data/docs/modules/develop/pages/maps.adoc +8 -8
- data/docs/modules/develop/pages/modules.adoc +1 -1
- data/docs/modules/develop/pages/notifications.adoc +27 -56
- data/docs/modules/develop/pages/permissions.adoc +19 -19
- data/docs/modules/develop/pages/taxonomies.adoc +1 -15
- data/docs/modules/install/pages/checklist.adoc +2 -1
- data/docs/modules/install/pages/index.adoc +3 -3
- data/docs/modules/install/pages/manual.adoc +5 -5
- data/docs/modules/install/partials/version_matrix.adoc +4 -2
- data/docs/modules/services/pages/aitools.adoc +0 -2
- data/docs/modules/services/pages/etherpad.adoc +5 -20
- data/docs/modules/services/pages/machine_translation.adoc +38 -0
- data/docs/modules/services/pages/maps.adoc +8 -66
- data/docs/modules/services/pages/pdf.adoc +33 -0
- data/docs/modules/services/pages/sms.adoc +6 -7
- data/docs/modules/services/pages/social_providers.adoc +1 -1
- data/docs/modules/services/pages/timestamp.adoc +47 -0
- data/lib/decidim/version.rb +1 -1
- data/package-lock.json +2413 -2624
- data/package.json +3 -2
- data/packages/browserslist-config/package.json +1 -1
- data/packages/core/package.json +2 -3
- data/packages/dev/package.json +2 -2
- data/packages/eslint-config/package.json +1 -1
- data/packages/prettier-config/package.json +1 -1
- data/packages/stylelint-config/package.json +1 -1
- data/packages/webpacker/package.json +3 -2
- data/packages/webpacker/src/loaders/decidim-sass-loader.js +18 -11
- metadata +68 -54
- data/docs/modules/develop/pages/endorsable.adoc +0 -110
- data/docs/modules/develop/pages/guide_migrate_webpacker_app.adoc +0 -257
- data/docs/modules/develop/pages/guide_migrate_webpacker_module.adoc +0 -132
- data/docs/modules/develop/pages/metrics.adoc +0 -123
- data/docs/modules/develop/pages/troubleshooting_metrics.adoc +0 -255
- /data/decidim-core/lib/decidim/{webpacker → shakapacker}/esbuild.config.js +0 -0
- /data/decidim-core/lib/decidim/{webpacker → shakapacker}/postcss.config.js +0 -0
- /data/decidim-core/lib/decidim/{webpacker → shakapacker}/tsconfig.json +0 -0
- /data/decidim-core/lib/decidim/{webpacker → shakapacker}/webpack/.modernizrrc +0 -0
- /data/decidim-core/lib/decidim/{webpacker → shakapacker}/webpack/webpack.config.js +0 -0
@@ -1,255 +0,0 @@
|
|
1
|
-
= How to fix metrics
|
2
|
-
|
3
|
-
At the request of some instances, we have analyzed the issues related to metrics and looked for possible solutions.
|
4
|
-
|
5
|
-
== Problems
|
6
|
-
|
7
|
-
We have identified two main problems:
|
8
|
-
|
9
|
-
* Metrics generation crashing, which cause ``MetricJob``s to run again and again.
|
10
|
-
* Peaks in generated metrics, sudden changes from day to day when displaying metrics.
|
11
|
-
|
12
|
-
=== Metrics generation crashing
|
13
|
-
|
14
|
-
We have identified only one culprit here: "orphans" records, meaning records whose related component or participatory space cannot be found in the database. This is because in a previous decidim release `ParticipatorySpaces` could be deleted but they were not deleted properly. So any application that has deleted a participatory space in the past, will probably have unrelated records that will make some metrics calculation crash.
|
15
|
-
|
16
|
-
=== Peaks in generated metrics
|
17
|
-
|
18
|
-
If somehow the metrics jobs fail to execute for a period of time, big differences can appear in metrics. So first make sure that you have metrics for every day, if not https://github.com/decidim/decidim/blob/develop/docs/advanced/metrics.md[generate them].
|
19
|
-
|
20
|
-
If you have metrics generated for almost everyday and still see drastic changes from day to day, take into account that changing the visibility of a component or participatory space (making them private or unpublishing them) will naturally cause big differences in generated metrics.
|
21
|
-
|
22
|
-
Finally, if you see that the differences in some days are multiples of a previous generated metric, meaning suddenly you have exactly the double or the triple of a calculated metric, it is very likely that you have duplicate generated metrics. We have only seen this problem with instances using Sidekiq, not Delayed Job. We do not know the cause of this, but it seems to be a known issue https://blog.francium.tech/avoiding-duplicate-jobs-in-sidekiq-dcbb1aca1e20[Avoiding duplicate jobs in Sidekiq].
|
23
|
-
|
24
|
-
== Solutions
|
25
|
-
|
26
|
-
We cannot offer a definitive solution for duplicate metrics, other than to delete old duplicate metrics and generate them again. If this problem persists, however, consider using Delayed Job.
|
27
|
-
For a given metric type (`rake decidim:metrics:list`) that has duplicates:
|
28
|
-
|
29
|
-
* Option 1: Remove individually each metric record per day.
|
30
|
-
* Option 2: Delete all metric records and recalculate them. https://github.com/decidim/decidim/blob/release/0.18-stable/CHANGELOG.md#participants-metrics[CHANGELOG] of decidim version 0.18 has an example for "participants".
|
31
|
-
|
32
|
-
For orphan records, you can do the following:
|
33
|
-
|
34
|
-
* Back up the database.
|
35
|
-
* Delete orphan records from the console (code is below).
|
36
|
-
* Delete "comments" metrics and recalculate them following the https://github.com/decidim/decidim/blob/release/0.18-stable/CHANGELOG.md#participants-metrics[aforementioned example].
|
37
|
-
|
38
|
-
=== Some queries that may help
|
39
|
-
|
40
|
-
[source,ruby]
|
41
|
-
----
|
42
|
-
GROUP_BY_FIELDS= %w(
|
43
|
-
day
|
44
|
-
metric_type
|
45
|
-
decidim_organization_id
|
46
|
-
participatory_space_type
|
47
|
-
participatory_space_id
|
48
|
-
related_object_type
|
49
|
-
related_object_id
|
50
|
-
decidim_category_id).join(', ')
|
51
|
-
|
52
|
-
def remove_duplicates
|
53
|
-
sql= <<~EOSQL.strip
|
54
|
-
DELETE FROM decidim_metrics WHERE decidim_metrics.id NOT IN
|
55
|
-
(SELECT id FROM (
|
56
|
-
SELECT DISTINCT ON (#{GROUP_BY_FIELDS}) * FROM decidim_metrics));
|
57
|
-
EOSQL
|
58
|
-
end
|
59
|
-
|
60
|
-
# DELETE FROM decidim_metrics WHERE decidim_metrics.id NOT IN \n (SELECT id FROM (\n SELECT DISTINCT ON (day, metric_type, decidim_organization_id, participatory_space_type, participatory_space_id, related_object_type, related_object_id, decidim_category_id) * FROM decidim_metrics));
|
61
|
-
def count_duplicates
|
62
|
-
sql= <<~EOSQL.strip
|
63
|
-
SELECT count(1), #{GROUP_BY_FIELDS} FROM decidim_metrics GROUP BY #{GROUP_BY_FIELDS} HAVING COUNT(1) > 1;
|
64
|
-
EOSQL
|
65
|
-
end
|
66
|
-
----
|
67
|
-
|
68
|
-
=== Delete orphan records
|
69
|
-
|
70
|
-
"proposals", "meetings", "accountability", "debates", "pages", "budgets", "surveys"
|
71
|
-
|
72
|
-
==== Proposals
|
73
|
-
|
74
|
-
Delete proposals whose component does not have a participatory space and delete components of a proposal type that do not have a participatory space
|
75
|
-
|
76
|
-
[source,ruby]
|
77
|
-
----
|
78
|
-
Decidim::Component.where(manifest_name: "proposals").find_each(batch_size: 100) { |c|
|
79
|
-
if c.participatory_space.blank?
|
80
|
-
Decidim::Proposals::Proposal.where(component: c).destroy_all
|
81
|
-
c.destroy
|
82
|
-
end
|
83
|
-
}
|
84
|
-
----
|
85
|
-
|
86
|
-
Delete proposals that do not have a component
|
87
|
-
|
88
|
-
[source,ruby]
|
89
|
-
----
|
90
|
-
Decidim::Proposals::Proposal.find_each(batch_size: 100) { |proposal|
|
91
|
-
proposal.delete if proposal.component.blank?
|
92
|
-
}
|
93
|
-
----
|
94
|
-
|
95
|
-
==== Meetings
|
96
|
-
|
97
|
-
Delete meetings whose component has no participatory space and delete components of meeting type that do not have a participatory space
|
98
|
-
|
99
|
-
[source,ruby]
|
100
|
-
----
|
101
|
-
Decidim::Component.where(manifest_name: "meetings").find_each(batch_size: 100) { |c|
|
102
|
-
if c.participatory_space.blank?
|
103
|
-
Decidim::Meetings::Meeting.where(component: c).destroy_all
|
104
|
-
c.destroy
|
105
|
-
end
|
106
|
-
}
|
107
|
-
----
|
108
|
-
|
109
|
-
Delete meetings that do not have a component
|
110
|
-
|
111
|
-
[source,ruby]
|
112
|
-
----
|
113
|
-
Decidim::Meetings::Meeting.find_each(batch_size: 100) { |meeting|
|
114
|
-
meeting.delete if meeting.component.blank?
|
115
|
-
}
|
116
|
-
----
|
117
|
-
|
118
|
-
==== Debates
|
119
|
-
|
120
|
-
Delete debates that its component has no participatory space and the debate components that do not have a participatory space
|
121
|
-
|
122
|
-
[source,ruby]
|
123
|
-
----
|
124
|
-
Decidim::Component.where(manifest_name: "debates").find_each(batch_size: 100) { |c|
|
125
|
-
if c.participatory_space.blank?
|
126
|
-
Decidim::Debates::Debate.where(component: c).destroy_all
|
127
|
-
c.destroy
|
128
|
-
end
|
129
|
-
}
|
130
|
-
----
|
131
|
-
|
132
|
-
Destroy debates that do not have a component
|
133
|
-
|
134
|
-
[source,ruby]
|
135
|
-
----
|
136
|
-
Decidim::Debates::Debate.find_each(batch_size: 100) { |debate|
|
137
|
-
debate.delete if debate.component.blank?
|
138
|
-
}
|
139
|
-
----
|
140
|
-
|
141
|
-
==== Posts
|
142
|
-
|
143
|
-
Destroy posts whose component has no participatory space and blog components that do not have a participatory space
|
144
|
-
|
145
|
-
[source,ruby]
|
146
|
-
----
|
147
|
-
Decidim::Component.where(manifest_name: "blogs").find_each(batch_size: 100) { |c|
|
148
|
-
if c.participatory_space.blank?
|
149
|
-
Decidim::Blogs::Post.where(component: c).destroy_all
|
150
|
-
c.destroy
|
151
|
-
end
|
152
|
-
}
|
153
|
-
----
|
154
|
-
|
155
|
-
Destroy posts that do not have a component
|
156
|
-
|
157
|
-
[source,ruby]
|
158
|
-
----
|
159
|
-
Decidim::Blogs::Post.find_each(batch_size: 100) { |post|
|
160
|
-
post.delete if post.component.blank?
|
161
|
-
}
|
162
|
-
----
|
163
|
-
|
164
|
-
==== Accountability
|
165
|
-
|
166
|
-
Destroy results whose component has no participatory space and components of accountability type that do not have a participatory space
|
167
|
-
|
168
|
-
[source,ruby]
|
169
|
-
----
|
170
|
-
Decidim::Component.where(manifest_name: "accountability").find_each(batch_size: 100) { |c|
|
171
|
-
if c.participatory_space.blank?
|
172
|
-
Decidim::Accountability::Result.where(component: c).destroy_all
|
173
|
-
c.destroy
|
174
|
-
end
|
175
|
-
}
|
176
|
-
----
|
177
|
-
|
178
|
-
Destroy results that do not have a component
|
179
|
-
|
180
|
-
[source,ruby]
|
181
|
-
----
|
182
|
-
Decidim::Accountability::Result.find_each(batch_size: 100) { |result|
|
183
|
-
result.delete if result.component.blank?
|
184
|
-
}
|
185
|
-
----
|
186
|
-
|
187
|
-
==== Pages
|
188
|
-
|
189
|
-
Destroy page components that do not have a participatory space
|
190
|
-
|
191
|
-
[source,ruby]
|
192
|
-
----
|
193
|
-
Decidim::Component.where(manifest_name: "pages").find_each(batch_size: 100) { |c|
|
194
|
-
if c.participatory_space.blank?
|
195
|
-
c.destroy
|
196
|
-
end
|
197
|
-
}
|
198
|
-
----
|
199
|
-
|
200
|
-
==== Budgets
|
201
|
-
|
202
|
-
Destroy projects whose component has no participatory space and budget components that do not have a participatory space
|
203
|
-
|
204
|
-
[source,ruby]
|
205
|
-
----
|
206
|
-
Decidim::Component.where(manifest_name: "budgets").find_each(batch_size: 100) { |c|
|
207
|
-
if c.participatory_space.blank?
|
208
|
-
Decidim::Budgets::Project.where(component: c).destroy_all
|
209
|
-
c.destroy
|
210
|
-
end
|
211
|
-
}
|
212
|
-
----
|
213
|
-
|
214
|
-
Destroy results that do not have a component
|
215
|
-
|
216
|
-
[source,ruby]
|
217
|
-
----
|
218
|
-
Decidim::Budgets::Project.find_each(batch_size: 100) { |project|
|
219
|
-
project.delete if project.component.blank?
|
220
|
-
}
|
221
|
-
----
|
222
|
-
|
223
|
-
==== Surveys
|
224
|
-
|
225
|
-
[source,ruby]
|
226
|
-
----
|
227
|
-
Decidim::Component.where(manifest_name: "surveys").find_each(batch_size: 100) { |c|
|
228
|
-
if c.participatory_space.blank?
|
229
|
-
Decidim::Surveys::Survey.where(component: c).destroy_all
|
230
|
-
c.destroy
|
231
|
-
end
|
232
|
-
}
|
233
|
-
----
|
234
|
-
|
235
|
-
Destroy surveys that do not have a component
|
236
|
-
|
237
|
-
[source,ruby]
|
238
|
-
----
|
239
|
-
Decidim::Surveys::Survey.find_each(batch_size: 100) { |survey|
|
240
|
-
survey.delete if survey.component.blank?
|
241
|
-
}
|
242
|
-
----
|
243
|
-
|
244
|
-
==== Comments
|
245
|
-
|
246
|
-
Destroy comments whose commentable root is a proposal that does not have a participatory space.
|
247
|
-
|
248
|
-
[source,ruby]
|
249
|
-
----
|
250
|
-
proposal_ids = Decidim::Comments::Comment.where(decidim_root_commentable_type: "Decidim::Proposals::Proposal").pluck(:decidim_root_commentable_id)
|
251
|
-
|
252
|
-
proposal_ids_without_space = Decidim::Proposals::Proposal.where(id: proposal_ids).find_all{|p| p.participatory_space.blank? }.pluck(:id)
|
253
|
-
|
254
|
-
Decidim::Comments::Comment.where(decidim_root_commentable_type: "Decidim::Proposals::Proposal", decidim_root_commentable_id: proposal_ids_without_space).destroy_all
|
255
|
-
----
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|