Add WorkItem model for Problem sheets and equivalent
This commit is contained in:
parent
328616d55f
commit
f121c990e8
3
app/models/work_item.rb
Normal file
3
app/models/work_item.rb
Normal file
@ -0,0 +1,3 @@
|
||||
class WorkItem < ApplicationRecord
|
||||
belongs_to :course
|
||||
end
|
||||
11
db/migrate/20231007144031_create_work_items.rb
Normal file
11
db/migrate/20231007144031_create_work_items.rb
Normal file
@ -0,0 +1,11 @@
|
||||
class CreateWorkItems < ActiveRecord::Migration[7.1]
|
||||
def change
|
||||
create_table :work_items do |t|
|
||||
t.string :title, null: false
|
||||
t.references :course, null: false, foreign_key: true
|
||||
t.datetime :due_date, null: false
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
12
db/schema.rb
generated
12
db/schema.rb
generated
@ -10,7 +10,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema[7.1].define(version: 2023_10_06_210710) do
|
||||
ActiveRecord::Schema[7.1].define(version: 2023_10_07_144031) do
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
|
||||
@ -60,6 +60,16 @@ ActiveRecord::Schema[7.1].define(version: 2023_10_06_210710) do
|
||||
t.index ["lecture_id"], name: "index_tracked_time_entries_on_lecture_id"
|
||||
end
|
||||
|
||||
create_table "work_items", force: :cascade do |t|
|
||||
t.string "title", null: false
|
||||
t.bigint "course_id", null: false
|
||||
t.datetime "due_date", null: false
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.index ["course_id"], name: "index_work_items_on_course_id"
|
||||
end
|
||||
|
||||
add_foreign_key "recordings", "courses"
|
||||
add_foreign_key "tracked_time_entries", "lectures"
|
||||
add_foreign_key "work_items", "courses"
|
||||
end
|
||||
|
||||
11
test/fixtures/work_items.yml
vendored
Normal file
11
test/fixtures/work_items.yml
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||
|
||||
one:
|
||||
title: MyString
|
||||
course: one
|
||||
due_date07/10/2023: MyString
|
||||
|
||||
two:
|
||||
title: MyString
|
||||
course: two
|
||||
due_date07/10/2023: MyString
|
||||
7
test/models/work_item_test.rb
Normal file
7
test/models/work_item_test.rb
Normal file
@ -0,0 +1,7 @@
|
||||
require "test_helper"
|
||||
|
||||
class WorkItemTest < ActiveSupport::TestCase
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
end
|
||||
Loading…
Reference in New Issue
Block a user