study_engine 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (138) hide show
  1. checksums.yaml +7 -0
  2. data/Rakefile +42 -0
  3. data/app/assets/images/study_engine/spinner.gif +0 -0
  4. data/app/assets/images/study_engine/sprite/delete.png +0 -0
  5. data/app/assets/images/study_engine/sprite/download.png +0 -0
  6. data/app/assets/images/study_engine/sprite/edit.png +0 -0
  7. data/app/assets/images/study_engine/sprite/incomplete.png +0 -0
  8. data/app/assets/images/study_engine/sprite/metrc-sm.png +0 -0
  9. data/app/assets/images/study_engine/sprite/metrc.png +0 -0
  10. data/app/assets/images/study_engine/sprite/new.png +0 -0
  11. data/app/assets/javascripts/study_engine/admin_notes.js.coffee +12 -0
  12. data/app/assets/javascripts/study_engine/assessment_notifications.js.coffee +36 -0
  13. data/app/assets/javascripts/study_engine/assessment_timeout.js.coffee +24 -0
  14. data/app/assets/javascripts/study_engine/disable_buttons_after_click.js.coffee +6 -0
  15. data/app/assets/javascripts/study_engine/fire_click_event_immediately_on_mobile.js.coffee.erb +10 -0
  16. data/app/assets/javascripts/study_engine/response_validation.js.coffee +8 -0
  17. data/app/assets/javascripts/study_engine/restart_assessment_button.js.coffee +3 -0
  18. data/app/assets/javascripts/study_engine/study_engine.js.coffee +9 -0
  19. data/app/assets/javascripts/study_engine/study_id_picker.js.coffee +28 -0
  20. data/app/assets/stylesheets/study_engine.sass +1 -0
  21. data/app/assets/stylesheets/study_engine/_constant.sass +52 -0
  22. data/app/assets/stylesheets/study_engine/_mobile.sass +8 -0
  23. data/app/assets/stylesheets/study_engine/_tablet.sass +36 -0
  24. data/app/assets/stylesheets/study_engine/application.sass +101 -0
  25. data/app/assets/stylesheets/study_engine/base/_form.sass +131 -0
  26. data/app/assets/stylesheets/study_engine/base/_list.sass +38 -0
  27. data/app/assets/stylesheets/study_engine/base/_tables.sass +33 -0
  28. data/app/assets/stylesheets/study_engine/base/_text.sass +78 -0
  29. data/app/assets/stylesheets/study_engine/components/-fields/_login-fields.sass +14 -0
  30. data/app/assets/stylesheets/study_engine/components/-fields/_start-fields.sass +101 -0
  31. data/app/assets/stylesheets/study_engine/components/-nav/_global-nav.sass +19 -0
  32. data/app/assets/stylesheets/study_engine/components/-table/_results-table.sass +75 -0
  33. data/app/assets/stylesheets/study_engine/components/-table/_users-table.sass +11 -0
  34. data/app/assets/stylesheets/study_engine/components/_assessment-questions.sass +30 -0
  35. data/app/assets/stylesheets/study_engine/components/_form-buttons.sass +102 -0
  36. data/app/assets/stylesheets/study_engine/components/_helpt-text.sass +2 -0
  37. data/app/assets/stylesheets/study_engine/components/_method-icons.sass +15 -0
  38. data/app/assets/stylesheets/study_engine/components/_notes-modal.sass +65 -0
  39. data/app/assets/stylesheets/study_engine/components/_progress-bar.sass +25 -0
  40. data/app/assets/stylesheets/study_engine/components/_sortable-columns.sass +26 -0
  41. data/app/assets/stylesheets/study_engine/components/_table-actions.sass +8 -0
  42. data/app/assets/stylesheets/study_engine/components/_table-buttons.sass +17 -0
  43. data/app/assets/stylesheets/study_engine/components/_user-privileges.sass +3 -0
  44. data/app/assets/stylesheets/study_engine/mixins/_actions-table.sass +11 -0
  45. data/app/assets/stylesheets/study_engine/mixins/_buttons.sass +55 -0
  46. data/app/assets/stylesheets/study_engine/mixins/_checkbox-columns.sass +50 -0
  47. data/app/assets/stylesheets/study_engine/mixins/_custom-radios.sass +47 -0
  48. data/app/assets/stylesheets/study_engine/mixins/_icons.sass +38 -0
  49. data/app/assets/stylesheets/study_engine/mixins/_notification-text.sass +23 -0
  50. data/app/controllers/study_engine/admin/application_controller.rb +6 -0
  51. data/app/controllers/study_engine/admin/assessments_controller.rb +79 -0
  52. data/app/controllers/study_engine/admin/notes_controller.rb +17 -0
  53. data/app/controllers/study_engine/application_controller.rb +12 -0
  54. data/app/controllers/study_engine/assessments_controller.rb +94 -0
  55. data/app/helpers/study_engine/helpers.rb +15 -0
  56. data/app/helpers/study_engine/mailer_helpers.rb +11 -0
  57. data/app/mailers/study_engine/mailer.rb +25 -0
  58. data/app/models/study_engine/answer.rb +36 -0
  59. data/app/models/study_engine/assessment.rb +118 -0
  60. data/app/models/study_engine/begin_assessment_form.rb +110 -0
  61. data/app/models/study_engine/existing_assessments_form.rb +99 -0
  62. data/app/models/study_engine/form.rb +59 -0
  63. data/app/models/study_engine/report.rb +69 -0
  64. data/app/models/study_engine/result.rb +46 -0
  65. data/app/models/study_engine/screen_results.rb +54 -0
  66. data/app/models/study_engine/study_id.rb +47 -0
  67. data/app/models/study_engine/study_id/bank.rb +38 -0
  68. data/app/models/study_engine/study_id/sync.rb +52 -0
  69. data/app/models/study_engine/update_assessments_form.rb +53 -0
  70. data/app/views/study_engine/_progress_bar.html.slim +4 -0
  71. data/app/views/study_engine/admin/assessments/_assessment.html.slim +36 -0
  72. data/app/views/study_engine/admin/assessments/domain_results.csv.csvbuilder +17 -0
  73. data/app/views/study_engine/admin/assessments/edit.html.slim +68 -0
  74. data/app/views/study_engine/admin/assessments/index.html.slim +26 -0
  75. data/app/views/study_engine/admin/assessments/item_results.csv.csvbuilder +24 -0
  76. data/app/views/study_engine/admin/assessments/new.html.slim +46 -0
  77. data/app/views/study_engine/admin/assessments/screen_results.csv.csvbuilder +2 -0
  78. data/app/views/study_engine/assessments/complete.html.slim +25 -0
  79. data/app/views/study_engine/assessments/create.html.slim +46 -0
  80. data/app/views/study_engine/assessments/index.html.slim +43 -0
  81. data/app/views/study_engine/assessments/restart.html.slim +28 -0
  82. data/app/views/study_engine/assessments/show.html.slim +60 -0
  83. data/app/views/study_engine/mailer/assessment_recorded_notification.erb +8 -0
  84. data/app/views/study_engine/mailer/assessment_url_notification.erb +6 -0
  85. data/config/routes.rb +15 -0
  86. data/db/migrate/20160422185859_create_tables.rb +52 -0
  87. data/lib/study_engine.rb +5 -0
  88. data/lib/study_engine/config.rb +37 -0
  89. data/lib/study_engine/cucumber.rb +96 -0
  90. data/lib/study_engine/engine.rb +7 -0
  91. data/lib/study_engine/version.rb +3 -0
  92. data/lib/tasks/study_engine_tasks.rake +10 -0
  93. data/spec/ar_helper.rb +30 -0
  94. data/spec/models/study_engine/answer_spec.rb +28 -0
  95. data/spec/models/study_engine/assessment_spec.rb +250 -0
  96. data/spec/models/study_engine/begin_assessment_form_spec.rb +87 -0
  97. data/spec/models/study_engine/existing_assessments_form_spec.rb +171 -0
  98. data/spec/models/study_engine/report_spec.rb +48 -0
  99. data/spec/models/study_engine/result_spec.rb +102 -0
  100. data/spec/models/study_engine/screen_results_spec.rb +69 -0
  101. data/spec/models/study_engine/study_id/bank_spec.rb +72 -0
  102. data/spec/models/study_engine/study_id/sync_spec.rb +61 -0
  103. data/spec/models/study_engine/study_id_spec.rb +7 -0
  104. data/spec/models/study_engine/update_assessments_form_spec.rb +38 -0
  105. data/spec/rails_helper.rb +50 -0
  106. data/spec/schema.rb +65 -0
  107. data/spec/spec_helper.rb +72 -0
  108. data/spec/support/CATEngine3.exe +0 -0
  109. data/spec/support/forms/01. Physical Function Bank.xml +1213 -0
  110. data/spec/support/forms/02. Pain Interference Bank.xml +443 -0
  111. data/spec/support/forms/03. Anxiety Bank.xml +322 -0
  112. data/spec/support/forms/04. Depression Bank.xml +311 -0
  113. data/spec/support/forms/05. Ability to Participate Social bank Version 2.xml +353 -0
  114. data/spec/support/forms/06. Psychosocial Illness Impact Pos Bank.xml +900 -0
  115. data/spec/support/forms/07. Applied Cognition Gen Concerns Bank.xml +377 -0
  116. data/spec/support/forms/08. Satisfaction with Roles and Activities Bank Version 2.xml +443 -0
  117. data/spec/support/forms/09. Sleep Disturbance Bank.xml +300 -0
  118. data/spec/support/forms/10. Emotional Support Bank.xml +163 -0
  119. data/spec/support/forms/A - 07. Psychosocial Illness Impact Pos Bank.xml +471 -0
  120. data/spec/support/forms/A - 08. Pain interference Bank.xml +443 -0
  121. data/spec/support/forms/A - 09. Depression Bank.xml +311 -0
  122. data/spec/support/forms/B - 07. Physical Function Short Form.xml +123 -0
  123. data/spec/support/forms/B - 08. Physical Function Remainder A.xml +543 -0
  124. data/spec/support/forms/B - 09. Ability to Participate Social bank Version 2.xml +353 -0
  125. data/spec/support/forms/C - 07. Physical Function Short Form.xml +123 -0
  126. data/spec/support/forms/C - 08. Physical Function Remainder B.xml +553 -0
  127. data/spec/support/forms/C - 09. Anxiety Bank.xml +322 -0
  128. data/spec/support/parameters/01. Physical Function Bank.xml +682 -0
  129. data/spec/support/parameters/02. Pain Interference Bank.xml +256 -0
  130. data/spec/support/parameters/03. Anxiety Bank.xml +190 -0
  131. data/spec/support/parameters/04. Depression Bank.xml +184 -0
  132. data/spec/support/parameters/05. Ability to Participate Social bank Version 2.xml +226 -0
  133. data/spec/support/parameters/06. Psychosocial Illness Impact Pos Bank.xml +211 -0
  134. data/spec/support/parameters/07. Applied Cognition Gen Concerns Bank.xml +1 -0
  135. data/spec/support/parameters/08. Satisfaction with Roles and Activities Bank Version 2.xml +1 -0
  136. data/spec/support/parameters/09. Sleep Disturbance Bank.xml +1 -0
  137. data/spec/support/parameters/10. Emotional Support Bank.xml +1 -0
  138. metadata +394 -0
@@ -0,0 +1,2 @@
1
+ .help-text, .helptext
2
+ +notification-text(#bfbfbf, "info-circle")
@@ -0,0 +1,15 @@
1
+ .custom-symbol
2
+ @extend .fa-check
3
+ .in-person
4
+ @extend .fa-users
5
+ .by-phone
6
+ @extend .fa-phone
7
+ .by-url
8
+ @extend .fa-globe
9
+ .by-mail
10
+ @extend .fa-envelope
11
+ .paper-form
12
+ @extend .fa-file
13
+ .missing
14
+ @extend .fa-question-circle
15
+
@@ -0,0 +1,65 @@
1
+ .note-wrapper
2
+ display: inline-block
3
+ position: relative
4
+ margin-top: -1px
5
+
6
+ .toggle-note
7
+ position: absolute
8
+ opacity: 0.001
9
+ cursor: pointer
10
+ z-index: 3
11
+ &:checked
12
+ & ~ .note::before
13
+ color: #1a1a1a
14
+ & ~ .note.-saved::before
15
+ color: $primaryColor
16
+ & ~ .note-modal
17
+ display: block
18
+ &:hover
19
+ & ~ .note::before
20
+ color: #666
21
+
22
+ .note
23
+ +icon("tag")
24
+ margin: 0
25
+ height: 20px
26
+ line-height: 20px
27
+ z-index: 2
28
+ &.-saved
29
+ &:before
30
+ color: $primaryColor
31
+ &.-saving
32
+ @extend .fa-spin
33
+ @extend .fa-spinner
34
+ &:before
35
+ color: $primaryColor
36
+
37
+ .note-modal
38
+ display: none
39
+ position: absolute
40
+ z-index: 5
41
+ background: #fcfcfc
42
+ box-shadow: #666 0 1px 6px
43
+ border-radius: 3px
44
+ padding: 20px
45
+ right: -100px
46
+ textarea
47
+ width: 400px
48
+ min-width: 400px
49
+ max-width: 90%
50
+ height: 200px
51
+ min-height: 200px
52
+ max-height: 500px
53
+
54
+ .close
55
+ position: absolute
56
+ top: 10px
57
+ right: 10px
58
+ font-size: 1.2em
59
+ @extend .fa
60
+ @extend .fa-close
61
+ color: #ccc
62
+ cursor: pointer
63
+ &:hover
64
+ color: red
65
+
@@ -0,0 +1,25 @@
1
+ .progress
2
+ float: left
3
+ clear: both
4
+ width: 100%
5
+ height: 2px
6
+ background: #ededed
7
+ background-image: linear-gradient(#ededed, #fcfcfc)
8
+ position: relative
9
+ margin: 20px 0 30px
10
+ border-radius: 1px
11
+ .bar
12
+ background: $primaryColor
13
+ background-image: linear-gradient(lighten($primaryColor, 10%), $primaryColor)
14
+ height: 2px
15
+ position: absolute
16
+ left: 0
17
+ border-radius: 1px
18
+ .percentage
19
+ font: 400 1.2em $default
20
+ color: $primaryColor
21
+ width: 30px
22
+ text-align: center
23
+ margin-left: -15px
24
+ position: absolute
25
+ top: 4px
@@ -0,0 +1,26 @@
1
+ // ADD TO <TH>
2
+ .sortable-column, .sortable
3
+ color: #333
4
+ display: block
5
+ @extend .fa-sort
6
+ &:before
7
+ @extend .fa
8
+ font-size: 1.4em
9
+ position: absolute
10
+ right: 0px
11
+ color: #d0d0d0
12
+ margin-left: 4px
13
+ &:hover, &:hover::before
14
+ color: $secondaryColor
15
+ &.asc, &.desc
16
+ i
17
+ color: #1a1a1a
18
+ &.asc, &.current-asc
19
+ @extend .fa-sort-asc
20
+ &:before
21
+ color: #333
22
+ &.desc, &.current-desc
23
+ @extend .fa-sort-desc
24
+ &:before
25
+ color: #333
26
+
@@ -0,0 +1,8 @@
1
+ .delete-icon, .delete
2
+ +icon("trash")
3
+ &:hover::before
4
+ color: $red
5
+
6
+ .edit-icon, .edit
7
+ +icon("pencil")
8
+
@@ -0,0 +1,17 @@
1
+ .table-buttons
2
+ text-align: right
3
+ clear: both
4
+
5
+ .buttons-left
6
+ display: inline-block
7
+ float: left
8
+ .buttons-right
9
+ display: inline-block
10
+ float: right
11
+
12
+ .add, .add-button
13
+ +button(#fff, #666, 1.2em, true, "plus-circle")
14
+ .download
15
+ +button(#fff, #666, 1.2em, true, "download")
16
+
17
+
@@ -0,0 +1,3 @@
1
+ .user-privileges
2
+ +checkbox-columns(40px, 1)
3
+
@@ -0,0 +1,11 @@
1
+ =actions-table
2
+ th, td
3
+ &:last-child
4
+ text-align: right
5
+ white-space: nowrap
6
+ width: 120px
7
+ td
8
+ &:nth-child(1)
9
+ a
10
+ font-weight: 700
11
+
@@ -0,0 +1,55 @@
1
+ @mixin button( $bg: $primaryColor, $text-color: #fcfcfc, $font-size: 1.6em, $hover: true, $fa: false )
2
+ display: inline-block
3
+ font-size: $font-size
4
+ font-weight: 700
5
+ line-height: 3.0em
6
+ color: $text-color
7
+ border: 1px solid darken( $bg, 5% )
8
+ background-color: $bg
9
+ background: linear-gradient( $bg, darken( $bg, 5% ) )
10
+ border-radius: 2px
11
+ padding: 0 20px
12
+ text-align: center
13
+ text-decoration: none
14
+ cursor: default
15
+ @if $hover
16
+ cursor: pointer
17
+ &:hover
18
+ background: darken( $bg, 5% )
19
+ color: $text-color
20
+ @if $fa
21
+ @extend .fa-#{$fa}
22
+ &:before
23
+ @extend .fa
24
+ margin-right: 5px
25
+
26
+ // input wrapper buttons
27
+
28
+ =input-button($bg: $primaryColor, $text-color: #fcfcfc, $fa: false, $size: 1em)
29
+ +button($bg, $text-color)
30
+ padding: 0
31
+ line-height: 1
32
+ input, button
33
+ font-size: $size
34
+ border: none
35
+ background: none
36
+ padding: 0px 20px
37
+ line-height: 3em
38
+ cursor: pointer
39
+ color: $text-color
40
+ font-weight: 700
41
+ &:hover
42
+ input
43
+ color: $text-color
44
+ @if $fa
45
+ @extend .fa-#{$fa}
46
+ input, button
47
+ padding-left: 2em
48
+ &:before
49
+ @extend .fa
50
+ position: absolute
51
+ top: 50%
52
+ margin-top: -0.5em
53
+ left: 10px
54
+ font-size: $size
55
+
@@ -0,0 +1,50 @@
1
+ %inline-label
2
+ display: inline-block
3
+ color: #404040
4
+ font: 200 1.0rem $default
5
+ vertical-align: top
6
+ font-size: 2.1em
7
+
8
+ =checkbox-columns($h: 40px, $cols: 1)
9
+ width: 100%
10
+ display: flex
11
+ flex-wrap: wrap
12
+ vertical-align: top
13
+ line-height: 1em
14
+ padding-top: 2px
15
+ .field
16
+ display: inline-block
17
+ line-height: $h
18
+ min-height: $h
19
+ padding: 0
20
+ margin: 0 0 10px 1%
21
+ border: none
22
+ clear: none
23
+ .checkbox, .radio
24
+ line-height: $h
25
+ & + label
26
+ line-height: $h
27
+ label
28
+ line-height: $h
29
+ .other
30
+ width: 100%
31
+ clear: both
32
+ label
33
+ @extend %inline-label
34
+ line-height: 40px
35
+ margin: 0 0 0 10px
36
+ .text
37
+ width: 70%
38
+ margin: 0px 0 0 8px
39
+ @if $cols == 1
40
+ .field
41
+ flex-basis: 100%
42
+ @if $cols == 2
43
+ .field
44
+ flex-basis: 48%
45
+ @if $cols == 3
46
+ .field
47
+ flex-basis: 32%
48
+ @if $cols == 4
49
+ .field
50
+ flex-basis: 24%
@@ -0,0 +1,47 @@
1
+ =custom-radio($h: 46px)
2
+ +button( #fff, #444 )
3
+ box-shadow: darken( #f9f9f9, 10% ) 0 1px 6px 0 inset
4
+ border: 1px solid darken( #f9f9f9, 15% )
5
+ min-height: $h
6
+ height: $h
7
+ line-height: $h
8
+ text-align: left
9
+ padding: 0px
10
+ position: relative
11
+ width: 100%
12
+ font-weight: 700
13
+ //+bp_tablet_portrait
14
+ //font-size: 1.4em
15
+ input[type="checkbox"], input[type="radio"]
16
+ opacity: 0.001
17
+ position: absolute
18
+ top: 0
19
+ left: 0
20
+ z-index: 2
21
+ cursor: pointer
22
+ &:checked
23
+ & + .custom-symbol
24
+ color: #f5f5f5
25
+ background: $primaryColor
26
+ box-shadow: darken($primaryColor, 10% ) -1px 0 4px 0 inset
27
+ span
28
+ display: inline-block
29
+ vertical-align: top
30
+ margin-top: -2px
31
+ .custom-symbol
32
+ display: inline-block
33
+ color: #e0e0e0
34
+ border-right: 1px solid #e0e0e0
35
+ padding: 0 8px
36
+ margin-right: 5px
37
+ vertical-align: top
38
+ line-height: $h - 2px
39
+ font-size: 1.2em
40
+ border-left-radius: 2px
41
+ &:before
42
+ @extend .fa
43
+ &.checked
44
+ color: #f5f5f5
45
+ background: $primaryColor
46
+ box-shadow: darken($primaryColor, 10% ) -1px 0 4px 0 inset
47
+
@@ -0,0 +1,38 @@
1
+ // Icons with hidden text
2
+
3
+ =icon($fa, $hover: true)
4
+ display: inline-block
5
+ margin: 0 6px
6
+ text-align: left
7
+ position: relative
8
+ font-size: 1.4em
9
+ width: 1em
10
+ text-indent: -9999px
11
+ color: #ccc
12
+ @extend .fa
13
+ @extend .fa-#{$fa}
14
+ &:before
15
+ text-indent: 0
16
+ position: absolute
17
+ top: 50%
18
+ right: 50%
19
+ margin: -0.5em -0.5em 0 0
20
+ z-index: 2
21
+ @if $hover
22
+ cursor: pointer
23
+ &:hover
24
+ &:before
25
+ color: $primaryColor
26
+
27
+
28
+ // Icons with text
29
+
30
+ =icon_text($fa, $font-size: 1.3em)
31
+ display: inline-block
32
+ margin: 0 20px 0 0
33
+ @extend .fa-#{$fa}
34
+ font-size: $font-size
35
+ &:before
36
+ margin-right: 4px
37
+ @extend .fa
38
+
@@ -0,0 +1,23 @@
1
+ =notification-text( $color, $fa )
2
+ margin: 10px 0
3
+ position: relative
4
+ clear: both
5
+ padding: 10px 10px 10px 40px
6
+ border: 1px dashed $color
7
+ color: $color
8
+ font-size: 1.3em
9
+ font-style: italic
10
+ line-height: 1.4em
11
+ border-radius: 2px
12
+ @extend .fa-#{$fa}
13
+ &:before
14
+ @extend .fa
15
+ font-size: 1.8em
16
+ position: absolute
17
+ left: 10px
18
+ top: 50%
19
+ margin-top: -0.5em
20
+ ul
21
+ font-size: 1em
22
+ list-style: inside circle
23
+
@@ -0,0 +1,6 @@
1
+ class StudyEngine::Admin::ApplicationController < StudyEngine::ApplicationController
2
+ def require_admin
3
+ head :forbidden and return false unless current_user.admin?
4
+ end
5
+ end
6
+
@@ -0,0 +1,79 @@
1
+ require "study_engine/config"
2
+
3
+ module StudyEngine
4
+ class Admin::AssessmentsController < Admin::ApplicationController
5
+ before_action :require_admin, unless: -> { action_name == "index" && request.format.html? }
6
+
7
+ expose :assessments, :study_name, :study_url, :events, :assessment, :report
8
+
9
+ def index
10
+ respond_to do |format|
11
+ @assessments = current_user.admin? ? Assessment.find_each : Assessment.by_site(current_user.site_id).find_each
12
+ @report = Report.new(assessments, params[:field] || "study_id", params[:direction] || "ASC")
13
+
14
+ format.csv do
15
+ @csv_options = { force_quotes: true }
16
+ @output_encoding = "UTF-8"
17
+ @streaming = true
18
+
19
+ @filename = "#{params[:report]}-#{Time.now.utc.to_s(:db).parameterize.underscore}.csv"
20
+ render params[:report]
21
+ end
22
+ format.html
23
+ end
24
+ end
25
+
26
+ def new
27
+ @assessments = ExistingAssessmentsForm.new
28
+ end
29
+
30
+ def create
31
+ @assessments = ExistingAssessmentsForm.new(params[:study_engine_assessment])
32
+ if assessments.save
33
+ redirect_to [:admin, :assessments], notice: "Assessment created!"
34
+ else
35
+ flash.now[:alert] = assessments.errors.full_messages.join(", ")
36
+ render :new
37
+ end
38
+ end
39
+
40
+ def edit
41
+ if StudyID.new(params[:id]).valid?
42
+ @assessments = UpdateAssessmentsForm.new(params[:id])
43
+ else
44
+ @assessment = Assessment.find(params[:id])
45
+ end
46
+ end
47
+
48
+ def update
49
+ if StudyID.new(params[:id]).valid?
50
+ @assessments = UpdateAssessmentsForm.new(params[:id])
51
+ assessments.update_attributes! params[:study_engine_assessment]
52
+ else
53
+ @assessment = Assessment.find(params[:id])
54
+ assessment.update_attributes! params[:assessment].permit(:method_applied)
55
+ end
56
+ redirect_to [:admin, :assessments], notice: "Assessment has been updated!"
57
+ end
58
+
59
+ def destroy
60
+ Assessment.destroy params[:id]
61
+ redirect_to [:admin, :assessments], notice: "Assessment has been deleted!"
62
+ end
63
+
64
+ private
65
+
66
+ def study_name
67
+ StudyEngine.study_name
68
+ end
69
+
70
+ def study_url
71
+ StudyEngine.study_url
72
+ end
73
+
74
+ def events
75
+ StudyEngine.events
76
+ end
77
+ end
78
+ end
79
+