You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
educoder/app/views/polls/poll_setting.json.jbuilder

44 lines
1.4 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

json.course do
json.partial! "polls/course_name",locals:{course:@course}
end
json.poll do
json.extract! @poll, :id,:polls_name, :polls_status,:publish_time,:end_time,:show_result,:is_public,:unified_setting,:un_anonymous
json.user_groups_count @user_course_groups.count #当前用户的有权限的分班
json.published_count @poll_publish_count
json.course_id @course.id
json.user_permission @user_permission ##1当前为老师且无分班即有全部的权限#2其他老师/助教,且有分班的
end
if @user_published_setting.count > 0 #老师存在已发布的分班
total_array_groups = get_user_setting_course(@user_published_setting,@user_course_groups)
json.published_course_groups do
json.array! total_array_groups do |s|
json.course_group_id s[:course_group_id]
json.course_group_name s[:course_group_name]
json.course_publish_time s[:course_publish_time]
json.course_end_time s[:course_end_time]
end
end
else
json.published_course_groups []
end
if @user_course_groups.count > 0
json.course_groups do
json.array! @user_course_groups do |group|
course_choosed = 0
if @being_setting_course_ids.include?(group[:group_id])
course_choosed = 1
end
json.course_group_id group[:group_id]
json.course_group_name group[:group_name]
json.course_choosed course_choosed
end
end
else
json.course_groups []
end