Add Debates to open data zip file#13436
Merged
Conversation
9 tasks
e8cc99a to
6ea1f7b
Compare
6083b00 to
aaae5f9
Compare
alecslupu
reviewed
Oct 2, 2024
alecslupu
suggested changes
Oct 2, 2024
Co-authored-by: Alexandru Emil Lupu <contact@alecslupu.ro>
Member
Author
|
@alecslupu I preferred to do the conclusions field differently, see 5437482 I also added the README doc from #13435, as that is already merged into develop |
alecslupu
reviewed
Oct 7, 2024
alecslupu
previously requested changes
Oct 7, 2024
Contributor
alecslupu
left a comment
There was a problem hiding this comment.
Can you check my last comment ?
alecslupu
previously requested changes
Oct 8, 2024
Contributor
alecslupu
left a comment
There was a problem hiding this comment.
I actually found a bug in the Open Data Exporter.
If you have 2 or more debates components then the help sections do not work as intended.
Check the below spec against this PR, and you will notice it fails. Apply the whole patch and see is working properly.
diff --git a/decidim-core/app/services/decidim/open_data_exporter.rb b/decidim-core/app/services/decidim/open_data_exporter.rb
index ccc92113e2..db1f0fb2c9 100644
--- a/decidim-core/app/services/decidim/open_data_exporter.rb
+++ b/decidim-core/app/services/decidim/open_data_exporter.rb
@@ -96,7 +96,7 @@ module Decidim
def get_help_definition(manifest_type, exporter, export_manifest)
help_definition[manifest_type] = {} if help_definition[manifest_type].nil?
- help_definition[manifest_type][export_manifest.name] = {}
+ help_definition[manifest_type][export_manifest.name] = {} unless help_definition[manifest_type][export_manifest.name].present?
exporter.headers_without_locales.each do |header|
help_definition[manifest_type][export_manifest.name][header] = I18n.t("decidim.open_data.help.#{export_manifest.name}.#{header}")
end
diff --git a/decidim-debates/spec/services/decidim/open_data_exporter_spec.rb b/decidim-debates/spec/services/decidim/open_data_exporter_spec.rb
index 2c4de3683b..0760b4ba0f 100644
--- a/decidim-debates/spec/services/decidim/open_data_exporter_spec.rb
+++ b/decidim-debates/spec/services/decidim/open_data_exporter_spec.rb
@@ -12,11 +12,18 @@ describe Decidim::OpenDataExporter do
let(:component) do
create(:debates_component, organization:, published_at: Time.current)
end
- let!(:resource) { create(:debate, :closed, component:) }
+ let!(:resource) { create(:debate, component:) }
+
+ let(:second_component) do
+ create(:debates_component, organization:, published_at: Time.current)
+ end
+ let!(:second_resource) { create(:debate, :closed, component: second_component) }
+
let(:resource_title) { "## debates" }
let(:help_lines) do
[
- "* id: The unique identifier of the debate"
+ "* id: The unique identifier of the debate",
+ "* conclusions: The conclusions of the debate if it was closed"
]
end
let(:unpublished_component) do
alecslupu
approved these changes
Oct 18, 2024
39 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🎩 What? Why?
There's a component missing in the open data file: Debates. This PR adds it, and also its comments.
It also adds the Debates resources in the "Export all" feature in the admin panel.
📌 Related Issues
Testing
localhost-open-data-debates.csvandlocalhost-open-data-debate_comments.csvFor the "Export all"
📷 Screenshots