decidim-surveys 0.4.2 → 0.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/decidim/surveys/feature.rb +16 -1
- data/lib/decidim/surveys/test/factories.rb +0 -3
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 48533ca887256da1dee624731d6c3e1a4335e348
|
4
|
+
data.tar.gz: 8cfb871cdfb4dd5acef6a85ba8eb40dc8a4f965d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c4383d2f2503a8d2f5d035dd55a3c7fd6d4491d6329bb05e951393a0ef6b11312d84cfba437b5de6ceaa1361a15165c18d9e2cd832553eb840e6714488514f68
|
7
|
+
data.tar.gz: ffc94c9271bad995c3dd36c541e612ca73d21667a67ea23cd1fbf3e5a7e36ff9f80eb484b9caaaba53e7b72fca529fa04d47037c342b43b6e99b6757c50f0e7c
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
require "decidim/features/namer"
|
4
4
|
|
5
5
|
Decidim.register_feature(:surveys) do |feature|
|
6
6
|
feature.engine = Decidim::Surveys::Engine
|
@@ -20,6 +20,21 @@ Decidim.register_feature(:surveys) do |feature|
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
+
feature.register_stat :surveys_count do |features, start_at, end_at|
|
24
|
+
surveys = Decidim::Surveys::Survey.where(feature: features)
|
25
|
+
surveys = surveys.where("created_at >= ?", start_at) if start_at.present?
|
26
|
+
surveys = surveys.where("created_at <= ?", end_at) if end_at.present?
|
27
|
+
surveys.count
|
28
|
+
end
|
29
|
+
|
30
|
+
feature.register_stat :answers_count, priority: Decidim::StatsRegistry::HIGH_PRIORITY do |features, start_at, end_at|
|
31
|
+
surveys = Decidim::Surveys::Survey.where(feature: features)
|
32
|
+
answers = Decidim::Surveys::SurveyAnswer.where(survey: surveys)
|
33
|
+
answers = answers.where("created_at >= ?", start_at) if start_at.present?
|
34
|
+
answers = answers.where("created_at <= ?", end_at) if end_at.present?
|
35
|
+
answers.group(:decidim_user_id).count.size
|
36
|
+
end
|
37
|
+
|
23
38
|
# These actions permissions can be configured in the admin panel
|
24
39
|
feature.actions = %w(answer)
|
25
40
|
|
@@ -1,8 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "decidim/core/test/factories"
|
4
|
-
require "decidim/admin/test/factories"
|
5
|
-
|
6
3
|
FactoryGirl.define do
|
7
4
|
factory :surveys_feature, parent: :feature do
|
8
5
|
name { Decidim::Features::Namer.new(participatory_process.organization.available_locales, :surveys).i18n_name }
|
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.4.
|
4
|
+
version: 0.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josep Jaume Rey Peroy
|
@@ -18,14 +18,14 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - '='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 0.4.
|
21
|
+
version: 0.4.3
|
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.4.
|
28
|
+
version: 0.4.3
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
30
|
name: jquery-tmpl-rails
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
@@ -46,14 +46,14 @@ dependencies:
|
|
46
46
|
requirements:
|
47
47
|
- - '='
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version: 0.4.
|
49
|
+
version: 0.4.3
|
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.4.
|
56
|
+
version: 0.4.3
|
57
57
|
description: A component for decidim's participatory processes.
|
58
58
|
email:
|
59
59
|
- josepjaume@gmail.com
|