diff --git a/app/services/cnmoocs_service.rb b/app/services/cnmoocs_service.rb index 41705eb6..72318905 100644 --- a/app/services/cnmoocs_service.rb +++ b/app/services/cnmoocs_service.rb @@ -6,7 +6,7 @@ class CnmoocsService page = params[:pageNo].to_i limit = params[:pageSize] || 16 offset = page * limit.to_i - resouces = [] + resources = [] if params[:level].to_s == "1" subjects = Subject.find_by_sql("SELECT subjects.id, subjects.name, subjects.status, COUNT(myshixuns.id) AS myshixun_member_count FROM myshixuns, stage_shixuns, subjects WHERE myshixuns.shixun_id = stage_shixuns.shixun_id @@ -14,8 +14,8 @@ class CnmoocsService GROUP BY subjects.id ORDER BY myshixun_member_count DESC limit #{offset},#{limit}") subjects.each do |subject| - resouces << {resouceId: subject.id, parentId: nil, resouceName: subject.name, accessType: 0, nodeType: 0, - resouceType: 2} + resources << {resourceId: subject.id, parentId: nil, resourceName: subject.name, accessType: 0, nodeType: 0, + resourceType: 2} end totalCount = Subject.where(:status => 2, :hidden => 0).count count = subjects.count @@ -23,8 +23,8 @@ class CnmoocsService return {error: -1, messages: "请求二级及其更高目录时,parentId不能为空"} if params[:parentId].blank? stages = Stage.where(:subject_id => params[:parentId]).offset(offset).limit(limit) stages.each do |stage| - resouces << {resouceId: stage.id, parentId: params[:parentId], resouceName: stage.name, accessType: 0, nodeType: 0, - resouceType: 2} + resources << {resourceId: stage.id, parentId: params[:parentId], resourceName: stage.name, accessType: 0, nodeType: 0, + resourceType: 2} end totalCount = Stage.where(:subject_id => params[:parentId]).count count = stages.count @@ -33,8 +33,8 @@ class CnmoocsService shixun_ids = StageShixun.where(:stage_id => params[:parentId]).pluck(:shixun_id) shixuns = Shixun.where(:id => shixun_ids).offset(offset).limit(limit) shixuns.each do |shixun| - resouces << {resouceId: shixun.id, parentId: params[:parentId], resouceName: shixun.name, accessType: 2, - nodeType: 1, resouceType: 1} + resources << {resourceId: shixun.id, parentId: params[:parentId], resourceName: shixun.name, accessType: 2, + nodeType: 1, resourceType: 1} end totalCount = Shixun.where(:id => shixun_ids).count count = shixuns.count @@ -42,7 +42,7 @@ class CnmoocsService pageCount = ((totalCount / limit.to_f) == (totalCount / limit)) ? (totalCount / limit) : ((totalCount / limit) + 1) {error: 0, messages: "请求成功", page: {count: count, totalCount: totalCount, pageNo: page, pageSize: limit, pageCount: pageCount}, - data: {resouces: resouces} } + data: {resources: resources} } end def search_resources params @@ -115,7 +115,7 @@ class CnmoocsService end def source_url(params, token) - shixun = Shixun.find_by_id(params[:resouceId]) + shixun = Shixun.find_by_id(params[:resourceId]) if shixun.blank? return { error: -1, messages: '资源不存在' } end @@ -123,7 +123,7 @@ class CnmoocsService end def get_students_data params - shixun = Shixun.find_by_id params[:resouceId] + shixun = Shixun.find_by_id params[:resourceId] return {error: -1, messages: "资源id不对,请使用资源的id查找"} if shixun.blank? myshixun = shixun.myshixuns.where(:user_id => params[:userId]).includes(:games).first if myshixun.present? @@ -150,7 +150,7 @@ class CnmoocsService challenges_count: shixun.challenges_count, score_info: shixun.averge_star, level: level} end - {resouces: shixun_list} + {resources: shixun_list} end # 为新创建的用户随机生成以m为前缀的用户名,m表示该用户是用邮箱注册 diff --git a/app/views/managements/schools/_contrast_search_form.html.erb b/app/views/managements/schools/_contrast_search_form.html.erb index 4d24a810..9597a9c7 100644 --- a/app/views/managements/schools/_contrast_search_form.html.erb +++ b/app/views/managements/schools/_contrast_search_form.html.erb @@ -26,13 +26,10 @@
<%= sort_tag('新增教师', name: 'teacher_increase_count', path: school_data_grow_managements_path) %> | <%= sort_tag('新增学生', name: 'student_increase_count', path: school_data_grow_managements_path) %> | <%= sort_tag('新增课堂', name: 'course_increase_count', path: school_data_grow_managements_path) %> | -<%= sort_tag('新增实训', name: 'shixun_increase_count', path: school_data_grow_managements_path) %> | +<%= sort_tag('新增实训作业', name: 'shixun_increase_count', path: school_data_grow_managements_path) %> | <%= sort_tag('活跃用户', name: 'active_user_count', path: school_data_grow_managements_path) %> | diff --git a/config/locales/school_daily_reports/zh.yml b/config/locales/school_daily_reports/zh.yml index 57caf343..2db8a429 100644 --- a/config/locales/school_daily_reports/zh.yml +++ b/config/locales/school_daily_reports/zh.yml @@ -3,5 +3,5 @@ zh: teacher_increase_count: 新增教师 student_increase_count: 新增学生 course_increase_count: 新增课堂 - shixun_increase_count: 新增实训 + shixun_increase_count: 新增实训作业 active_user_count: 活跃用户 \ No newline at end of file
---|