Merge branch 'dev_aliyun' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun

dev_hjm
hjm 6 years ago
commit e891d9be7e

@ -40,6 +40,8 @@ class Users::VideosController < Users::BaseController
def batch_publish
Videos::BatchPublishService.call(observed_user, batch_publish_params)
render_ok
rescue Videos::BatchPublishService::Error => ex
render_error(ex.message)
end
private

@ -8,7 +8,7 @@ class CourseGroup < ApplicationRecord
has_many :homework_group_reviews, :dependent => :destroy
scope :by_group_ids, lambda { |ids| where(id: ids)}
validates :name, length: { maximum: 20 }
validates :name, length: { maximum: 60 }
after_create :generate_invite_code

@ -1,4 +1,6 @@
class Videos::BatchPublishService < ApplicationService
Error = Class.new(StandardError)
attr_reader :user, :params
def initialize(user, params)
@ -16,6 +18,8 @@ class Videos::BatchPublishService < ApplicationService
video = user.videos.find_by(uuid: param[:video_id])
next if video.blank? || video.processing_video_apply.present?
raise Error, '视频还未上传完成' if video.vod_uploading?
video.title = param[:title].to_s.strip.presence || video.title
video.apply_publish
video.save!

@ -17,7 +17,8 @@ if question.question_type <= 2 #当为选择题或判断题时,只显示选
end
json.question_choices do
json.array! exercise_choices.each_with_index.to_a do |a,index|
standard_answer_b = standard_answers_array.include?(a.choice_position)
#TODO: 旧版本来一个题只有一个标准答案的新版又做成了一个题有多个标准答案exercise_choice_id存放的是标准答案的位置..
standard_answer_b = standard_answers_array.join("").include?(a.choice_position.to_s)
user_answer_b = user_answer.include?(a.id)
json.c_position (index+1) if ex_choice_random_boolean #当选项随机时,选项位置以此为准,否则不出现
json.choice_id a.id

Loading…
Cancel
Save