Class: SearchValidatorUser

Inherits:
SearchValidator show all
Defined in:
lib/search_validator_user.rb

Overview

Validates the searches of a specific user on a given sistematic review A search is valid if all records have enough information: title, year, authors and abstract

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(sr, user) ⇒ SearchValidatorUser

Returns a new instance of SearchValidatorUser.



38
39
40
41
42
# File 'lib/search_validator_user.rb', line 38

def initialize(sr, user)
  @sr=sr
  @user=user
  super()
end

Instance Attribute Details

#srObject (readonly)

Returns the value of attribute sr.



36
37
38
# File 'lib/search_validator_user.rb', line 36

def sr
  @sr
end

#userObject (readonly)

Returns the value of attribute user.



35
36
37
# File 'lib/search_validator_user.rb', line 35

def user
  @user
end

Instance Method Details

#can_docs_queryObject



43
44
45
# File 'lib/search_validator_user.rb', line 43

def can_docs_query
  $db["SELECT s.id as s_id, r.id as r_id, cd.id, cd.author, cd.title, cd.abstract, cd.year FROM searches s INNER JOIN records_searches rs ON s.id=rs.search_id INNER JOIN records r ON rs.record_id=r.id LEFT JOIN canonical_documents cd ON r.canonical_document_id=cd.id WHERE s.user_id=? and s.systematic_review_id=?", @user.id, @sr.id]
end