Class: AssignmentSubmissionObject
- Inherits:
-
Object
- Object
- AssignmentSubmissionObject
- Includes:
- DataFactory, DateFactory, Foundry, StringFactory, Workflows
- Defined in:
- lib/sambal-cle/data_objects/assignment_submission.rb
Instance Attribute Summary collapse
-
#accept_until ⇒ Object
Returns the value of attribute accept_until.
-
#allow_resubmission ⇒ Object
Returns the value of attribute allow_resubmission.
-
#grade ⇒ Object
Returns the value of attribute grade.
-
#grade_status ⇒ Object
Returns the value of attribute grade_status.
-
#inline_comment ⇒ Object
Returns the value of attribute inline_comment.
-
#num_resubmissions ⇒ Object
Returns the value of attribute num_resubmissions.
-
#release_to_student ⇒ Object
Returns the value of attribute release_to_student.
-
#resubmission ⇒ Object
Returns the value of attribute resubmission.
-
#returned ⇒ Object
Returns the value of attribute returned.
-
#site ⇒ Object
Returns the value of attribute site.
-
#status ⇒ Object
Returns the value of attribute status.
-
#student ⇒ Object
Returns the value of attribute student.
-
#submission_date ⇒ Object
Returns the value of attribute submission_date.
-
#summary_comment ⇒ Object
Returns the value of attribute summary_comment.
-
#text ⇒ Object
Returns the value of attribute text.
-
#title ⇒ Object
Returns the value of attribute title.
Instance Method Summary collapse
- #grade_submission(opts = {}) ⇒ Object
-
#initialize(browser, opts = {}) ⇒ AssignmentSubmissionObject
constructor
A new instance of AssignmentSubmissionObject.
- #open ⇒ Object (also: #view)
- #resubmit(opts = {}) ⇒ Object
- #save_draft ⇒ Object
- #submit ⇒ Object
Methods included from Workflows
menu_link, #open_my_site_by_name, #reset
Constructor Details
#initialize(browser, opts = {}) ⇒ AssignmentSubmissionObject
Returns a new instance of AssignmentSubmissionObject.
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/sambal-cle/data_objects/assignment_submission.rb', line 14 def initialize(browser, opts={}) @browser = browser defaults = { :text=>random_alphanums, :status=>"Not Started" } = defaults.merge(opts) () requires @site, @title, @student end |
Instance Attribute Details
#accept_until ⇒ Object
Returns the value of attribute accept_until.
9 10 11 |
# File 'lib/sambal-cle/data_objects/assignment_submission.rb', line 9 def accept_until @accept_until end |
#allow_resubmission ⇒ Object
Returns the value of attribute allow_resubmission.
9 10 11 |
# File 'lib/sambal-cle/data_objects/assignment_submission.rb', line 9 def allow_resubmission @allow_resubmission end |
#grade ⇒ Object
Returns the value of attribute grade.
9 10 11 |
# File 'lib/sambal-cle/data_objects/assignment_submission.rb', line 9 def grade @grade end |
#grade_status ⇒ Object
Returns the value of attribute grade_status.
9 10 11 |
# File 'lib/sambal-cle/data_objects/assignment_submission.rb', line 9 def grade_status @grade_status end |
#inline_comment ⇒ Object
Returns the value of attribute inline_comment.
9 10 11 |
# File 'lib/sambal-cle/data_objects/assignment_submission.rb', line 9 def inline_comment @inline_comment end |
#num_resubmissions ⇒ Object
Returns the value of attribute num_resubmissions.
9 10 11 |
# File 'lib/sambal-cle/data_objects/assignment_submission.rb', line 9 def num_resubmissions @num_resubmissions end |
#release_to_student ⇒ Object
Returns the value of attribute release_to_student.
9 10 11 |
# File 'lib/sambal-cle/data_objects/assignment_submission.rb', line 9 def release_to_student @release_to_student end |
#resubmission ⇒ Object
Returns the value of attribute resubmission.
9 10 11 |
# File 'lib/sambal-cle/data_objects/assignment_submission.rb', line 9 def resubmission @resubmission end |
#returned ⇒ Object
Returns the value of attribute returned.
9 10 11 |
# File 'lib/sambal-cle/data_objects/assignment_submission.rb', line 9 def returned @returned end |
#site ⇒ Object
Returns the value of attribute site.
9 10 11 |
# File 'lib/sambal-cle/data_objects/assignment_submission.rb', line 9 def site @site end |
#status ⇒ Object
Returns the value of attribute status.
9 10 11 |
# File 'lib/sambal-cle/data_objects/assignment_submission.rb', line 9 def status @status end |
#student ⇒ Object
Returns the value of attribute student.
9 10 11 |
# File 'lib/sambal-cle/data_objects/assignment_submission.rb', line 9 def student @student end |
#submission_date ⇒ Object
Returns the value of attribute submission_date.
9 10 11 |
# File 'lib/sambal-cle/data_objects/assignment_submission.rb', line 9 def submission_date @submission_date end |
#summary_comment ⇒ Object
Returns the value of attribute summary_comment.
9 10 11 |
# File 'lib/sambal-cle/data_objects/assignment_submission.rb', line 9 def summary_comment @summary_comment end |
#text ⇒ Object
Returns the value of attribute text.
9 10 11 |
# File 'lib/sambal-cle/data_objects/assignment_submission.rb', line 9 def text @text end |
#title ⇒ Object
Returns the value of attribute title.
9 10 11 |
# File 'lib/sambal-cle/data_objects/assignment_submission.rb', line 9 def title @title end |
Instance Method Details
#grade_submission(opts = {}) ⇒ Object
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/sambal-cle/data_objects/assignment_submission.rb', line 61 def grade_submission opts={} open_my_site_by_name @site assignments reset on AssignmentsList do |list| list.grade @title end on AssignmentSubmissionList do |submissions| submissions.grade @student.ln_fn_id end on AssignmentSubmission do |submission| submission.prepend(submission.assignment_submission, "{{#{opts[@inline_comment]}}}") unless opts[:inline_comment]==nil submission.instructor_comments=opts[:summary_comment] unless opts[:summary_comment]==nil submission.grade.select opts[:grade] unless opts[:grade]==nil submission.allow_resubmission.send(opts[:allow_resubmission]) unless opts[:allow_resubmission]==nil if opts[:allow_resubmission]==:set || submission.allow_resubmission.set? submission.num_resubmissions.wait_until_present if opts[:accept_until]==nil @num_resubmissions=submission.num_resubmissions.[0].text @accept_until={} # Okay to wipe this (in case it's there) because we're getting # the values from UI--but most likely this var is nil anyway, # in which case we need to turn it into a hash. @accept_until[:MON]=submission.accept_until_month.[0].text @accept_until[:day_of_month]=submission.accept_until_day.[0].text @accept_until[:year]=submission.accept_until_year.[0].text @accept_until[:hour]=submission.accept_until_hour.[0].text @accept_until[:minute_rounded]=submission.accept_until_min.[0].text @accept_until[:MERIDIAN]=submission.accept_until_meridian.[0].text @accept_until[:sakai_rounded]=@accept_until[:MON].capitalize+" "+@accept_until[:day_of_month]+", "+@accept_until[:year]+" "+@accept_until[:hour]+":"+@accept_until[:minute_rounded]+" "+@accept_until[:MERIDIAN].downcase else submission.num_resubmissions.select opts[:num_resubmissions] submission.accept_until_month.select opts[:accept_until][:MON] submission.accept_until_day.select opts[:accept_until][:day_of_month] submission.accept_until_year.select opts[:accept_until][:year] submission.accept_until_hour.select opts[:accept_until][:hour] submission.accept_until_min.select opts[:accept_until][:minute_rounded] submission.accept_until_meridian.select opts[:accept_until][:MERIDIAN] end end if opts[:release_to_student]=~/yes/i submission.save_and_release @status="Returned" @returned=right_now else submission.save_and_dont_release end submission.return_to_list end on AssignmentSubmissionList do |list| @grade_status=list.submission_status_of @student.ln_fn_id end (opts) end |
#open ⇒ Object Also known as: view
115 116 117 118 119 120 121 122 |
# File 'lib/sambal-cle/data_objects/assignment_submission.rb', line 115 def open open_my_site_by_name @site assignments reset on AssignmentsList do |list| list.open_assignment @title end end |
#resubmit(opts = {}) ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/sambal-cle/data_objects/assignment_submission.rb', line 49 def resubmit opts={} open on AssignmentStudentView do |assignment| assignment.assignment_text=opts[:text] unless opts[:text]==nil # TODO: Add stuff for adding/updating/removing file(s) for the assignment assignment.resubmit @submission_date=right_now[:sakai] # Is this right? @status="Submitted" end @text=opts[:text] end |
#save_draft ⇒ Object
38 39 40 41 42 43 44 45 46 47 |
# File 'lib/sambal-cle/data_objects/assignment_submission.rb', line 38 def save_draft open on AssignmentStudentView do |assignment| assignment.assignment_text=@text # TODO: Add stuff for adding file(s) to the assignment assignment.save_draft @submission_date=right_now[:sakai] @status="Draft - In progress" end end |
#submit ⇒ Object
27 28 29 30 31 32 33 34 35 36 |
# File 'lib/sambal-cle/data_objects/assignment_submission.rb', line 27 def submit open on AssignmentStudentView do |assignment| assignment.assignment_text=@text # TODO: Add stuff for adding file(s) to the assignment assignment.submit @submission_date=right_now[:sakai] @status="Submitted" end end |