FIX code review

This commit is contained in:
jasder 2021-04-22 16:35:54 +08:00
parent 6a3d297b30
commit 841778900c
22 changed files with 0 additions and 159 deletions

View File

@ -1,3 +0,0 @@
json.count @count
json.courses @courses, partial: 'users/courses/shared/course', as: :course

View File

@ -1,18 +0,0 @@
json.id course.id
json.name course.name
# json.members_count course.members_count
json.members_count course.course_members_count
# json.homework_commons_count course.homework_commons_count
json.homework_commons_count get_tasks_count course
json.attachments_count course.attachments.count
json.visits course.visits
json.school course.school&.name
json.first_category_url module_url(course.course_modules.where(hidden: 0).order(position: :desc).first, course)
json.is_public course.is_public
json.can_visited observed_logged_user? || course.can_visited?
json.teacher do
json.partial! 'users/shared/real_user', user: course.teacher
end

View File

@ -1,3 +0,0 @@
json.count @count
json.shixuns @shixuns, partial: 'users/shixuns/shared/shixun', as: :shixun, locals: { user: observed_user }

View File

@ -1,10 +0,0 @@
json.id shixun.id
json.identifier shixun.identifier
json.tag shixun.first_tag_repertoire&.name
json.image_url url_to_avatar(shixun)
json.name shixun.name
json.status shixun.status
json.human_status shixun.human_status
json.challenges_count shixun.challenges_count
json.finished_challenges_count @finished_challenges_count_map&.fetch(shixun.id, 0) || shixun.finished_challenges_count(user)
json.is_jupyter shixun.is_jupyter

View File

@ -1,6 +0,0 @@
json.extract! video, :id, :title, :cover_url, :file_url, :play_url, :vv, :user_id
json.play_duration video.video_play_duration
json.published_at video.display_published_at
json.created_at video.display_created_at
json.updated_at video.display_updated_at

View File

@ -1,2 +0,0 @@
json.count @count
json.videos @videos, partial: 'video', as: :video

View File

@ -1,7 +0,0 @@
json.count @count
json.videos do
json.array! @videos.each do |video|
json.partial! 'video', video: video
json.file_url nil
end
end

View File

@ -1 +0,0 @@
json.partial! 'video', video: current_video

View File

@ -1,3 +0,0 @@
json.user do
json.partial! 'weapps/shared/user', locals: { user: current_user }
end

View File

@ -1,8 +0,0 @@
json.course do
json.(@course, :id, :name)
json.code_halt @course.invite_code_halt == 1
json.invite_code @course.invite_code_halt == 0 ? @course.generate_invite_code : ""
json.teacher_name @course.teacher.real_name
json.teacher_img url_to_avatar(@course.teacher)
json.teacher_school @course.school.try(:name)
end

View File

@ -1,12 +0,0 @@
json.activities @activities do |activity|
json.(activity, :course_act_id, :course_act_type)
json.author do
user = activity.user
json.name user.real_name
json.login user.login
json.img url_to_avatar(user)
end
json.created_at activity.created_at.strftime('%m-%d %H:%M:')
json.container_name activity.container_name
json.container_type activity.course_act_type == "HomeworkCommon" ? activity.course_act&.homework_type : ""
end

View File

@ -1,2 +0,0 @@
json.(@course, :id, :name, :credit, :end_date)
json.course_list_name @course.course_list&.name

View File

@ -1,3 +0,0 @@
json.categories @categories.each do |category|
json.(category, :id, :name)
end

View File

@ -1,4 +0,0 @@
json.(@course, :id, :name, :course_members_count, :credit, :invite_code_halt)
json.teachers_count @course.teachers.count
json.students_count @course.students.count
json.course_identity @current_user.course_identity(@course)

View File

@ -1,7 +0,0 @@
json.students student_list @students, @course.excellent, @user_course_identity
json.students_count @students_count
if @course_group
json.course_group do
json.(@course_group, :id, :name, :invite_code, :course_members_count)
end
end

View File

@ -1,3 +0,0 @@
json.teacher_list teacher_list(@teacher_list, @user_course_identity)
json.teacher_list_size @teacher_list_size
json.apply_size @applications_size

View File

@ -1,30 +0,0 @@
json.carousels do
json.array! @carousels do |carousel|
json.extract! carousel, :id, :link, :position
json.path carousel.link
json.image_url Util::FileManage.source_disk_file_url(carousel)
end
end
if @advert.present?
json.advert do
json.extract! @advert, :id, :link
json.image_url Util::FileManage.source_disk_file_url(@advert)
end
else
json.advert nil
end
json.course_count @course_count
json.courses @courses.each do |course|
json.(course, :id, :name, :visits, :course_members_count, :is_end, :invite_code_halt)
json.creator course.teacher.real_name
json.avatar_url url_to_avatar(course.teacher)
json.invite_code course.invite_code_halt == 0 ? course.generate_invite_code : ""
json.school course.school&.name
course_member = @category == "study" ? course.students.where(user_id: @user.id).first : course.teachers.where(user_id: @user.id).first
json.sticky course_member.sticky
json.course_identity current_user.course_identity(course)
end

View File

@ -1,4 +0,0 @@
json.status 0
json.user do
json.partial! 'weapps/shared/user', locals: { user: @user }
end

View File

@ -1,14 +0,0 @@
json.count @results.total_count
json.results do
json.array! @results.with_highlights(multiple: true) do |obj, highlights|
json.merge! obj.to_searchable_json
json.type obj.class.name.downcase
json.title highlights.delete(:name)&.join('...') || obj.searchable_title
json.cover url_to_avatar(obj)
if obj.is_a?(Course)
json.author_avatar_url url_to_avatar(obj.teacher)
end
end
end

View File

@ -1,3 +0,0 @@
json.user do
json.partial! 'weapps/shared/user', locals: { user: current_user }
end

View File

@ -1,15 +0,0 @@
json.username user.full_name
json.real_name user.real_name
json.login user.login
json.user_id user.id
json.image_url url_to_avatar(user)
json.admin user.admin?
json.business user.business?
json.is_teacher user.user_extension&.teacher?
json.user_identity user.identity
json.identity user.user_extension&.identity
json.tidding_count 0
json.user_phone_binded user.phone.present?
json.phone user.phone
json.profile_completed user.profile_completed?
json.professional_certification user.professional_certification

View File

@ -1 +0,0 @@
json.user_account @user.phone.present? ? @user.phone : (@user.mail.present? ? @user.mail : @user.login)