parent
48ab836b54
commit
218f5f0262
@ -0,0 +1,3 @@
|
||||
class ExaminationItemAnalysis < ApplicationRecord
|
||||
belongs_to :examination_item
|
||||
end
|
@ -0,0 +1,51 @@
|
||||
json.single_questions do
|
||||
json.questions @single_questions.each do |question|
|
||||
json.(question, :id, :position, :score, :item_type)
|
||||
json.partial! "item_banks/item", locals: {item: question}
|
||||
end
|
||||
json.questions_score @single_questions.map(&:score).sum
|
||||
json.questions_count @single_questions.size
|
||||
end
|
||||
|
||||
json.multiple_questions do
|
||||
json.questions @multiple_questions.each do |question|
|
||||
json.(question, :id, :position, :score, :item_type)
|
||||
json.partial! "item_banks/item", locals: {item: question}
|
||||
end
|
||||
json.questions_score @multiple_questions.map(&:score).sum
|
||||
json.questions_count @multiple_questions.size
|
||||
end
|
||||
|
||||
json.judgement_questions do
|
||||
json.questions @judgement_questions.each do |question|
|
||||
json.(question, :id, :position, :score, :item_type)
|
||||
json.partial! "item_banks/item", locals: {item: question}
|
||||
end
|
||||
json.questions_score @judgement_questions.map(&:score).sum
|
||||
json.questions_count @judgement_questions.size
|
||||
end
|
||||
|
||||
json.program_questions do
|
||||
json.questions @program_questions.each do |question|
|
||||
json.(question, :id, :position, :score, :item_type)
|
||||
json.partial! "item_banks/item", locals: {item: question}
|
||||
end
|
||||
json.questions_score @program_questions.map(&:score).sum
|
||||
json.questions_count @program_questions.size
|
||||
end
|
||||
|
||||
json.exam do
|
||||
json.(@exam, :id, :name, :difficulty, :sub_discipline_id, :duration)
|
||||
json.all_score @items.map(&:score).sum
|
||||
json.all_questions_count @items.size
|
||||
|
||||
json.discipline do
|
||||
json.(@exam.sub_discipline&.discipline, :id, :name)
|
||||
end
|
||||
json.sub_discipline do
|
||||
json.(@exam.sub_discipline, :id, :name)
|
||||
end
|
||||
json.tag_disciplines @exam.tag_disciplines do |tag|
|
||||
json.(tag, :id, :name)
|
||||
end
|
||||
end
|
@ -0,0 +1,10 @@
|
||||
class CreateExaminationItemAnalyses < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
create_table :examination_item_analyses do |t|
|
||||
t.references :examination_item, index: true, unique: true
|
||||
t.text :analysis
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,5 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe ExaminationItemAnalysis, type: :model do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
Loading…
Reference in new issue