decidim-surveys 0.28.4 → 0.29.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 50f4087ca29b97b5724267c979543314276bb20849f41dba8fe134518de5b08d
4
- data.tar.gz: 0f465313580a6d47955ae2b7c3dec6d5d09c4138e6cdec441ee4b6596d1e9efb
3
+ metadata.gz: 5bdae9a39be6faded76b89b6c294c13ae2666b4cdd6e2b9763e556a059a68f25
4
+ data.tar.gz: 4bfab3b57c171e2ba3014a2def14ef6e46b0c3a5b41a31f6633d6701b070a1d9
5
5
  SHA512:
6
- metadata.gz: fcf278153d37a174bde9307690711c8d3370c9557da2c8b1e2a0db78852f768b7e2d50d67543b47cae4a8af9df369f309a7c666b916a5c8e8f75ae75fe78cd21
7
- data.tar.gz: 60216260d4623a494982a75d014aefbb9aa6f8fc78d0e0e89a6e5abd5458a71f69fceaa15f673d924f4a08401cf220f7383afb4fba6fe9e3fcf92ec5fc1186e5
6
+ metadata.gz: d0c9754f2bfd02c879f608fe6595f5cd750c32cd99d3a46b3ef4b3d7e766e72e962949e1cda8efa387683ab7940ba8f2d667bd894b217bd8afb3dafda8ae657a
7
+ data.tar.gz: 81ce1b448e4207e8e864dab2418596834e1e84e73efbf1ddfab2f0be5048d8cf31d1a154223f1bf647c8e95fdbc96052e212f54d64a24888868792cf7dd3a9ad
@@ -1,3 +1,3 @@
1
- <p class="confimation-survey-answers">
1
+ <p class="confirmation-survey-answers">
2
2
  <%= t(".body", questionnaire_title: @questionnaire_title, participatory_space: @participatory_space_title) %>
3
3
  </p>
@@ -1,7 +1,7 @@
1
1
  <div class="row">
2
- <div class="columns large-6 medium-centered">
2
+ <div class="columns large-6">
3
3
  <div class="card">
4
- <div class="card__content">
4
+ <div>
5
5
  <%= cell "decidim/authorization_modal", authorizations %>
6
6
  </div>
7
7
  </div>
@@ -41,7 +41,7 @@ fi:
41
41
  email_subject: Kysely on päättynyt kohteessa %{participatory_space_title}
42
42
  notification_title: Kysely <a href="%{resource_path}">%{resource_title}</a> kohteessa <a href="%{participatory_space_url}">%{participatory_space_title}</a> on päättynyt.
43
43
  survey_opened:
44
- email_intro: 'Kysely %{resource_title} kohteessa %{participatory_space_title} on nyt auki. Voit osallistua siihen sivulta:'
44
+ email_intro: 'Kysely %{resource_title} kohteessa %{participatory_space_title} on nyt auki. Voit osallistua siihen tällä sivulla:'
45
45
  email_outro: Tämä ilmoitus on lähetetty sinulle, koska seuraat kohdetta %{participatory_space_title}. Voit lopettaa ilmoitusten vastaanottamisen edellä esitetyn linkin kautta.
46
46
  email_subject: Uusi kysely kohteessa %{participatory_space_title}
47
47
  notification_title: Kysely <a href="%{resource_path}">%{resource_title}</a> kohteessa <a href="%{participatory_space_url}">%{participatory_space_title}</a> on nyt auki.
@@ -3,7 +3,7 @@ sv:
3
3
  activemodel:
4
4
  models:
5
5
  decidim/surveys/closed_survey_event: Enkäten avslutades
6
- decidim/surveys/opened_survey_event: Enkäten startade
6
+ decidim/surveys/opened_survey_event: Enkäten startades
7
7
  activerecord:
8
8
  models:
9
9
  decidim/surveys/survey:
@@ -22,16 +22,16 @@ sv:
22
22
  global:
23
23
  announcement: Meddelande
24
24
  clean_after_publish: Ta bort svar vid publicering av enkäten
25
- ends_at: Öppet för svar till
26
- ends_at_help: Lämna tomt för att inte ha något slutdatum
27
- scope_id: Indelning
28
- scopes_enabled: Aktivera indelningar
29
- starts_at: Öppet för svar från
30
- starts_at_help: Lämna tomt för att inte ha något startdatum
25
+ ends_at: Svar accepterade tills
26
+ ends_at_help: Lämna tomt för inget slutdatum
27
+ scope_id: Omfång
28
+ scopes_enabled: Omfång aktiverade
29
+ starts_at: Svar accepterade från
30
+ starts_at_help: Lämna tomt för inget startdatum
31
31
  step:
32
32
  allow_answers: Tillåt svar
33
33
  allow_unregistered: Tillåt ej registrerade användare att besvara enkäten
34
- allow_unregistered_help: Om aktiv kommer ingen inloggning att krävas för att besvara enkäten. Detta kan leda till dålig eller opålitlig data och det kommer att vara mer sårbart för automatiserade attacker. Använd med försiktighet! Tänk att en deltagare kunde svara samma enkät flera gånger, genom att använda olika webbläsare eller "privat surfning" i sin webbläsare.
34
+ allow_unregistered_help: Om valt krävs det ingen inloggning för att besvara enkäten. Detta kan leda till dåliga eller opålitliga data och det kommer att vara mer sårbart för automatiserade attacker. Använd med försiktighet! Det blir också möjligt för en deltagare att besvara enkäten flera gånger igenom att använda olika webbläsare eller surfa privat.
35
35
  announcement: Meddelande
36
36
  events:
37
37
  surveys:
@@ -54,24 +54,13 @@ sv:
54
54
  answers_count: Svar
55
55
  surveys:
56
56
  admin:
57
- component:
58
- actions:
59
- answers_alert: Om du publicerar komponenten kommer alla resultat att tas bort.
60
57
  exports:
61
58
  survey_user_answers: Svar från enkätdeltagarna
62
59
  surveys:
63
60
  update:
64
61
  invalid: Det gick inte att spara enkäten.
65
62
  success: Enkäten har sparats.
66
- last_activity:
67
- new_survey: 'Ny enkät:'
68
- survey_confirmation_mailer:
69
- confirmation:
70
- body: Du har besvarat enkäten %{questionnaire_title} för %{participatory_space}
71
- subject: Svarsbekräftelse för formuläret %{questionnaire_title}
72
- export_name: Enkätsvar
73
63
  surveys:
74
64
  answer:
75
65
  invalid: Det gick inte att besvara enkäten.
76
- spam_detected: Det gick inte att svara på formuläret. Kanske har du varit för snabb, kan du försöka igen?
77
66
  success: Enkäten har besvarats.
@@ -19,7 +19,7 @@ Gem::Specification.new do |s|
19
19
  "homepage_uri" => "https://decidim.org",
20
20
  "source_code_uri" => "https://github.com/decidim/decidim"
21
21
  }
22
- s.required_ruby_version = "~> 3.1.0"
22
+ s.required_ruby_version = "~> 3.2.0"
23
23
 
24
24
  s.name = "decidim-surveys"
25
25
  s.summary = "Decidim surveys module"
@@ -4,7 +4,7 @@ module Decidim
4
4
  # This holds the decidim-surveys version.
5
5
  module Surveys
6
6
  def self.version
7
- "0.28.4"
7
+ "0.29.0.rc1"
8
8
  end
9
9
  end
10
10
  end
@@ -0,0 +1,94 @@
1
+ # frozen_string_literal: true
2
+
3
+ namespace :decidim_surveys do
4
+ namespace :upgrade do
5
+ desc "Migrates data from decidim_surveys tables to decidim_forms tables"
6
+ task migrate_data_to_decidim_forms: :environment do
7
+ class Answer < ApplicationRecord
8
+ self.table_name = :decidim_surveys_survey_answers
9
+ end
10
+
11
+ class AnswerChoice < ApplicationRecord
12
+ self.table_name = :decidim_surveys_survey_answer_choices
13
+ end
14
+
15
+ class AnswerOption < ApplicationRecord
16
+ self.table_name = :decidim_surveys_survey_answer_options
17
+ end
18
+
19
+ class Question < ApplicationRecord
20
+ self.table_name = :decidim_surveys_survey_questions
21
+ end
22
+
23
+ unless [Answer, AnswerChoice, AnswerOption, Question].all? { |model| ActiveRecord::Base.connection.table_exists? model.table_name }
24
+ puts "ERROR: There are not all the necessary surveys tables. Have you already migrated the data?"
25
+ next
26
+ end
27
+
28
+ ActiveRecord::Base.transaction do
29
+ Decidim::Surveys::Survey.find_each do |survey|
30
+ puts "Migrating survey #{survey.id}..."
31
+
32
+ questionnaire = Decidim::Forms::Questionnaire.create!(
33
+ questionnaire_for: survey,
34
+ title: survey.title,
35
+ description: survey.description,
36
+ tos: survey.tos,
37
+ published_at: survey.published_at,
38
+ created_at: survey.created_at,
39
+ updated_at: survey.updated_at
40
+ )
41
+
42
+ Question.where(decidim_survey_id: survey.id).find_each do |survey_question|
43
+ puts "Migrating question #{survey_question.id}..."
44
+
45
+ question = Decidim::Forms::Question.create!(
46
+ questionnaire:,
47
+ position: survey_question.position,
48
+ question_type: survey_question.question_type,
49
+ mandatory: survey_question.mandatory,
50
+ body: survey_question.body,
51
+ description: survey_question.description,
52
+ max_choices: survey_question.max_choices,
53
+ created_at: survey_question.created_at,
54
+ updated_at: survey_question.updated_at
55
+ )
56
+
57
+ # A hash with the old answer_option id as key, and the new form answer option as value
58
+ answer_option_mapping = {}
59
+
60
+ AnswerOption.where(decidim_survey_question_id: survey_question.id).find_each do |survey_answer_option|
61
+ answer_option_mapping[survey_answer_option.id] = Decidim::Forms::AnswerOption.create!(
62
+ question:,
63
+ body: survey_answer_option.body,
64
+ free_text: survey_answer_option.free_text
65
+ )
66
+ end
67
+
68
+ Answer.where(decidim_survey_id: survey.id, decidim_survey_question_id: survey_question.id).find_each do |survey_answer|
69
+ answer = Decidim::Forms::Answer.new(
70
+ questionnaire:,
71
+ question:,
72
+ decidim_user_id: survey_answer.decidim_user_id,
73
+ body: survey_answer.body,
74
+ created_at: survey_answer.created_at,
75
+ updated_at: survey_answer.updated_at
76
+ )
77
+
78
+ AnswerChoice.where(decidim_survey_answer_id: survey_answer.id).find_each do |survey_answer_choice|
79
+ answer.choices.build(
80
+ answer_option: answer_option_mapping[survey_answer_choice.decidim_survey_answer_option_id],
81
+ body: survey_answer_choice.body,
82
+ custom_body: survey_answer_choice.custom_body,
83
+ position: survey_answer_choice.position
84
+ )
85
+ end
86
+
87
+ answer.save!
88
+ end
89
+ end
90
+ end
91
+ end
92
+ end
93
+ end
94
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: decidim-surveys
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.28.4
4
+ version: 0.29.0.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josep Jaume Rey Peroy
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2024-10-02 00:00:00.000000000 Z
13
+ date: 2024-07-16 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: decidim-core
@@ -18,84 +18,84 @@ dependencies:
18
18
  requirements:
19
19
  - - '='
20
20
  - !ruby/object:Gem::Version
21
- version: 0.28.4
21
+ version: 0.29.0.rc1
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
26
  - - '='
27
27
  - !ruby/object:Gem::Version
28
- version: 0.28.4
28
+ version: 0.29.0.rc1
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: decidim-forms
31
31
  requirement: !ruby/object:Gem::Requirement
32
32
  requirements:
33
33
  - - '='
34
34
  - !ruby/object:Gem::Version
35
- version: 0.28.4
35
+ version: 0.29.0.rc1
36
36
  type: :runtime
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
40
  - - '='
41
41
  - !ruby/object:Gem::Version
42
- version: 0.28.4
42
+ version: 0.29.0.rc1
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: decidim-admin
45
45
  requirement: !ruby/object:Gem::Requirement
46
46
  requirements:
47
47
  - - '='
48
48
  - !ruby/object:Gem::Version
49
- version: 0.28.4
49
+ version: 0.29.0.rc1
50
50
  type: :development
51
51
  prerelease: false
52
52
  version_requirements: !ruby/object:Gem::Requirement
53
53
  requirements:
54
54
  - - '='
55
55
  - !ruby/object:Gem::Version
56
- version: 0.28.4
56
+ version: 0.29.0.rc1
57
57
  - !ruby/object:Gem::Dependency
58
58
  name: decidim-dev
59
59
  requirement: !ruby/object:Gem::Requirement
60
60
  requirements:
61
61
  - - '='
62
62
  - !ruby/object:Gem::Version
63
- version: 0.28.4
63
+ version: 0.29.0.rc1
64
64
  type: :development
65
65
  prerelease: false
66
66
  version_requirements: !ruby/object:Gem::Requirement
67
67
  requirements:
68
68
  - - '='
69
69
  - !ruby/object:Gem::Version
70
- version: 0.28.4
70
+ version: 0.29.0.rc1
71
71
  - !ruby/object:Gem::Dependency
72
72
  name: decidim-participatory_processes
73
73
  requirement: !ruby/object:Gem::Requirement
74
74
  requirements:
75
75
  - - '='
76
76
  - !ruby/object:Gem::Version
77
- version: 0.28.4
77
+ version: 0.29.0.rc1
78
78
  type: :development
79
79
  prerelease: false
80
80
  version_requirements: !ruby/object:Gem::Requirement
81
81
  requirements:
82
82
  - - '='
83
83
  - !ruby/object:Gem::Version
84
- version: 0.28.4
84
+ version: 0.29.0.rc1
85
85
  - !ruby/object:Gem::Dependency
86
86
  name: decidim-templates
87
87
  requirement: !ruby/object:Gem::Requirement
88
88
  requirements:
89
89
  - - '='
90
90
  - !ruby/object:Gem::Version
91
- version: 0.28.4
91
+ version: 0.29.0.rc1
92
92
  type: :development
93
93
  prerelease: false
94
94
  version_requirements: !ruby/object:Gem::Requirement
95
95
  requirements:
96
96
  - - '='
97
97
  - !ruby/object:Gem::Version
98
- version: 0.28.4
98
+ version: 0.29.0.rc1
99
99
  description: A surveys component for decidim's participatory spaces.
100
100
  email:
101
101
  - josepjaume@gmail.com
@@ -246,7 +246,7 @@ files:
246
246
  - lib/decidim/surveys/seeds.rb
247
247
  - lib/decidim/surveys/test/factories.rb
248
248
  - lib/decidim/surveys/version.rb
249
- - lib/tasks/decidim_surveys_tasks.rake
249
+ - lib/tasks/surveys/upgrade/decidim_surveys_upgrade_tasks.rake
250
250
  homepage: https://decidim.org
251
251
  licenses:
252
252
  - AGPL-3.0
@@ -264,14 +264,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
264
264
  requirements:
265
265
  - - "~>"
266
266
  - !ruby/object:Gem::Version
267
- version: 3.1.0
267
+ version: 3.2.0
268
268
  required_rubygems_version: !ruby/object:Gem::Requirement
269
269
  requirements:
270
- - - ">="
270
+ - - ">"
271
271
  - !ruby/object:Gem::Version
272
- version: '0'
272
+ version: 1.3.1
273
273
  requirements: []
274
- rubygems_version: 3.3.7
274
+ rubygems_version: 3.4.10
275
275
  signing_key:
276
276
  specification_version: 4
277
277
  summary: Decidim surveys module
@@ -1,92 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- namespace :decidim_surveys do
4
- desc "Migrate data from decidim_surveys tables to decidim_forms tables"
5
- task migrate_data_to_decidim_forms: :environment do
6
- class Answer < ApplicationRecord
7
- self.table_name = :decidim_surveys_survey_answers
8
- end
9
-
10
- class AnswerChoice < ApplicationRecord
11
- self.table_name = :decidim_surveys_survey_answer_choices
12
- end
13
-
14
- class AnswerOption < ApplicationRecord
15
- self.table_name = :decidim_surveys_survey_answer_options
16
- end
17
-
18
- class Question < ApplicationRecord
19
- self.table_name = :decidim_surveys_survey_questions
20
- end
21
-
22
- unless [Answer, AnswerChoice, AnswerOption, Question].all? { |model| ActiveRecord::Base.connection.table_exists? model.table_name }
23
- puts "ERROR: There are not all the necessary surveys tables. Have you already migrated the data?"
24
- next
25
- end
26
-
27
- ActiveRecord::Base.transaction do
28
- Decidim::Surveys::Survey.find_each do |survey|
29
- puts "Migrating survey #{survey.id}..."
30
-
31
- questionnaire = Decidim::Forms::Questionnaire.create!(
32
- questionnaire_for: survey,
33
- title: survey.title,
34
- description: survey.description,
35
- tos: survey.tos,
36
- published_at: survey.published_at,
37
- created_at: survey.created_at,
38
- updated_at: survey.updated_at
39
- )
40
-
41
- Question.where(decidim_survey_id: survey.id).find_each do |survey_question|
42
- puts "Migrating question #{survey_question.id}..."
43
-
44
- question = Decidim::Forms::Question.create!(
45
- questionnaire:,
46
- position: survey_question.position,
47
- question_type: survey_question.question_type,
48
- mandatory: survey_question.mandatory,
49
- body: survey_question.body,
50
- description: survey_question.description,
51
- max_choices: survey_question.max_choices,
52
- created_at: survey_question.created_at,
53
- updated_at: survey_question.updated_at
54
- )
55
-
56
- # A hash with the old answer_option id as key, and the new form answer option as value
57
- answer_option_mapping = {}
58
-
59
- AnswerOption.where(decidim_survey_question_id: survey_question.id).find_each do |survey_answer_option|
60
- answer_option_mapping[survey_answer_option.id] = Decidim::Forms::AnswerOption.create!(
61
- question:,
62
- body: survey_answer_option.body,
63
- free_text: survey_answer_option.free_text
64
- )
65
- end
66
-
67
- Answer.where(decidim_survey_id: survey.id, decidim_survey_question_id: survey_question.id).find_each do |survey_answer|
68
- answer = Decidim::Forms::Answer.new(
69
- questionnaire:,
70
- question:,
71
- decidim_user_id: survey_answer.decidim_user_id,
72
- body: survey_answer.body,
73
- created_at: survey_answer.created_at,
74
- updated_at: survey_answer.updated_at
75
- )
76
-
77
- AnswerChoice.where(decidim_survey_answer_id: survey_answer.id).find_each do |survey_answer_choice|
78
- answer.choices.build(
79
- answer_option: answer_option_mapping[survey_answer_choice.decidim_survey_answer_option_id],
80
- body: survey_answer_choice.body,
81
- custom_body: survey_answer_choice.custom_body,
82
- position: survey_answer_choice.position
83
- )
84
- end
85
-
86
- answer.save!
87
- end
88
- end
89
- end
90
- end
91
- end
92
- end