pre_develop
jingquan huang 6 years ago
commit d1bebc1492

@ -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表示该用户是用邮箱注册

@ -26,13 +26,10 @@
<div style="float: left;">
<%= hidden_field_tag :data_type, params[:data_type] || 'grow' %>
<% if params[:data_type] == 'contrast' %>
<a href="javascript:void(0)" class="fl task-btn ml5 mt10 contrast-btn task-btn-orange">时间对比</a>
<a href="javascript:void(0)" class="fl task-btn ml5 mt10 grow-btn">新增数据</a>
<% else %>
<a href="javascript:void(0)" class="fl task-btn ml5 mt10 contrast-btn">时间对比</a>
<a href="javascript:void(0)" class="fl task-btn ml5 mt10 grow-btn task-btn-orange">新增数据</a>
<% end %>
<a href="javascript:void(0)" class="fl task-btn ml5 mt10 contrast-btn <%= params[:data_type] == 'contrast' ? 'task-btn-orange' : '' %>"
data-tip-down="请在左侧分别选择需进行对比的两个时段,下表显示两时段选定指标两时段变化情况对比">时段对比</a>
<a href="javascript:void(0)" class="fl task-btn ml5 mt10 grow-btn <%= params[:data_type] == 'contrast' ? '' : 'task-btn-orange' %>"
data-tip-down="请在左侧选择时间段,下表显示选定时间段内各项指标数据变化情况">数据变化</a>
</div>
<%= text_field_tag :keyword, params[:keyword], placeholder: '请输入单位名称或者ID关键字进行搜索',

@ -21,8 +21,8 @@
<th width="6%">序号</th>
<th width="10%">ID</th>
<th width="20%" class="edu-txt-left">单位名称</th>
<th width="22%">时段一<br><%= "#{params[:begin_date]}至#{params[:end_date]}" %></th>
<th width="22%">时段二<br><%= "#{params[:other_begin_date]}至#{params[:other_end_date]}" %></th>
<th width="22%">时段一<br><%= "#{params[:begin_date]} 05:00至#{params[:end_date]} 05:00" %></th>
<th width="22%">时段二<br><%= "#{params[:other_begin_date]} 05:00至#{params[:other_end_date]} 05:00" %></th>
<th width="20%" colspan="2">
<%= sort_tag('变化情况', name: 'percentage', path: school_data_contrast_managements_path) %>
<br> 新 增 数 | 新增百分比)

@ -9,7 +9,7 @@
新增教师<span class="color-red"><%= @grow_summary.teacher_increase_count || 0 %></span>人,
新增学生<span class="color-red"><%= @grow_summary.student_increase_count || 0 %></span>人,
新增课堂<span class="color-red"><%= @grow_summary.course_increase_count || 0 %></span>个,
新增实训<span class="color-red"><%= @grow_summary.shixun_increase_count || 0 %></span>个,
新增实训作业<span class="color-red"><%= @grow_summary.shixun_increase_count || 0 %></span>个,
活跃用户<span class="color-red"><%= @grow_summary.active_user_count || 0 %></span>个
</div>
<table class="edu-pop-table edu-txt-center" cellpadding="0" cellspacing="0" style="table-layout: fixed">
@ -22,7 +22,7 @@
<th width="12%"><%= sort_tag('新增教师', name: 'teacher_increase_count', path: school_data_grow_managements_path) %></th>
<th width="12%"><%= sort_tag('新增学生', name: 'student_increase_count', path: school_data_grow_managements_path) %></th>
<th width="12%"><%= sort_tag('新增课堂', name: 'course_increase_count', path: school_data_grow_managements_path) %></th>
<th width="12%"><%= sort_tag('新增实训', name: 'shixun_increase_count', path: school_data_grow_managements_path) %></th>
<th width="12%"><%= sort_tag('新增实训作业', name: 'shixun_increase_count', path: school_data_grow_managements_path) %></th>
<th width="12%"><%= sort_tag('活跃用户', name: 'active_user_count', path: school_data_grow_managements_path) %></th>
</tr>
</thead>

@ -3,5 +3,5 @@ zh:
teacher_increase_count: 新增教师
student_increase_count: 新增学生
course_increase_count: 新增课堂
shixun_increase_count: 新增实训
shixun_increase_count: 新增实训作业
active_user_count: 活跃用户
Loading…
Cancel
Save