abstractor 1.0.19 → 1.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/app/views/abstractor/abstractor_abstractions/_fields.html.haml +1 -1
- data/app/views/abstractor/abstractor_abstractions/_list.html.haml +3 -0
- data/config/routes.rb +3 -0
- data/lib/abstractor/methods/controllers/abstractor_abstraction_groups_controller.rb +1 -2
- data/lib/abstractor/methods/controllers/abstractor_abstractions_controller.rb +9 -0
- data/lib/abstractor/methods/models/abstractor_abstraction.rb +81 -29
- data/lib/abstractor/methods/models/abstractor_abstraction_group.rb +0 -44
- data/lib/abstractor/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZDg1YWM0MWMxN2ZlMTM1N2IxYTBjMTNhZTg3MGFlMDM5MjJhYWM0NQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NmZmM2ZmNjI2YTg5MmE4OGNkN2ZkMmU5MDkzNjIwMGExNDEwMDRlMA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NWQ1YWRjNzc5YWNlMGMxMGVjNmE4OTM5ZjhmMWE1ZDc4NWVjOGFlZmRlYzQ2
|
10
|
+
MTkxNzM2ZjUwZDQwMTJiN2EzZjFjMDc2NWFmMGZhODJlNWU0MmYyMDRlMjE3
|
11
|
+
ZTEwOTZlNjRmMDQ3ODM0ZjhjZWYyZjcyODMyZWFkMjNlZmYxNjk=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MDU2ZTJkNWVkN2Y2ODg0MjVhYjE4ZWVmNGI0ZjMwMzM3MWRmNTBjYWRmNmNm
|
14
|
+
NGZjYjBjOWIwMWVmMWEzNTkyY2EwNDdjNzdmMzI2ZDU0OGUzNzc1MzYzOTUz
|
15
|
+
ZjAyMzcwYThlZmM1ZDc3OWY0NGI4OTZjN2QzYTA1NjNmNGJmNTM=
|
@@ -53,7 +53,7 @@
|
|
53
53
|
= f.label :abstractor_suggestion_status_id, value.first, value: value.last
|
54
54
|
%br
|
55
55
|
= f.radio_button :abstractor_suggestion_status_id, '', {:style => 'display:none;' }
|
56
|
-
|
56
|
+
%hr
|
57
57
|
- else
|
58
58
|
.column-9
|
59
59
|
- abstractor_abstraction.abstractor_subject.abstractor_abstraction_sources.each do |abstractor_abstraction_source|
|
@@ -1,5 +1,8 @@
|
|
1
1
|
- about ||= @about
|
2
2
|
.abstractor_abstractions
|
3
|
+
= link_to 'Not applicable all', Abstractor::UserInterface.abstractor_relative_path(abstractor.update_all_abstractor_abstractions_path(about_type: about.class, about_id: about.id, abstractor_abstraction_value: 'not applicable')), :confirm => 'Are you sure?', :method => :put, :class => "icon_link update_link"
|
4
|
+
%br
|
5
|
+
= link_to 'Unknown all', Abstractor::UserInterface.abstractor_relative_path(abstractor.update_all_abstractor_abstractions_path(about_type: about.class, about_id: about.id, abstractor_abstraction_value: 'unknown')), :confirm => 'Are you sure?', :method => :put, :class => "icon_link update_link"
|
3
6
|
- abstractor_subject_groups = Abstractor::AbstractorSubjectGroup.joins(:abstractor_subjects).where(:abstractor_subjects => {:subject_type => about.class}).order('abstractor_subject_groups.id').not_deleted.to_a.uniq
|
4
7
|
- abstractor_subject_groups.each do |abstractor_subject_group|
|
5
8
|
.abstractor_subject_groups_container
|
data/config/routes.rb
CHANGED
@@ -34,8 +34,7 @@ module Abstractor
|
|
34
34
|
|
35
35
|
def update
|
36
36
|
abstractor_abstraction_value = params[:abstractor_abstraction_value]
|
37
|
-
@abstractor_abstraction_group.
|
38
|
-
|
37
|
+
Abstractor::AbstractorAbstraction.update_abstractor_abstraction_other_value(@abstractor_abstraction_group.abstractor_abstractions, abstractor_abstraction_value)
|
39
38
|
respond_to do |format|
|
40
39
|
format.html { render action: "edit", layout: false }
|
41
40
|
end
|
@@ -31,6 +31,15 @@ module Abstractor
|
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
|
+
def update_all
|
35
|
+
abstractor_abstraction_value = params[:abstractor_abstraction_value]
|
36
|
+
@about = params[:about_type].constantize.find(params[:about_id])
|
37
|
+
Abstractor::AbstractorAbstraction.update_abstractor_abstraction_other_value(@about.abstractor_abstractions, abstractor_abstraction_value)
|
38
|
+
respond_to do |format|
|
39
|
+
format.html { redirect_to :back }
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
34
43
|
private
|
35
44
|
def set_abstractor_abstraction
|
36
45
|
@abstractor_abstraction = Abstractor::AbstractorAbstraction.find(params[:id])
|
@@ -24,45 +24,97 @@ module Abstractor
|
|
24
24
|
|
25
25
|
# Hooks
|
26
26
|
base.send :after_save, :review_matching_suggestions#, :if => lambda {|abstractor_abstraction| abstractor_abstraction.value_changed?}
|
27
|
+
|
28
|
+
base.send :extend, ClassMethods
|
29
|
+
base.send(:include, InstanceMethods)
|
27
30
|
end
|
28
31
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
32
|
+
module InstanceMethods
|
33
|
+
def review_matching_suggestions
|
34
|
+
accepted_status = Abstractor::AbstractorSuggestionStatus.where(:name => 'Accepted').first
|
35
|
+
matching_abstractor_suggestions.each do |abstractor_suggestion|
|
36
|
+
abstractor_suggestion.abstractor_suggestion_status = accepted_status
|
37
|
+
abstractor_suggestion.save!
|
38
|
+
end
|
34
39
|
end
|
35
|
-
end
|
36
40
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
41
|
+
def matching_abstractor_suggestions
|
42
|
+
unknown_values = unknown ? unknown : [unknown, nil]
|
43
|
+
not_applicable_values = not_applicable ? not_applicable : [not_applicable, nil]
|
44
|
+
suggested_values = value.blank? ? ['', nil] : value
|
45
|
+
abstractor_suggestions.where(unknown: unknown_values, not_applicable: not_applicable_values, suggested_value: suggested_values)
|
46
|
+
end
|
43
47
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
48
|
+
def display_value
|
49
|
+
if unknown
|
50
|
+
'unknown'
|
51
|
+
elsif not_applicable
|
52
|
+
'not applicable'
|
53
|
+
elsif value.blank?
|
54
|
+
'[Not set]'
|
55
|
+
else
|
56
|
+
value
|
57
|
+
end
|
53
58
|
end
|
54
|
-
end
|
55
59
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
+
def detect_abstractor_suggestion(suggested_value)
|
61
|
+
abstractor_suggestion = nil
|
62
|
+
abstractor_suggestion = abstractor_suggestions(true).detect do |abstractor_suggestion|
|
63
|
+
abstractor_suggestion.suggested_value == suggested_value
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
def unreviewed?
|
68
|
+
abstractor_suggestion_status_needs_review = Abstractor::AbstractorSuggestionStatus.where(name: 'Needs review').first
|
69
|
+
abstractor_suggestions.any? { |abstractor_suggestion| abstractor_suggestion.abstractor_suggestion_status == abstractor_suggestion_status_needs_review }
|
60
70
|
end
|
61
71
|
end
|
62
72
|
|
63
|
-
|
64
|
-
|
65
|
-
|
73
|
+
module ClassMethods
|
74
|
+
##
|
75
|
+
# Updates all abstractor abstractions passed in to 'not applicable' or 'unknown'.
|
76
|
+
#
|
77
|
+
# @param [Abstractor::Enum::ABSTRACTION_OTHER_VALUE_TYPE_UNKNOWN, Abstractor::Enum::ABSTRACTION_OTHER_VALUE_TYPE_NOT_APPLICABLE] abstraction_other_value_type contorls whether to update all abstractor abstractions in the group to 'unknown' or 'not applicable'
|
78
|
+
# @return [void]
|
79
|
+
def update_abstractor_abstraction_other_value(abstractor_abstractions, abstraction_other_value_type)
|
80
|
+
raise(ArgumentError, "abstraction_value_type argument invalid") unless Abstractor::Enum::ABSTRACTION_OTHER_VALUE_TYPES.include?(abstraction_other_value_type)
|
81
|
+
|
82
|
+
rejected_status = Abstractor::AbstractorSuggestionStatus.where(:name => 'Rejected').first
|
83
|
+
accepted_status = Abstractor::AbstractorSuggestionStatus.where(:name => 'Accepted').first
|
84
|
+
case abstraction_other_value_type
|
85
|
+
when Abstractor::Enum::ABSTRACTION_OTHER_VALUE_TYPE_UNKNOWN
|
86
|
+
unknown = true
|
87
|
+
not_applicable = false
|
88
|
+
when Abstractor::Enum::ABSTRACTION_OTHER_VALUE_TYPE_NOT_APPLICABLE
|
89
|
+
unknown = false
|
90
|
+
not_applicable = true
|
91
|
+
end
|
92
|
+
|
93
|
+
Abstractor::AbstractorAbstraction.transaction do
|
94
|
+
if abstraction_other_value_type
|
95
|
+
abstractor_abstractions.each do |abstractor_abstraction|
|
96
|
+
abstractor_abstraction.abstractor_suggestions.each do |abstractor_suggestion|
|
97
|
+
if unknown && abstractor_suggestion.unknown
|
98
|
+
abstractor_suggestion.abstractor_suggestion_status = accepted_status
|
99
|
+
abstractor_suggestion.save!
|
100
|
+
else
|
101
|
+
set_abstractor_abstraction(abstractor_abstraction, unknown, not_applicable)
|
102
|
+
abstractor_suggestion.abstractor_suggestion_status = rejected_status
|
103
|
+
abstractor_suggestion.save!
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
private
|
112
|
+
def set_abstractor_abstraction(abstractor_abstraction, unknown, not_applicable)
|
113
|
+
abstractor_abstraction.value = nil
|
114
|
+
abstractor_abstraction.unknown = unknown
|
115
|
+
abstractor_abstraction.not_applicable = not_applicable
|
116
|
+
abstractor_abstraction.save!
|
117
|
+
end
|
66
118
|
end
|
67
119
|
end
|
68
120
|
end
|
@@ -26,51 +26,7 @@ module Abstractor
|
|
26
26
|
abstractor_abstractions.map(&:abstractor_suggestions).flatten.empty?
|
27
27
|
end
|
28
28
|
|
29
|
-
##
|
30
|
-
# Updates all abstractor abstractions in a group to 'not applicable' or 'unknown'.
|
31
|
-
#
|
32
|
-
# @param [Abstractor::Enum::ABSTRACTION_OTHER_VALUE_TYPE_UNKNOWN, Abstractor::Enum::ABSTRACTION_OTHER_VALUE_TYPE_NOT_APPLICABLE] abstraction_other_value_type contorls whether to update all abstractor abstractions in the group to 'unknown' or 'not applicable'
|
33
|
-
# @return [void]
|
34
|
-
def update_abstractor_abstraction_other_value(abstraction_other_value_type)
|
35
|
-
raise(ArgumentError, "abstraction_value_type argument invalid") unless Abstractor::Enum::ABSTRACTION_OTHER_VALUE_TYPES.include?(abstraction_other_value_type)
|
36
|
-
|
37
|
-
rejected_status = Abstractor::AbstractorSuggestionStatus.where(:name => 'Rejected').first
|
38
|
-
accepted_status = Abstractor::AbstractorSuggestionStatus.where(:name => 'Accepted').first
|
39
|
-
case abstraction_other_value_type
|
40
|
-
when Abstractor::Enum::ABSTRACTION_OTHER_VALUE_TYPE_UNKNOWN
|
41
|
-
unknown = true
|
42
|
-
not_applicable = false
|
43
|
-
when Abstractor::Enum::ABSTRACTION_OTHER_VALUE_TYPE_NOT_APPLICABLE
|
44
|
-
unknown = false
|
45
|
-
not_applicable = true
|
46
|
-
end
|
47
|
-
|
48
|
-
Abstractor::AbstractorAbstraction.transaction do
|
49
|
-
if abstraction_other_value_type
|
50
|
-
abstractor_abstractions.each do |abstractor_abstraction|
|
51
|
-
abstractor_abstraction.abstractor_suggestions.each do |abstractor_suggestion|
|
52
|
-
if unknown && abstractor_suggestion.unknown
|
53
|
-
abstractor_suggestion.abstractor_suggestion_status = accepted_status
|
54
|
-
abstractor_suggestion.save!
|
55
|
-
else
|
56
|
-
set_abstractor_abstraction(abstractor_abstraction, unknown, not_applicable)
|
57
|
-
abstractor_suggestion.abstractor_suggestion_status = rejected_status
|
58
|
-
abstractor_suggestion.save!
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
29
|
private
|
67
|
-
def set_abstractor_abstraction(abstractor_abstraction, unknown, not_applicable)
|
68
|
-
abstractor_abstraction.value = nil
|
69
|
-
abstractor_abstraction.unknown = unknown
|
70
|
-
abstractor_abstraction.not_applicable = not_applicable
|
71
|
-
abstractor_abstraction.save!
|
72
|
-
end
|
73
|
-
|
74
30
|
def update_abstractor_abstraction_group_members
|
75
31
|
return unless deleted?
|
76
32
|
abstractor_abstraction_group_members.each do |gm|
|
data/lib/abstractor/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: abstractor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.20
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Gurley, Yulia Bushmanova
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-06-
|
11
|
+
date: 2014-06-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|