commit
fe8c808355
@ -0,0 +1,14 @@
|
||||
class LibrariesController < ApplicationController
|
||||
include PaginateHelper
|
||||
|
||||
def index
|
||||
default_sort('updated_at', 'desc')
|
||||
|
||||
@items = ItemBankQuery.call(params)
|
||||
@items = paginate courses.includes(:school, :students, :attachments, :homework_commons, teacher: :user_extension)
|
||||
end
|
||||
|
||||
def create
|
||||
|
||||
end
|
||||
end
|
@ -0,0 +1,4 @@
|
||||
class Curriculum < ApplicationRecord
|
||||
belongs_to :curriculum_direction
|
||||
has_many :knowledge_points, dependent: :destroy
|
||||
end
|
@ -0,0 +1,4 @@
|
||||
class CurriculumDirection < ApplicationRecord
|
||||
has_many :curriculums
|
||||
has_many :knowledge_points
|
||||
end
|
@ -0,0 +1,3 @@
|
||||
class ItemAnalysis < ApplicationRecord
|
||||
belongs_to :item_bank
|
||||
end
|
@ -0,0 +1,13 @@
|
||||
class ItemBank < ApplicationRecord
|
||||
# difficulty: 1 简单 2 适中 3 困难
|
||||
# item_type: 0 单选 1 多选 2 判断 3 填空 4 简答 5 实训 6 编程
|
||||
enum item_type: { SINGLE: 0, MULTIPLE: 1, JUDGMENT: 2, COMPLETION: 3, SUBJECTIVE: 4, PRACTICAL: 5, PROGRAM: 6 }
|
||||
|
||||
belongs_to :curriculum
|
||||
belongs_to :curriculum_direction
|
||||
belongs_to :user
|
||||
|
||||
has_one :item_analysis, dependent: :destroy
|
||||
has_many :item_choices, dependent: :destroy
|
||||
has_many :item_baskets, dependent: :destroy
|
||||
end
|
@ -0,0 +1,4 @@
|
||||
class ItemBasket < ApplicationRecord
|
||||
belongs_to :item_bank
|
||||
belongs_to :user
|
||||
end
|
@ -0,0 +1,3 @@
|
||||
class ItemChoice < ApplicationRecord
|
||||
belongs_to :item_bank
|
||||
end
|
@ -0,0 +1,5 @@
|
||||
class KnowledgePoint < ApplicationRecord
|
||||
belongs_to :curriculum_direction
|
||||
belongs_to :curriculum
|
||||
has_many :knowledge_point_containers, dependent: :destroy
|
||||
end
|
@ -0,0 +1,3 @@
|
||||
class KnowledgePointContainer < ApplicationRecord
|
||||
belongs_to :knowledge_point
|
||||
end
|
@ -1,6 +1,6 @@
|
||||
json.partial! 'shixuns/right', locals: { shixun: @shixun }
|
||||
|
||||
json.follow follow?(@shixun.owner, User.current)
|
||||
json.fans_count @fans_count
|
||||
json.followed_count @followed_count
|
||||
# json.follow follow?(@shixun.owner, User.current)
|
||||
# json.fans_count @fans_count
|
||||
# json.followed_count @followed_count
|
||||
json.user_shixuns_count @user_own_shixuns
|
||||
|
@ -0,0 +1,9 @@
|
||||
class CreateCurriculumDirections < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
create_table :curriculum_directions do |t|
|
||||
t.string :name
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,10 @@
|
||||
class CreateCurriculums < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
create_table :curriculums do |t|
|
||||
t.string :name
|
||||
t.references :curriculum_direction, index: true
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,11 @@
|
||||
class CreateKnowledgePoints < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
create_table :knowledge_points do |t|
|
||||
t.string :name
|
||||
t.references :curriculum_direction, index: true
|
||||
t.references :curriculum, index: true
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,12 @@
|
||||
class CreateKnowledgePointContainers < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
create_table :knowledge_point_containers do |t|
|
||||
t.references :knowledge_point
|
||||
t.integer :container_id
|
||||
t.string :container_type
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
add_index :knowledge_point_containers, [:knowledge_point_id, :container_id, :container_type], name: "container_index", unique: true
|
||||
end
|
||||
end
|
@ -0,0 +1,16 @@
|
||||
class CreateItemBanks < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
create_table :item_banks do |t|
|
||||
t.text :name
|
||||
t.references :curriculum, index: true
|
||||
t.references :curriculum_direction, index: true
|
||||
t.integer :item_type
|
||||
t.integer :difficulty
|
||||
t.references :user, index: true
|
||||
t.boolean :public
|
||||
t.integer :quotes
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,10 @@
|
||||
class CreateItemAnalyses < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
create_table :item_analyses do |t|
|
||||
t.references :item_bank, index: true
|
||||
t.text :analysis
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,11 @@
|
||||
class CreateItemChoices < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
create_table :item_choices do |t|
|
||||
t.references :item_bank, index: true
|
||||
t.text :choice_text
|
||||
t.boolean :is_answer
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,10 @@
|
||||
class CreateItemBaskets < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
create_table :item_baskets do |t|
|
||||
t.references :item_bank, index: true
|
||||
t.references :user, index: true
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,5 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe CurriculumDirection, type: :model do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
@ -0,0 +1,5 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Curriculum, type: :model do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
@ -0,0 +1,5 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe ItemAnalysis, type: :model do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
@ -0,0 +1,5 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe ItemBank, type: :model do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
@ -0,0 +1,5 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe ItemBasket, type: :model do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
@ -0,0 +1,5 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe ItemChoice, type: :model do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
@ -0,0 +1,5 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe KnowledgePointContainer, type: :model do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
@ -0,0 +1,5 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe KnowledgePoint, type: :model do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
Loading…
Reference in new issue