diff --git a/app/views/homework_commons/index.json.jbuilder b/app/views/homework_commons/index.json.jbuilder index db3603746..a508659e8 100644 --- a/app/views/homework_commons/index.json.jbuilder +++ b/app/views/homework_commons/index.json.jbuilder @@ -17,7 +17,10 @@ json.homeworks @homework_commons.each do |homework| json.status_time curr_status[:time] json.time_status curr_status[:time_status] json.allow_late homework.allow_late - json.author homework.user.real_name + json.author homework.user&.real_name + json.author_img url_to_avatar(homework.user) + json.author_login homework.user&.login + json.created_at homework.created_at.strftime("%Y-%m-%d") # 只有在主目录才显示 json.upper_category_name homework.course_second_category&.name unless params[:category] diff --git a/app/views/homework_commons/works_list.json.jbuilder b/app/views/homework_commons/works_list.json.jbuilder index f5e6ca01a..cd2f17cf5 100644 --- a/app/views/homework_commons/works_list.json.jbuilder +++ b/app/views/homework_commons/works_list.json.jbuilder @@ -84,6 +84,7 @@ elsif @user_course_identity == Course::STUDENT json.user_login @work.user.login json.student_id @work.user.student_id json.user_name @work.user.real_name + json.user_img url_to_avatar(@work.user) json.group_name @member.course_group_name end @@ -108,6 +109,7 @@ if @homework.homework_type == "practice" json.view_answer_count work.myshixun.try(:view_answer_count).to_i json.user_login work.user.try(:login) json.user_name work.user.try(:real_name) + json.user_img url_to_avatar(work.user) json.student_id work.user.try(:student_id) json.group_name @students.select{|student| student.user_id == work.user_id}.first.try(:course_group_name) json.work_status work.compelete_status @@ -169,6 +171,7 @@ elsif @homework.homework_type == "group" || @homework.homework_type == "normal" json.user_login @is_evaluation ? "--" : work.user.try(:login) json.user_name @is_evaluation ? "匿名" : work.user.try(:real_name) + json.user_img url_to_avatar(@is_evaluation ? "0" : work.user) end end