dev_oauth
commit
c751fecf72
@ -0,0 +1,21 @@
|
||||
|
||||
json.members @members do |member|
|
||||
json.partial! 'subject_member', locals: { user: member.user }
|
||||
json.role member.role
|
||||
end
|
||||
|
||||
# 技能标签
|
||||
json.tags @tags do |tag|
|
||||
unless tag.blank?
|
||||
json.tag_name tag
|
||||
json.status @user_tags.include?(tag)
|
||||
end
|
||||
end
|
||||
|
||||
# 我的进展
|
||||
json.progress do
|
||||
json.my_score @subject.my_subject_score
|
||||
json.all_score @subject.all_score
|
||||
json.learned @subject.my_subject_progress
|
||||
json.time @subject.my_consume_time
|
||||
end
|
@ -0,0 +1,19 @@
|
||||
#coding=utf-8
|
||||
# 执行示例 bundle exec rake excellent_course_exercise:student_answer args=149,2903
|
||||
desc "同步精品课的学生试卷数据"
|
||||
namespace :excellent_course_exercise do
|
||||
task :student_answer => :environment do
|
||||
|
||||
course = Course.find_by(id: 2933)
|
||||
exercises = course.exercises
|
||||
|
||||
participant_count = 1042
|
||||
pass_count = 823
|
||||
|
||||
members_1 = course.students.order("id asc").limit(987)
|
||||
members_2 = course.students.order("id asc").limit(1042)
|
||||
members_1 = course.students.order("id asc").limit(322)
|
||||
|
||||
|
||||
end
|
||||
end
|
@ -0,0 +1,19 @@
|
||||
desc "开放课程开课前通知报名用户"
|
||||
namespace :public_course_notice do
|
||||
task :tiding => :environment do
|
||||
Course.where(excellent: 1).where("start_date is not null and start_date = '#{Date.today}'").each do |course|
|
||||
attrs = %i[user_id trigger_user_id status container_id container_type belong_container_id
|
||||
belong_container_type tiding_type created_at updated_at]
|
||||
|
||||
same_attrs = {
|
||||
trigger_user_id: 0, container_id: course.id, container_type: 'PublicCourseStart',
|
||||
belong_container_id: course.id, belong_container_type: 'Course', tiding_type: 'System', status: 0
|
||||
}
|
||||
Tiding.bulk_insert(*attrs) do |worker|
|
||||
course.students.each do |student|
|
||||
worker.add same_attrs.merge(user_id: student.user_id)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in new issue