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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a023de05624d58080ef55e782767edad96974d50
4
- data.tar.gz: 38d6c6370b3d5f1286f09c756ffa11254d43d1f7
3
+ metadata.gz: 48533ca887256da1dee624731d6c3e1a4335e348
4
+ data.tar.gz: 8cfb871cdfb4dd5acef6a85ba8eb40dc8a4f965d
5
5
  SHA512:
6
- metadata.gz: aed5673016c84935d92c5dd8baa524873e42100b316a0a4a032453a1c0ed70ec808c4bf470d8475d8d3e797d94775174c19fc64d08b095cf70d08e3f7a371381
7
- data.tar.gz: 802536a34dd0d643fc01e98ecba584c377f74695015916267605a7bd35b4727246d4c663a9286770bacaf94257fe66829b0a101c562cd5b5bcbdbd1f5dceb295
6
+ metadata.gz: c4383d2f2503a8d2f5d035dd55a3c7fd6d4491d6329bb05e951393a0ef6b11312d84cfba437b5de6ceaa1361a15165c18d9e2cd832553eb840e6714488514f68
7
+ data.tar.gz: ffc94c9271bad995c3dd36c541e612ca73d21667a67ea23cd1fbf3e5a7e36ff9f80eb484b9caaaba53e7b72fca529fa04d47037c342b43b6e99b6757c50f0e7c
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_dependency "decidim/features/namer"
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.2
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.2
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.2
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.2
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.2
56
+ version: 0.4.3
57
57
  description: A component for decidim's participatory processes.
58
58
  email:
59
59
  - josepjaume@gmail.com