# id: 1, //实训id
# name: '实训名称',
# tag_name: 'Python基础'
# stu_num: 1, //学习人数
# score_info: [5.0,1,2,3,4,5], //实训打分,第一个总分,后五个依次为从5星到1星的百分占比
# challenges_count: 4,//关卡数
# exp: 100, //经验值
# level: '初级', //1. 初级  2. 中级   3. 高级
# pic: '', //头像url
#
json.array! shixuns do |shixun|
  json.id shixun.id
  json.identifier shixun.identifier
  json.name shixun.name
  json.status shixun.status
  json.is_jupyter shixun.is_jupyter?
  json.power (current_user.shixun_permission(shixun)) # 现在首页只显示已发布的实训
  # REDO: 局部缓存
  json.tag_name @tag_name_map&.fetch(shixun.id, nil) || shixun.tag_repertoires.first.try(:name)
  json.myshixuns_count shixun.myshixuns_count
  json.stu_num shixun.myshixuns_count
  json.score_info shixun.averge_star
  json.challenges_count shixun.challenges_count
  #json.exp   shixun.all_score
  json.level level_to_s(shixun.trainee)
  json.pic url_to_avatar(shixun)
end