- There are two kinds of
Users(using Single Table Inheritance) --StudentandTeacher Assignment: has_manyhomework_documents
- Import attributes:
deadline
HomeworkDocument: belongs_tograderandsubmitter, both of which are classStudent
- Important attributes:
grade,created_at,penalty
- Randomly send out submitted homework to graders
- Console:
Assignment.grade_all - Select all assignment that is not closed and graded, then send out randomly to a pool of graders. The pool of graders are the students who have submitted their homework for that assignment
- Use Heroku scheduler to run
Assignment.grade_allevery 1 hour
-
Automatically calculate penalty on late submission. Details in
app/models/homework_document.rb. -
Mailer automatically notify students of available grades and pending deadlines
- Using
SendGridonheroku. Current email address:[email protected]
- Email: SendGrid
- Ping to keep dyno live: NewRelic
Local setup
bundle install>bundle updaterake db:migrate>rake db:populate(db:populateto populate database with mock data)
Heroku setup
heroku create>git push heroku master>heroku rename new-nameheroku run rake db:migrateheroku addons:create sendgrid- change host in
config.action_mailer.default_url_options = { host: "polsci630.herokuapp.com" }
- change host in
heroku addons:create scheduler- Scheduling job: https://devcenter.heroku.com/articles/scheduler#scheduling-jobs
rake remind_deadlinerake assign_grading
heroku addons:create newrelic.Settings > Availability Monitoring > Enter URL- https://devcenter.heroku.com/articles/paperclip-s3 Add S3 Storage for paperclip upload
$ heroku config:set S3_BUCKET_NAME=your_bucket_name
$ heroku config:set AWS_ACCESS_KEY_ID=your_access_key_id
$ heroku config:set AWS_SECRET_ACCESS_KEY=your_secret_access_key
heroku pg:backups schedule DATABASE_URL --at '03:00 America/New_York'- heroku pg:backups
- heroku pg:backups schedule
Site customization
- Change site title:
application_helper.rb>def site_title - Late penalty:
homework_document.rb>def calculate_penalty
Student.find_by(name: "Student 1").submitted_homework_documents.map(&:grade)heroku logs -tStudent.all.map(&:name)Teacher.where(name: "Sun Choi").first.update_attribute(:type, "Student")HomeworkDocument.where("updated_at < ?", Time.now - 1.month)