Class: SrCriterion

Inherits:
Sequel::Model
  • Object
show all
Defined in:
model/criteria.rb

Constant Summary collapse

INCLUSION =
'inclusion'
EXCLUSION =
'exclusion'
TYPES =
[INCLUSION, EXCLUSION]

Class Method Summary collapse

Class Method Details

.get_name_type(x) ⇒ Object



44
45
46
# File 'model/criteria.rb', line 44

def self.get_name_type(x)
  "Criteria_#{x}"
end

.sr_criterion_add(sr, criterion, type) ⇒ Object



47
48
49
50
51
52
53
# File 'model/criteria.rb', line 47

def self.sr_criterion_add(sr,criterion, type)
  type=type.to_s
  raise("Not valid type:#{type}") unless type==INCLUSION or type==EXCLUSION
  unless SrCriterion[systematic_review_id:sr.id, criterion_id:criterion.id]
    SrCriterion.insert(systematic_review_id:sr.id, criterion_id:criterion.id, criteria_type:type)
  end
end

.sr_criterion_remove(sr, criterion) ⇒ Object



55
56
57
# File 'model/criteria.rb', line 55

def self.sr_criterion_remove(sr,criterion)
  SrCriterion.where(systematic_review_id:sr.id, criterion_id:criterion.id).delete
end