app/models/submission.rb
# Handles file submissions. Late submissions have a status of "late"
Handles file submissions. Late submissions have a status of "late"
Handles file submissions . Late submissions have a status of " late "
def submit(user, file, submission_time, sdir = SUBMISSIONS_PATH)
    filename = file.original_filename
    dir = submit_dir(sdir)
    filepath = File.join(dir, filename)
    create_backup(filename, sdir) if File.exist?(filepath)
    submission_file = submission_files.create do |f|
      f.user = user
      f.filename = file.original_filename
      f.submitted_at = submission_time
      f.submission_file_status = 'late' if grouping.due_date < submission_time
    end
    File.binwrite(filepath, file.read) if submission_file.save
    submission_file
  end
def submit ( user , file , submission_time , sdir = SUBMISSIONS_PATH ) filename = file . original_filename dir = submit_dir ( sdir ) filepath = File . join ( dir , filename ) create_backup ( filename , sdir ) if File . exist? ( filepath ) submission_file = submission_files . create do | f | f . user = user f . filename = file . original_filename f . submitted_at = submission_time f . submission_file_status = 'late' if grouping . due_date < submission_time end File . binwrite ( filepath , file . read ) if submission_file . save submission_file end
Handles file submissions.
Handles file submissions .
# create a backup if file already exists # create a submission_file record # upload file contents to file system
user
<not_specific>
file
<not_specific>
submission_time
<not_specific>
sdir
<not_specific>