Class: TagBwCd
- Inherits:
-
Sequel::Model
- Object
- Sequel::Model
- TagBwCd
- Defined in:
- model/tag_bw_cd.rb
Class Method Summary collapse
- .approve_tag(cd_start, cd_end, rs, tag, user_id) ⇒ Object
- .reject_tag(cd_start, cd_end, rs, tag, user_id) ⇒ Object
- .tags_rs_cd(revision, cd_start, cd_end) ⇒ Object
- .update_decision_tag(cd_start, cd_end, rs, tag, user_id, decision) ⇒ Object
Class Method Details
.approve_tag(cd_start, cd_end, rs, tag, user_id) ⇒ Object
15 16 17 |
# File 'model/tag_bw_cd.rb', line 15 def self.approve_tag(cd_start,cd_end, rs,tag,user_id) update_decision_tag(cd_start, cd_end, rs, tag,user_id,'yes') end |
.reject_tag(cd_start, cd_end, rs, tag, user_id) ⇒ Object
18 19 20 |
# File 'model/tag_bw_cd.rb', line 18 def self.reject_tag(cd_start,cd_end,rs,tag,user_id) update_decision_tag(cd_start, cd_end, rs, tag,user_id,'no') end |
.tags_rs_cd(revision, cd_start, cd_end) ⇒ Object
2 3 4 |
# File 'model/tag_bw_cd.rb', line 2 def self.(revision,cd_start, cd_end) Tag.inner_join(:tag_bw_cds, :tag_id=>:id).where(:systematic_review_id=>revision.id, :cd_start=>cd_start.id, :cd_end=>cd_end.id) end |
.update_decision_tag(cd_start, cd_end, rs, tag, user_id, decision) ⇒ Object
6 7 8 9 10 11 12 13 14 |
# File 'model/tag_bw_cd.rb', line 6 def self.update_decision_tag(cd_start,cd_end, rs,tag,user_id,decision) raise(I18n::t(:Strange_objects)) if cd_start.nil? or cd_end.nil? or rs.nil? or tag.nil? previous_tag=TagBwCd.where(:tag_id=>tag.id, :cd_start=>cd_start.id, :cd_end=>cd_end.id, :systematic_review_id=>rs.id, :user_id=>user_id) if previous_tag.empty? TagBwCd.insert(:tag_id=>tag.id, :cd_start=>cd_start.id, :cd_end=>cd_end.id, :systematic_review_id=>rs.id, :user_id=>user_id,:decision=>decision) else previous_tag.update(:decision=>decision) end end |