Class: StudyEngine::BeginAssessmentForm
- Inherits:
-
Form
- Object
- Form
- StudyEngine::BeginAssessmentForm
show all
- Defined in:
- app/models/study_engine/begin_assessment_form.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods inherited from Form
attributes, #attributes, #initialize, lookup_ancestors, model_name, new_from_model, #save, wrapped_class, wraps
Instance Attribute Details
#restart ⇒ Object
Returns the value of attribute restart.
11
12
13
|
# File 'app/models/study_engine/begin_assessment_form.rb', line 11
def restart
@restart
end
|
Instance Method Details
#existing_assessment ⇒ Object
41
42
43
44
45
|
# File 'app/models/study_engine/begin_assessment_form.rb', line 41
def existing_assessment
if study_id and new_record?
@existing_assessment ||= Assessment.by_study_id(study_id).where(event: event).last
end
end
|
#id_options ⇒ Object
59
60
61
|
# File 'app/models/study_engine/begin_assessment_form.rb', line 59
def id_options
ids_grouped_by_study_and_site[study_id_study.to_s + study_id_site.to_s]
end
|
#ids_grouped_by_study_and_site ⇒ Object
#method_applied ⇒ Object
37
38
39
|
# File 'app/models/study_engine/begin_assessment_form.rb', line 37
def method_applied
@method_applied || "In-person"
end
|
#restartable? ⇒ Boolean
47
48
49
|
# File 'app/models/study_engine/begin_assessment_form.rb', line 47
def restartable?
existing_assessment.try(:incomplete?)
end
|
#site_options ⇒ Object
55
56
57
|
# File 'app/models/study_engine/begin_assessment_form.rb', line 55
def site_options
coordinator.try(:site_id).present? ? [coordinator.site_id] : StudyID::Bank.sites
end
|
#study_id ⇒ Object
33
34
35
|
# File 'app/models/study_engine/begin_assessment_form.rb', line 33
def study_id
@study_id ||= StudyID.new
end
|
#study_id_id ⇒ Object
29
30
31
|
# File 'app/models/study_engine/begin_assessment_form.rb', line 29
def study_id_id
id_options.one? ? id_options.first : study_id.id
end
|
#study_id_site ⇒ Object
25
26
27
|
# File 'app/models/study_engine/begin_assessment_form.rb', line 25
def study_id_site
site_options.one? ? site_options.first : study_id.site
end
|
#study_id_study ⇒ Object
21
22
23
|
# File 'app/models/study_engine/begin_assessment_form.rb', line 21
def study_id_study
study_options.one? ? study_options.first : study_id.study
end
|