decidim-proposals 0.16.1 → 0.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/documents/decidim/proposals/participatory_texts/participatory_text.md +52 -0
  3. data/app/assets/documents/decidim/proposals/participatory_texts/participatory_text.odt +0 -0
  4. data/app/cells/decidim/proposals/collaborative_draft_cell.rb +0 -4
  5. data/app/cells/decidim/proposals/participatory_text_proposal_cell.rb +0 -6
  6. data/app/cells/decidim/proposals/proposal_cell.rb +0 -4
  7. data/app/cells/decidim/proposals/proposal_m_cell.rb +5 -1
  8. data/app/commands/decidim/proposals/admin/import_proposals.rb +5 -1
  9. data/app/commands/decidim/proposals/vote_proposal.rb +4 -2
  10. data/app/commands/decidim/proposals/withdraw_proposal.rb +2 -2
  11. data/app/controllers/decidim/proposals/admin/participatory_texts_controller.rb +3 -3
  12. data/app/controllers/decidim/proposals/collaborative_drafts_controller.rb +4 -1
  13. data/app/controllers/decidim/proposals/proposals_controller.rb +4 -3
  14. data/app/forms/decidim/proposals/admin/import_participatory_text_form.rb +14 -0
  15. data/app/forms/decidim/proposals/admin/preview_participatory_text_form.rb +1 -1
  16. data/app/forms/decidim/proposals/admin/proposals_import_form.rb +1 -0
  17. data/app/helpers/decidim/proposals/participatory_texts_helper.rb +14 -0
  18. data/app/helpers/decidim/proposals/proposal_wizard_helper.rb +13 -0
  19. data/app/models/decidim/proposals/collaborative_draft.rb +5 -0
  20. data/app/permissions/decidim/proposals/permissions.rb +20 -6
  21. data/app/queries/decidim/proposals/metrics/accepted_proposals_metric_manage.rb +5 -1
  22. data/app/queries/decidim/proposals/metrics/proposals_metric_manage.rb +2 -2
  23. data/app/queries/decidim/proposals/metrics/votes_metric_manage.rb +1 -1
  24. data/app/services/decidim/proposals/proposal_builder.rb +34 -6
  25. data/app/views/decidim/proposals/admin/participatory_texts/new_import.html.erb +1 -1
  26. data/app/views/decidim/proposals/admin/proposals/_proposal-tr.html.erb +0 -1
  27. data/app/views/decidim/proposals/admin/proposals_imports/new.html.erb +3 -0
  28. data/app/views/decidim/proposals/collaborative_drafts/_accept_request_access_form.html.erb +1 -1
  29. data/app/views/decidim/proposals/collaborative_drafts/_collaborator_requests.html.erb +1 -1
  30. data/app/views/decidim/proposals/collaborative_drafts/_reject_request_access_form.html.erb +1 -1
  31. data/app/views/decidim/proposals/collaborative_drafts/_wizard_aside.html.erb +16 -0
  32. data/app/views/decidim/proposals/collaborative_drafts/compare.html.erb +1 -1
  33. data/app/views/decidim/proposals/collaborative_drafts/complete.html.erb +1 -1
  34. data/app/views/decidim/proposals/collaborative_drafts/new.html.erb +1 -1
  35. data/app/views/decidim/proposals/proposals/_proposal_preview.html.erb +11 -1
  36. data/app/views/decidim/proposals/proposals/_vote_button.html.erb +1 -1
  37. data/app/views/decidim/proposals/proposals/_wizard_aside.html.erb +5 -3
  38. data/app/views/decidim/proposals/proposals/compare.html.erb +1 -1
  39. data/app/views/decidim/proposals/proposals/participatory_texts/_proposal_vote_button.html.erb +1 -1
  40. data/app/views/decidim/proposals/proposals/show.html.erb +20 -10
  41. data/config/locales/ar-SA.yml +139 -10
  42. data/config/locales/ca.yml +59 -44
  43. data/config/locales/cs-CZ.yml +13 -1
  44. data/config/locales/cs.yml +790 -0
  45. data/config/locales/de.yml +21 -6
  46. data/config/locales/en.yml +111 -95
  47. data/config/locales/es-MX.yml +22 -7
  48. data/config/locales/es-PY.yml +21 -6
  49. data/config/locales/es.yml +77 -62
  50. data/config/locales/eu.yml +25 -10
  51. data/config/locales/fi-pl.yml +15 -3
  52. data/config/locales/fi-plain.yml +766 -0
  53. data/config/locales/fi.yml +85 -70
  54. data/config/locales/fr.yml +21 -6
  55. data/config/locales/gl.yml +21 -6
  56. data/config/locales/hu.yml +22 -7
  57. data/config/locales/id-ID.yml +21 -6
  58. data/config/locales/it.yml +22 -7
  59. data/config/locales/nl.yml +25 -10
  60. data/config/locales/pl.yml +22 -7
  61. data/config/locales/pt-BR.yml +21 -6
  62. data/config/locales/pt.yml +21 -6
  63. data/config/locales/ru.yml +0 -7
  64. data/config/locales/sv.yml +21 -6
  65. data/config/locales/tr-TR.yml +21 -6
  66. data/config/locales/uk.yml +0 -7
  67. data/lib/decidim/content_renderers/proposal_renderer.rb +5 -7
  68. data/lib/decidim/proposals/admin_engine.rb +8 -9
  69. data/lib/decidim/proposals/doc_to_markdown.rb +10 -0
  70. data/lib/decidim/proposals/markdown_to_proposals.rb +15 -1
  71. data/lib/decidim/proposals/version.rb +1 -1
  72. metadata +23 -18
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f545c292413c69159509938ffa3e0a7a442eaec96770e465b405d709ab0db976
4
- data.tar.gz: 90b940f6ce3c968772548d40a04a7c47d7491c340c2a407b78a6013ccdf903c8
3
+ metadata.gz: 8bd0f06eca6fadd85f7cff679eed7d31d1350394010f46de1033cc1ce34f3566
4
+ data.tar.gz: da5186ec1edfb655823e1b5802976d5c753471c6b4f95102729c6e1cabaf0566
5
5
  SHA512:
6
- metadata.gz: e12c387014c567aee0ca73e133357c74621e49dcd49b305ecda4bac2e231e215273d15b30a7d3e0e61772ba6dea2163b3baaf459781aa4a595ba100dcefcf086
7
- data.tar.gz: 7dde2bc4a1920813acf8fee2bde644f1d7b80b58c056bab12f720ff2df246e376b401e83418d6a51475ba4190e1147f3beadb651a6be12bf90216fc38e5b5c3c
6
+ metadata.gz: ae4c19035219cd815b79c31253766c95ee56e549b73b15c91953beb36967c582383692a60330bdc6766d0e223994e55923d6fc05a7dbd6359184cb660f2f66f2
7
+ data.tar.gz: 474931fce6b3ba9e3f6261fc4f7f587e0ee81662a929b8483f8ce96c4116a69fbca9b2cf295e5a9c161b3f9a2be17502b876cf649e72c436ab3e98077c838b01
@@ -0,0 +1,52 @@
1
+ # Section title 1: grouping content
2
+
3
+ Participatory texts relay on the parsing of Markdown texts to produce a structured document.
4
+
5
+ Participatory texts are divided into 3 types of blocks:
6
+ - Section: produced by main headers (paragraphs starting with "# ")
7
+ - Subsection: produced by secondary headers (paragraphs starting more than one "#") until 6 levels.
8
+ - Article: produced by paragraphs and lists.
9
+
10
+ ## Subsection title 1.1
11
+ Parsing of Markdown is strict.
12
+ This means that, for paragraphs and lists, all blocks should be separated by a blank line between them.
13
+ The first, second and this third paragraphs, for example, will be grouped into a single participatory text article.
14
+
15
+ This paragraph instead, will produce a single participatory text article.
16
+
17
+ This paragraph also, will produce a third participatory text article.
18
+
19
+ ## Subsection title 1.2
20
+
21
+ Inside a paragraph list or a list, **bold text** is supported, *italics text* is supported, __underlined text__ is supported.
22
+ As explained [here](https://daringfireball.net/projects/markdown/syntax#em) Markdown treats asterisks (\*) and underscores (\_) as indicators of emphasis. Text wrapped with one \* or \_ will be wrapped with an HTML <em> tag; double \*’s or \_’s will be wrapped with an HTML &lt;strong> tag. E.g., this input:
23
+ - *single asterisks*
24
+ - _single underscores_
25
+ - **double asterisks**
26
+ - __double underscores__
27
+
28
+ You can use the following reference when writing your documents: [https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet).
29
+
30
+ # Section title 2: lists
31
+
32
+ Lists will be parsed as one block:
33
+
34
+ - consensus by simple majority: when a, b, and c appear in the creation.
35
+ - consensus by enhanced majority: when a, b, c and also d appear in the creation.
36
+ - consensus by absolute majority: when x, y and z appear in the creation.
37
+ - consensus by imposing whatever the organization wants: to be used at will.
38
+ - consensus by ignoring whatever resulted from the previous consensus: to be used when organization don't like the results of another consensus system.
39
+
40
+ Ordered lists reset numberings to the correct order (1,2,3,4,5 in this case):
41
+
42
+ 1. one
43
+ 2. two
44
+ 3. three
45
+ 1. four
46
+ 1. five
47
+
48
+ # Section title 3: images and links
49
+
50
+ A link to Decidim's web site uses [this format](https://decidim.org).
51
+
52
+ ![Important image for Decidim](https://meta.decidim.org/assets/decidim/decidim-logo-1f39092fb3e41d23936dc8aeadd054e2119807dccf3c395de88637e4187f0a3f.svg)
@@ -17,10 +17,6 @@ module Decidim
17
17
 
18
18
  private
19
19
 
20
- def current_user
21
- context[:current_user]
22
- end
23
-
24
20
  def card_size
25
21
  "decidim/proposals/collaborative_draft_m"
26
22
  end
@@ -12,8 +12,6 @@ module Decidim
12
12
  include Messaging::ConversationHelper
13
13
  include Decidim::SanitizeHelper
14
14
 
15
- delegate :current_organization, to: :controller
16
-
17
15
  def show
18
16
  render
19
17
  end
@@ -35,10 +33,6 @@ module Decidim
35
33
  decidim_sanitize(strip_links(formatted))
36
34
  end
37
35
 
38
- def current_user
39
- context[:current_user]
40
- end
41
-
42
36
  def resource_path
43
37
  resource_locator(model).path
44
38
  end
@@ -17,10 +17,6 @@ module Decidim
17
17
 
18
18
  private
19
19
 
20
- def current_user
21
- context[:current_user]
22
- end
23
-
24
20
  def card_size
25
21
  "decidim/proposals/proposal_m"
26
22
  end
@@ -50,7 +50,7 @@ module Decidim
50
50
 
51
51
  def statuses
52
52
  return [:endorsements_count, :comments_count] if model.draft?
53
- return [:creation_date, :endorsements_count, :comments_count] unless has_link_to_resource?
53
+ return [:creation_date, :endorsements_count, :comments_count] if !has_link_to_resource? || !can_be_followed?
54
54
  [:creation_date, :follow, :endorsements_count, :comments_count]
55
55
  end
56
56
 
@@ -87,6 +87,10 @@ module Decidim
87
87
  t("decidim.proposals.proposals.votes_count.need_more_votes")
88
88
  end
89
89
  end
90
+
91
+ def can_be_followed?
92
+ !model.withdrawn?
93
+ end
90
94
  end
91
95
  end
92
96
  end
@@ -35,7 +35,7 @@ module Decidim
35
35
 
36
36
  Decidim::Proposals::ProposalBuilder.copy(
37
37
  original_proposal,
38
- author: form.current_organization,
38
+ author: proposal_author,
39
39
  action_user: form.current_user,
40
40
  extra_attributes: {
41
41
  "component" => target_component
@@ -74,6 +74,10 @@ module Decidim
74
74
  proposal.component == target_component
75
75
  end
76
76
  end
77
+
78
+ def proposal_author
79
+ form.keep_authors ? nil : @form.current_organization
80
+ end
77
81
  end
78
82
  end
79
83
  end
@@ -26,8 +26,10 @@ module Decidim
26
26
  return broadcast(:invalid) unless vote.valid?
27
27
 
28
28
  ActiveRecord::Base.transaction do
29
- vote.save!
30
- update_temporary_votes
29
+ @proposal.with_lock do
30
+ vote.save!
31
+ update_temporary_votes
32
+ end
31
33
  end
32
34
 
33
35
  Decidim::Gamification.increment_score(@current_user, :proposal_votes)
@@ -16,11 +16,11 @@ module Decidim
16
16
  # Executes the command. Broadcasts these events:
17
17
  #
18
18
  # - :ok when everything is valid, together with the proposal.
19
- # - :invalid if the proposal already has supports or does not belong to current user.
19
+ # - :has_supports if the proposal already has supports or does not belong to current user.
20
20
  #
21
21
  # Returns nothing.
22
22
  def call
23
- return broadcast(:invalid) if @proposal.votes.any?
23
+ return broadcast(:has_supports) if @proposal.votes.any?
24
24
 
25
25
  transaction do
26
26
  change_proposal_state_to_withdrawn
@@ -27,7 +27,7 @@ module Decidim
27
27
  Admin::ImportParticipatoryText.call(@import) do
28
28
  on(:ok) do
29
29
  flash[:notice] = I18n.t("participatory_texts.import.success", scope: "decidim.proposals.admin")
30
- redirect_to participatory_texts_path(component_id: current_component.id, initiative_slug: "asdf")
30
+ redirect_to EngineRouter.admin_proxy(current_component).participatory_texts_path
31
31
  end
32
32
 
33
33
  on(:invalid) do
@@ -49,7 +49,7 @@ module Decidim
49
49
  UpdateParticipatoryText.call(@preview_form) do
50
50
  on(:ok) do
51
51
  flash[:notice] = I18n.t("participatory_texts.update.success", scope: "decidim.proposals.admin")
52
- redirect_to participatory_texts_path(component_id: current_component.id, initiative_slug: "asdf")
52
+ redirect_to EngineRouter.admin_proxy(current_component).participatory_texts_path
53
53
  end
54
54
 
55
55
  on(:invalid) do |failures|
@@ -85,7 +85,7 @@ module Decidim
85
85
  DiscardParticipatoryText.call(current_component) do
86
86
  on(:ok) do
87
87
  flash[:notice] = I18n.t("participatory_texts.discard.success", scope: "decidim.proposals.admin")
88
- redirect_to participatory_texts_path(component_id: current_component.id, initiative_slug: "asdf")
88
+ redirect_to EngineRouter.admin_proxy(current_component).participatory_texts_path
89
89
  end
90
90
  end
91
91
  end
@@ -24,6 +24,7 @@ module Decidim
24
24
  def index
25
25
  @collaborative_drafts = search
26
26
  .results
27
+ .not_hidden
27
28
  .includes(:category)
28
29
  .includes(:scope)
29
30
 
@@ -32,6 +33,7 @@ module Decidim
32
33
  end
33
34
 
34
35
  def show
36
+ raise ActionController::RoutingError, "Not Found" unless retrieve_collaborative_draft
35
37
  @report_form = form(Decidim::ReportForm).from_params(reason: "spam")
36
38
  @request_access_form = form(RequestAccessToCollaborativeDraftForm).from_params({})
37
39
  @accept_request_form = form(AcceptAccessToCollaborativeDraftForm).from_params({})
@@ -96,6 +98,7 @@ module Decidim
96
98
  enforce_permission_to :edit, :collaborative_draft, collaborative_draft: @collaborative_draft
97
99
 
98
100
  @form = form(CollaborativeDraftForm).from_model(@collaborative_draft)
101
+ @form.attachment = form(AttachmentForm).from_model(@collaborative_draft.attachments.first)
99
102
  end
100
103
 
101
104
  def update
@@ -153,7 +156,7 @@ module Decidim
153
156
  end
154
157
 
155
158
  def retrieve_collaborative_draft
156
- @collaborative_draft = CollaborativeDraft.where(component: current_component).find(params[:id])
159
+ @collaborative_draft = CollaborativeDraft.not_hidden.where(component: current_component).find_by(id: params[:id])
157
160
  end
158
161
 
159
162
  def geocoded_collaborative_draft
@@ -53,6 +53,7 @@ module Decidim
53
53
  end
54
54
 
55
55
  def show
56
+ raise ActionController::RoutingError, "Not Found" unless set_proposal
56
57
  @report_form = form(Decidim::ReportForm).from_params(reason: "spam")
57
58
  end
58
59
 
@@ -204,8 +205,8 @@ module Decidim
204
205
  flash[:notice] = I18n.t("proposals.update.success", scope: "decidim")
205
206
  redirect_to Decidim::ResourceLocatorPresenter.new(@proposal).path
206
207
  end
207
- on(:invalid) do
208
- flash[:alert] = I18n.t("proposals.update.error", scope: "decidim")
208
+ on(:has_supports) do
209
+ flash[:alert] = I18n.t("proposals.withdraw.errors.has_supports", scope: "decidim")
209
210
  redirect_to Decidim::ResourceLocatorPresenter.new(@proposal).path
210
211
  end
211
212
  end
@@ -241,7 +242,7 @@ module Decidim
241
242
  end
242
243
 
243
244
  def set_proposal
244
- @proposal = Proposal.published.not_hidden.where(component: current_component).find(params[:id])
245
+ @proposal = Proposal.published.not_hidden.where(component: current_component).find_by(id: params[:id])
245
246
  end
246
247
 
247
248
  def form_proposal_params
@@ -8,11 +8,14 @@ module Decidim
8
8
  class ImportParticipatoryTextForm < Decidim::Form
9
9
  include TranslatableAttributes
10
10
 
11
+ ACCEPTED_MIME_TYPES = Decidim::Proposals::DocToMarkdown::ACCEPTED_MIME_TYPES
12
+
11
13
  translatable_attribute :title, String
12
14
  translatable_attribute :description, String
13
15
  attribute :document
14
16
 
15
17
  validates :title, translatable_presence: true
18
+ validate :accepted_mime_type
16
19
 
17
20
  def default_locale
18
21
  current_participatory_space.organization.default_locale
@@ -25,6 +28,17 @@ module Decidim
25
28
  def document_type
26
29
  document.content_type
27
30
  end
31
+
32
+ def accepted_mime_type
33
+ accepted_mime_types = ACCEPTED_MIME_TYPES.values + [Decidim::Proposals::DocToMarkdown::TEXT_PLAIN_MIME_TYPE]
34
+ return if accepted_mime_types.include?(document_type)
35
+
36
+ errors.add(:document,
37
+ I18n.t("activemodel.errors.models.participatory_text.attributes.document.invalid_document_type",
38
+ valid_mime_types: ACCEPTED_MIME_TYPES.keys.map do |m|
39
+ I18n.t("decidim.proposals.admin.participatory_texts.new_import.accepted_mime_types.#{m}")
40
+ end.join(", ")))
41
+ end
28
42
  end
29
43
  end
30
44
  end
@@ -6,7 +6,7 @@ module Decidim
6
6
  # A form object to be used when admin users want to review a collection of proposals
7
7
  # from a participatory text.
8
8
  class PreviewParticipatoryTextForm < Decidim::Form
9
- attribute :proposals, Array[ProposalForm]
9
+ attribute :proposals, Array[Decidim::Proposals::Admin::ProposalForm]
10
10
 
11
11
  def from_models(proposals)
12
12
  self.proposals = proposals.collect do |proposal|
@@ -10,6 +10,7 @@ module Decidim
10
10
 
11
11
  attribute :origin_component_id, Integer
12
12
  attribute :import_proposals, Boolean
13
+ attribute :keep_authors, Boolean
13
14
  attribute :states, Array
14
15
 
15
16
  validates :origin_component_id, :origin_component, :states, :current_component, presence: true
@@ -21,6 +21,20 @@ module Decidim
21
21
  translated_attribute(participatory_text.title)
22
22
  end
23
23
  end
24
+
25
+ # Public: A formatted collection of mime_type to be used
26
+ # in forms.
27
+ def mime_types_with_document_examples
28
+ links = ""
29
+ accepted_mime_types = Decidim::Proposals::DocToMarkdown::ACCEPTED_MIME_TYPES.keys
30
+ accepted_mime_types.each_with_index do |mime_type, index|
31
+ links += link_to t(".accepted_mime_types.#{mime_type}"),
32
+ asset_path("decidim/proposals/participatory_texts/participatory_text.#{mime_type}"),
33
+ download: "participatory_text.#{mime_type}"
34
+ links += ", " unless accepted_mime_types.length == index + 1
35
+ end
36
+ links
37
+ end
24
38
  end
25
39
  end
26
40
  end
@@ -132,6 +132,19 @@ module Decidim
132
132
  end
133
133
  end
134
134
 
135
+ # Renders the back link except for step_2: compare
136
+ def proposal_wizard_aside_link_to_back(step)
137
+ url = case step
138
+ when :step_1
139
+ proposals_path
140
+ when :step_3
141
+ compare_proposal_path
142
+ when :step_4
143
+ edit_draft_proposal_path
144
+ end
145
+ url
146
+ end
147
+
135
148
  def wizard_aside_back_text
136
149
  case type_of
137
150
  when :collaborative_drafts
@@ -52,6 +52,11 @@ module Decidim
52
52
  def published?
53
53
  state == "published"
54
54
  end
55
+
56
+ # Public: Overrides the `reported_content_url` Reportable concern method.
57
+ def reported_content_url
58
+ ResourceLocatorPresenter.new(self).url
59
+ end
55
60
  end
56
61
  end
57
62
  end
@@ -122,6 +122,8 @@ module Decidim
122
122
  can_publish_collaborative_draft?
123
123
  when :request_access
124
124
  can_request_access_collaborative_draft?
125
+ when :react_to_request_access
126
+ can_react_to_request_access_collaborative_draft?
125
127
  end
126
128
  end
127
129
 
@@ -129,23 +131,35 @@ module Decidim
129
131
  @collaborative_draft ||= context.fetch(:collaborative_draft, nil)
130
132
  end
131
133
 
134
+ def collaborative_drafts_enabled?
135
+ component_settings.collaborative_drafts_enabled
136
+ end
137
+
132
138
  def can_create_collaborative_draft?
133
- toggle_allow(authorized?(:create) && current_settings&.creation_enabled? && component_settings&.collaborative_drafts_enabled?)
139
+ return toggle_allow(false) unless collaborative_drafts_enabled?
140
+ toggle_allow(current_settings&.creation_enabled? && authorized?(:create))
134
141
  end
135
142
 
136
143
  def can_edit_collaborative_draft?
137
- toggle_allow(collaborative_draft.open? && collaborative_draft.editable_by?(user) && component_settings&.collaborative_drafts_enabled?)
144
+ return toggle_allow(false) unless collaborative_drafts_enabled? && collaborative_draft.open?
145
+ toggle_allow(collaborative_draft.editable_by?(user))
138
146
  end
139
147
 
140
148
  def can_publish_collaborative_draft?
141
- toggle_allow(collaborative_draft.open? && collaborative_draft.editable_by?(user) && component_settings&.collaborative_drafts_enabled?)
149
+ return toggle_allow(false) unless collaborative_drafts_enabled? && collaborative_draft.open?
150
+ toggle_allow(collaborative_draft.created_by?(user))
142
151
  end
143
152
 
144
153
  def can_request_access_collaborative_draft?
145
- return toggle_allow(false) unless collaborative_draft.open? && component_settings&.collaborative_drafts_enabled?
146
- return toggle_allow(false) if collaborative_draft.editable_by?(user)
154
+ return toggle_allow(false) unless collaborative_drafts_enabled? && collaborative_draft.open?
155
+ return toggle_allow(false) if collaborative_draft.requesters.include?(user)
156
+ toggle_allow(!collaborative_draft.editable_by?(user))
157
+ end
158
+
159
+ def can_react_to_request_access_collaborative_draft?
160
+ return toggle_allow(false) unless collaborative_drafts_enabled? && collaborative_draft.open?
147
161
  return toggle_allow(false) if collaborative_draft.requesters.include? user
148
- toggle_allow(collaborative_draft && !collaborative_draft.editable_by?(user))
162
+ toggle_allow(collaborative_draft.created_by?(user))
149
163
  end
150
164
  end
151
165
  end
@@ -19,10 +19,14 @@ module Decidim
19
19
  components = Decidim::Component.where(participatory_space: spaces).published
20
20
  @query = Decidim::Proposals::Proposal.where(component: components).joins(:component)
21
21
  .left_outer_joins(:category)
22
- @query = @query.where("decidim_proposals_proposals.published_at <= ?", end_time).accepted
22
+ @query = @query.where("decidim_proposals_proposals.created_at <= ?", end_time).accepted
23
23
  @query = @query.group("decidim_categorizations.id", :participatory_space_type, :participatory_space_id)
24
24
  @query
25
25
  end
26
+
27
+ def quantity
28
+ @quantity ||= query.where("decidim_proposals_proposals.created_at >= ?", start_time).count
29
+ end
26
30
  end
27
31
  end
28
32
  end
@@ -32,12 +32,12 @@ module Decidim
32
32
  return @query if @query
33
33
 
34
34
  spaces = Decidim.participatory_space_manifests.flat_map do |manifest|
35
- manifest.participatory_spaces.call(@organization).public_spaces
35
+ manifest.participatory_spaces.call(@organization)
36
36
  end
37
37
  components = Decidim::Component.where(participatory_space: spaces).published
38
38
  @query = Decidim::Proposals::Proposal.where(component: components).joins(:component)
39
39
  .left_outer_joins(:category)
40
- @query = @query.where("decidim_proposals_proposals.published_at <= ?", end_time).except_withdrawn
40
+ @query = @query.where("decidim_proposals_proposals.published_at <= ?", end_time).except_withdrawn.not_hidden
41
41
  @query = @query.group("decidim_categorizations.decidim_category_id",
42
42
  :participatory_space_type,
43
43
  :participatory_space_id)