Compare commits

...

890 Commits

Author SHA1 Message Date
caishi b4df1472bb 统计-权限管理2 6 years ago
caishi e20e6953f2 统计-权限管理 6 years ago
caishi 67f50c7ae5 Merge branch 'develop' into dev_partners 6 years ago
caishi cb20217d49 Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
caishi 8b42018d40 实训课程右侧教学团队 6 years ago
杨树明 8c7c6941b6 Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
杨树明 e38e35c72b b 6 years ago
caishi 6d08f360bf Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
caishi 740e4d88c4 实训课程块里有没有数据的可能,需要固定高度 6 years ago
杨树明 a795e61921 Merge remote-tracking branch 'origin/develop' into develop 6 years ago
杨树明 a49385f073 调整 6 years ago
caishi c8e9d6e274 统计-权限管理 6 years ago
p31729568 9d00433565 add students_url to get nav api 6 years ago
p31729568 7efe78c83a fix copy ec year 6 years ago
杨树明 436571090a b 6 years ago
杨树明 a3dec858f8 Merge remote-tracking branch 'origin/develop' into develop 6 years ago
杨树明 d5e334738f b 6 years ago
hjm 8df8dc95d5 Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
hjm 98ce08d3c7 ec 弹出层 6 years ago
杨树明 b7c7127f3a Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into educoder 6 years ago
杨树明 a339b3c429 恢复 6 years ago
杨树明 b6953aa038 b 6 years ago
杨树明 41e6f10960 Merge remote-tracking branch 'origin/develop' into develop 6 years ago
杨树明 2a3e7090ae 合并认证 6 years ago
caishi dac1d99f9e Merge branch 'develop' into dev_partners 6 years ago
caishi f71d2a9a42 权限管理 6 years ago
p31729568 b30d8a6a89 modify create ec year code 6 years ago
hjm ce9dc71211 b 6 years ago
hjm 22f303e4df sec_key 6 years ago
hjm a2acd872c9 Merge branch 'dev_ec' into develop 6 years ago
hjm b64c1a50a4 ec 6 years ago
jingquan huang eb705d526e Merge branch 'educoder' of http://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into educoder 6 years ago
jingquan huang 9b32b4675c Merge branch 'develop' of http://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
jingquan huang fdecb7c53d 修整 6 years ago
jingquan huang ae07c1b6df 自动评测不记录 6 years ago
caishi 7d2730cfa5 工程认证 6 years ago
hjm 80f9ee5ed5 b 6 years ago
hjm a31b826039 sec_key 6 years ago
jingquan huang b920395ede 中间数据监控接口标识存储 6 years ago
jingquan huang d27f6a1ba4 Merge branch 'develop' of http://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
jingquan huang 407f5615f2 identifier生成 6 years ago
guange a2ca817642 merge 6 years ago
guange 88096c807f 加入质量检测请求 6 years ago
daiao dd7f28230c Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
daiao e72abe4305 还原 6 years ago
jingquan huang 346850df2b Merge branch 'educoder' into develop 6 years ago
jingquan huang 5a88a81d0f 平台时间记录错误问题 6 years ago
daiao c8f178f8a7 测试版测试人数 6 years ago
caishi a43a8d8322 合作伙伴 6 years ago
cxt b124c358c9 调整 6 years ago
daiao db3422a8f1 Merge branch 'develop' into educoder 6 years ago
cxt 22bddecf47 调整 6 years ago
cxt 7dc216bf69 Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
cxt 82b7df0d8b 调整 6 years ago
jasder 36666c961b FIX Adj jump url 6 years ago
daiao 07e6182c7e post中间层信息增加错误信息日志 6 years ago
daiao fe2eab517b post中间层信息增加错误信息日志 6 years ago
cxt d69fd728a3 优化作业列表和作品列表 6 years ago
daiao d4ad370635 职业路径页面无法编辑 6 years ago
cxt cb03317076 实训作业列表优化 6 years ago
daiao 4f1fcaa16d Merge branch 'develop' into educoder 6 years ago
daiao 6d18d11200 1 6 years ago
daiao 0e54d0dee3 Merge branch 'educoder' into develop 6 years ago
daiao b86841fe01 评测页面调整 6 years ago
daiao 741b51f668 超级管理员评测页面排序显示问题 6 years ago
daiao 254618b3b9 Merge branch 'develop' into educoder 6 years ago
daiao a80e89e5f0 1 6 years ago
daiao 24881fa282 评测还原 6 years ago
daiao 9beb3131d2 评测时间创建时间 6 years ago
daiao 0292431bec 创建时间 6 years ago
daiao 3d959e025a 超级管理员的课堂列表Excel导出功能也增加 课堂学生的“评测次数”统计数据 6 years ago
daiao d648ecb8ed Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
daiao f31d1a4c11 评测增加创建pod和clone代码状态的信息 6 years ago
p31729568 db64dbe8e9 modify school grow data list 6 years ago
daiao c67157ca7e 【实训】允许跳关,但是用户点后续关卡的挑战按钮都跳到了第一关 6 years ago
daiao 9bb4442121 【课堂】学生的成绩导出,增加邮箱信息的导出 6 years ago
daiao ed4a3711b7 解决冲突 6 years ago
daiao fa2cc5b867 1 6 years ago
杨树明 146873ffdc 解决生产环境】项目-issue中的结束时间日历显示不全导致用户无法选择 6 years ago
daiao 2912f32041 超级管理员的课堂列表页面增加 课堂学生的“评测次数”统计显示 6 years ago
daiao 8d44fea995 Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
daiao 0bfee48829 恢复调试 6 years ago
p31729568 5360ed4d3a fix save school fail bug 6 years ago
daiao 2374e6f31c 超级管理员评测时间页面增加按时间搜索并增加最大执行时间列 6 years ago
jingquan huang 4300887c85 评测记录样式修整 6 years ago
jingquan huang 64e7c5a953 评测结果记录按总时间倒排 6 years ago
jingquan huang 2862d530f7 评测简版 6 years ago
jingquan huang dec3922a2a 评测 6 years ago
jingquan huang 173a4e547d Merge branch 'educoder' into develop 6 years ago
jingquan huang 2d3cb54288 Merge branch 'develop' of http://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
jingquan huang 034312aec4 简略版统计 6 years ago
cxt ed00b8e773 Merge branch 'develop' into educoder 6 years ago
cxt b8daa7e818 调整导入学生账号 6 years ago
cxt 1350e8fb59 超级管理员的账号导入 6 years ago
cxt 88d4bed989 升级通知的时间间隔 6 years ago
daiao 46631425dd Merge branch 'develop' into educoder 6 years ago
daiao 1d197501bd 1 6 years ago
hjm 3222a18550 Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
hjm 982d27b90a || ratio === 125 6 years ago
daiao 2859029899 Merge branch 'develop' into educoder 6 years ago
daiao af97c45716 解锁测试集 6 years ago
daiao 97a5e132ee Merge branch 'develop' into educoder 6 years ago
jingquan huang 037e7c08ec .. 6 years ago
jingquan huang 1b2494ea5e Merge branch 'educoder' into develop 6 years ago
jingquan huang 3685c386db 实训临时一些优化 6 years ago
daiao 62e36d87e5 1 6 years ago
daiao b4bc64e401 图片类实训打印日志 6 years ago
hjm 4a95592b67 解决HiDPI/Retina显示器进入tpi时,提示缩放比例变动的问题。 6 years ago
cxt 9e68757d50 日志 6 years ago
cxt 110fbbc87b 日志 6 years ago
daiao eea7aae984 修改回来 6 years ago
daiao dee79a3d75 Merge branch 'develop' into educoder 6 years ago
daiao 542830b315 Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
daiao b139d1cf28 评测策略修改 6 years ago
jasder 01a9662ac2 FIX 修复合作伙伴添加客户后,与我的菜单中 '客户管理'列表数据不一致的bug 6 years ago
Alec Zhou 8b7bce39bb 修改绑定邮箱的链接 6 years ago
cxt cfa9e4adb8 导出调整 6 years ago
cxt 056c89bfae 导出调整 6 years ago
Alec Zhou b24547f9e0 Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
Alec Zhou 923d702d01 将current_user修改为User.current 6 years ago
cxt 28191b71ea Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
cxt 39423255da 实训报告导出报500 6 years ago
p31729568 8c3767cfa2 fix my account page reject trial auth notify modal bug 6 years ago
p31729568 dbaed7bc12 modify reject trial auth modal 6 years ago
cxt aa6e3dddbf 试用授权未审批页面增加学校统计链接 6 years ago
Alec Zhou 584da88eca Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
Alec Zhou 4b7d55cbef 创建openi记录之后建立起user与openi之间的联系 6 years ago
cxt 6a80a0bbf1 Merge branch 'educoder' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into educoder 6 years ago
cxt 31635eb93f 试卷题的表格样式 6 years ago
daiao a259e7c63d Merge branch 'develop' into educoder 6 years ago
p31729568 fcfda1f9a2 fix export school statistic xls empty bug 6 years ago
Alec Zhou fbf86d64dc 解除openi单点登录相关代码的注释 6 years ago
p31729568 495cc01315 not statistic deleted courses to school statistic report 6 years ago
daiao 8655233ef9 Merge branch 'develop' into educoder 6 years ago
daiao c645d89628 Merge branch 'develop' into educoder 6 years ago
p31729568 35e26e22f7 remove debug code 6 years ago
p31729568 1fa27ae9d3 fix reject trial auth feature issue 6 years ago
p31729568 9c3fdd0c08 fix management agree or reject trial auth 6 years ago
cxt 9cf1de1880 调整 6 years ago
cxt 3c76641df3 调整 6 years ago
cxt 4c2d678253 调整 6 years ago
cxt efa4020aa3 Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
cxt f6e533c6b6 试用授权的审批短信发送手机号变更 6 years ago
cxt e2669b8e78 试卷分数迁移 6 years ago
p31729568 6c53f561d8 modify reject trial auth tiding content 6 years ago
p31729568 f1b0c6a038 Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
p31729568 05cd6b874b reject trial authorization modal feature 6 years ago
daiao 7359854e28 超级管理员 已发布实训路径的excel导出增加实训的实训发布时间和课程等级列 6 years ago
daiao 85c96c5167 1 6 years ago
daiao aa525adae9 Merge branch 'develop' into educoder 6 years ago
cxt 92e81a076e 迁移 6 years ago
cxt 8502336b2a Merge branch 'educoder' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into educoder 6 years ago
cxt 8148c1797e 迁移 6 years ago
杨树明 745597348d b 6 years ago
jingquan huang 5950eb66d6 添加权限 6 years ago
jingquan huang c71677710d .. 6 years ago
jingquan huang e3af858ecc 本地导入线上 6 years ago
jingquan huang 593ee71e79 .. 6 years ago
杨树明 859e3e9a62 后台撤销授权功能优化 (前端) 6 years ago
huang 41a1795b32 Merge branch 'educoder' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into educoder 6 years ago
huang 41e0cf8950 .. 6 years ago
huang e6b3b6b535 本地到线上仓库同步 6 years ago
huang fe1b87f9d6 '..' 6 years ago
杨树明 c7cc754046 b 6 years ago
Alec Zhou 8b711ac57d Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
Alec Zhou 21043d1a6c 修复未绑定邮箱用户点击开始实战按钮页面无反应的bug 6 years ago
p31729568 1298e748f2 modify school statistic service to decrease response time 6 years ago
Alec Zhou face0cc8de Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
Alec Zhou 2f92f650d5 增加邮箱为空的判断 6 years ago
p31729568 0f6e2b0bf8 do not save useless school daily report data && clear school daily report useless data rake 6 years ago
daiao 27b59fa3cc 1 6 years ago
daiao 09c221b5b5 实训报告取分 6 years ago
jasder 2807c3f433 Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
jasder 70cb0254bf FIX bug 6 years ago
Alec Zhou 081eef9fb5 将注释的openi单点登录的代码重新加上 6 years ago
jingquan huang 54f51ff3f4 图像被串改问题 6 years ago
jingquan huang 2fc8833bef 图像修改添加权限 6 years ago
cxt 373685bf4c merge 6 years ago
daiao c64a1ed2c0 1 6 years ago
Alec Zhou 59e084ba48 Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
Alec Zhou 59b117376e 暂时注释openi相关代码 6 years ago
daiao ed26bedad7 Merge branch 'develop' into educoder 6 years ago
p31729568 922553af6e fix school data grow list error 6 years ago
p31729568 bfe8f6800f fix css display issue && fix export school report error 6 years ago
p31729568 cb1558b55d fix rubyzip gem version issue 6 years ago
p31729568 8348c95b57 modify school contrast data feature 6 years ago
Alec Zhou c76c43eb29 Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
Alec Zhou 451e06dcaa 后台创建openi关联用户时直接授权,并且修改了生成用户名的规则 6 years ago
cxt c28692ffc5 调整 6 years ago
cxt cb8b80efe9 gem 6 years ago
cxt 0560d0e2c5 Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
cxt 09abc5511f 编辑部门url 6 years ago
Alec Zhou 97c2b1f1f5 Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
Alec Zhou 90e7e056ec 修复重定向过多的bug 6 years ago
p31729568 6a08ec9a27 Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
p31729568 50d7ed2deb export school statistic data feature 6 years ago
daiao 5f8341dcf5 1 6 years ago
daiao 731d8532e4 1 6 years ago
daiao b49c1f5752 1 6 years ago
daiao f738ba4cc5 Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
cxt 14b2ce10da Merge branch 'educoder' into develop 6 years ago
cxt fdec1f663d 超级管理员的试用授权“已审批”增加学院统计 6 years ago
cxt 5002fd8a5c 搜索实训时过滤掉删除的实训 6 years ago
daiao 119877e702 Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
daiao 8cce3e27ba 隐藏和已经删除的实训,不能通过连接访问 6 years ago
p31729568 0817dc9e86 remove whenever gem 6 years ago
jingquan huang 14f83779a3 Merge branch 'educoder' of http://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into educoder 6 years ago
jingquan huang da8d83c8ef 导航问题 6 years ago
Alec Zhou 16d285d2fd Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
Alec Zhou b5eb7c1354 修改了before_filter的作用范围 6 years ago
daiao 9d48537c73 Merge branch 'educoder' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into educoder 6 years ago
daiao ef5095c070 1 6 years ago
杨树明 ff9a199f1f 配置js丢失 6 years ago
jingquan huang 7cee6ac4ce .. 6 years ago
daiao 1ce97f9ed9 Merge branch 'develop' into educoder 6 years ago
daiao 0c82824439 1 6 years ago
daiao a28509c2e8 Merge branch 'educoder' into develop 6 years ago
daiao a1344ff04d Merge branch 'educoder' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into educoder 6 years ago
daiao 2a030196b6 注册用户无法完善资料 6 years ago
jasder c7a3ef7732 ADD 超级管理员“已发布实训”列表的excel导出,增加实训链接 6 years ago
jingquan huang 2186fa33e2 update 6 years ago
jingquan huang 9bde4eaa94 更新提示 6 years ago
jasder 6129e17ddb Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
jasder 3cec847e3b ADD 学院统计页面的“课堂”根据进行状态进行排序(正在进行排前面) 6 years ago
jingquan huang 05284a3aba .. 6 years ago
jingquan huang 0efdd839e0 openi .. 6 years ago
jingquan huang 792fe7c71b 实训课程删除权限 6 years ago
jingquan huang a953ebd03b .. 6 years ago
jingquan huang cfdb4f95c2 定义一些管理员才能使用功能的权限 6 years ago
jingquan huang 4e0f674517 运营人员不提供用户删除权限 6 years ago
jingquan huang a715d33728 Merge branch 'develop' of http://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
jingquan huang a8d347bbe4 用户权限角色配置默认错误 6 years ago
p31729568 35ec3b1744 fix school data contrast percentage zero issue 6 years ago
Alec Zhou f259ea7078 Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
Alec Zhou 0cea78e89e 修改了获取referer的代码 6 years ago
hjm c1b3dfadd2 removeExceptGitDir 6 years ago
Alec Zhou d067d4dbed 将request.referer修改为request.original_url 6 years ago
Alec Zhou 0dd03710ae Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
p31729568 92451b9720 fix issue 6 years ago
Alec Zhou 58a278f583 增加日志 6 years ago
p31729568 26455d0efb add index to fix order slow issue 6 years ago
jingquan huang 1864620376 Merge branch 'develop' of http://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
Alec Zhou 256e6021f4 Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
Alec Zhou f103d0fe23 修改了请求来源的判断 6 years ago
jingquan huang 01017c3bd3 checkout box选择运营人员 6 years ago
jingquan huang fb1ba699cb .. 6 years ago
jingquan huang c349dd1621 .. 6 years ago
jingquan huang b68720ee38 运营人员 6 years ago
p31729568 2be42bebe5 remove order in school data contrast feature 6 years ago
jingquan huang eb12c7cdfb .. 6 years ago
Alec Zhou fb7233777f 修改日志类型debug->info 6 years ago
Alec Zhou 4801ba2917 添加日志信息以供调试 6 years ago
Alec Zhou 0486340146 Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
Alec Zhou 4ee0b2a865 修复了刷新实训相关页面出现500的bug 6 years ago
jingquan huang bffc6c363f Merge branch 'develop' of http://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
jingquan huang 5c6b6f4c95 添加运营定制功能 6 years ago
p31729568 88431ecd73 fix rebase 6 years ago
p31729568 01668fe3f8 school contrast data feature 6 years ago
jingquan huang ca8387e2e6 Merge branch 'educoder' into develop 6 years ago
jingquan huang 7104eee0c5 运营人员权限 6 years ago
Alec Zhou 95e1bc759c 完成了openi单点登录的功能 6 years ago
daiao e13cbaef60 Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
daiao c140b70818 合作伙伴改版 6 years ago
jingquan huang 2651225563 Merge branch 'educoder' of http://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into educoder 6 years ago
jingquan huang 085e1ec44d 首页的一些优化 6 years ago
p31729568 f37d02bcfb fix low ruby version support bug 6 years ago
p31729568 478a884301 Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
p31729568 f1b1ea0cd3 fix not support &. operation in low ruby version 6 years ago
hjm c9ed735139 removeExceptGitDir 6 years ago
p31729568 44dadbc173 fix ruby version not support ** operation 6 years ago
winse 372db525bd management school report feature 6 years ago
杨树明 3135f36cae Merge remote-tracking branch 'origin/educoder' into educoder 6 years ago
杨树明 0f2493e877 . 6 years ago
jingquan huang 978fbf47e5 个人主页的一些优化 6 years ago
杨树明 dddd208335 build 测试 6 years ago
杨树明 1832e91b4e build 测试 6 years ago
jingquan huang a71064b8e7 Merge branch 'educoder' of http://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into educoder 6 years ago
jingquan huang cdfda26c99 登录页面优化 6 years ago
cxt 06352bddb7 Merge branch 'develop' into educoder 6 years ago
jingquan huang f82c7b26f8 本地版优化 6 years ago
cxt a3230075ab 学生身份隐藏新建课堂入口 6 years ago
cxt 3e44fe368b 学生身份隐藏新建课堂入口 6 years ago
daiao a85debe484 Merge branch 'develop' into educoder 6 years ago
daiao 245c01a26b 1 6 years ago
daiao 2ff2151170 Merge branch 'develop' into educoder 6 years ago
daiao fc719acffc 1 6 years ago
daiao 84769b7e53 删除实例单位的示例2字 6 years ago
caishi 1533295d41 Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
caishi f976572985 系统升级提示页面时间修改 6 years ago
杨树明 22e5e7f60a Merge remote-tracking branch 'origin/develop' into develop 6 years ago
杨树明 597a66b764 【后台管理】新增需求(运营统计报表 对比报表 新增对比报表 (前端 6 years ago
caishi 882b6acd1f 培养目标页面列表行信息显示修改 6 years ago
cxt 52af31be38 超级管理员的导出调整 6 years ago
杨树明 9fe6c7322b Merge remote-tracking branch 'origin/develop' into develop 6 years ago
杨树明 33d4027a8c 客户项目列表页调整 6 years ago
cxt 22b549cf77 merge 6 years ago
daiao f8fd2488a1 1 6 years ago
hjm 0852ecfb40 $('.webSSHTimer').html(moment(this.timeRemain).format('mm:ss')) 6 years ago
hjm c3ed1bbf14 b 6 years ago
hjm df919fb6c2 重置主倒计时时长:20分钟 6 years ago
caishi 5f0bc1f7e2 Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
caishi b58480a637 账号审核提示框 6 years ago
cxt 23753d8977 Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
cxt efcac7da3d 作业设置的调整 6 years ago
huang 08d362731a Merge branch 'educoder' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into educoder 6 years ago
huang 83f0ec016b 测试用户问题 6 years ago
jingquan huang a3e3fa0965 .. 6 years ago
jingquan huang 98c5bcca6e local to shixun 6 years ago
jingquan huang 59ff646a4f 本地数据初始化 6 years ago
caishi ca9e721dfe Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
caishi 73e890aaf6 超级管理员-合作伙伴新增菜单操作选项 6 years ago
daiao 70c47a3c9b 1 6 years ago
daiao 413a15511d Merge branch 'educoder' into develop 6 years ago
daiao f6fc52b09d Merge branch 'educoder' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into educoder 6 years ago
daiao 49ef49a325 1 6 years ago
jingquan huang f6bbf74a52 Merge branch 'educoder' of http://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into educoder 6 years ago
jingquan huang 096b958386 线上版本数据导入到临时表,临时表转到线上版 6 years ago
daiao 20b1f3c533 Merge branch 'develop' into educoder 6 years ago
daiao 688c721bd3 1 6 years ago
cxt d0178f1a9f 加事务 6 years ago
caishi e836d333ea Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
caishi 23860440ff 评测设置保存后刷新页面 6 years ago
cxt 787acee2ea 滚动到顶部 6 years ago
cxt b9da38e82a 调整 6 years ago
杨树明 7ff20bbea2 新建入口调整 6 years ago
杨树明 edf1762ae2 新建入口调整 6 years ago
cxt 432fe28c54 在用户与超级管理员的私信窗口,增加发送问题页网址的文字说明 6 years ago
cxt 4eeb6f1fcc 平台的用户反馈增加“问题页面网址”输入入口,且必填 6 years ago
cxt e1fc755f49 调整 6 years ago
cxt deaf1c78d1 调整 6 years ago
cxt 63ac324477 Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
cxt 5e0b771412 调整 6 years ago
杨树明 ffdbf3c782 暂无数据显示新建入口 6 years ago
cxt d62ffc27ff “合作伙伴”的管理员用户在“客户管理”页面中增加最新课堂动态时间 6 years ago
cxt 44f7cebbed 调整 6 years ago
cxt 728c0f3ba1 Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
cxt 3f63a51499 个人主页的新建入口 6 years ago
杨树明 81eb573c03 最新课堂动态时间 根据测试要求调整滑动样式 6 years ago
cxt 5e0cea8e88 Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
cxt e7c04e8c58 实训课程的教学团队新增删除、上移、下移的功能 6 years ago
杨树明 685bc6cc93 Merge remote-tracking branch 'origin/develop' into develop 6 years ago
杨树明 6c599e362e 个人主页新增新建“课堂”、“实训”、“实训课程”、“项目”入口 6 years ago
daiao 9f67c4afb4 平台已经认证的老师可以直接查看测试集 6 years ago
杨树明 ff98ef9463 实训课程“教学团队”排序功能优化 6 years ago
daiao d53fa773dc Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
daiao 24084c303e 实训制作者排序变化 6 years ago
caishi 680c7e75cf Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
caishi fcfb91607a 滚动条颜色、登录默认为蓝色按钮 6 years ago
daiao 82bdae08d5 Merge branch 'educoder' into develop 6 years ago
daiao affb47f79e 1: 6 years ago
daiao 205bfd0799 Merge remote-tracking branch 'remotes/origin/develop' into educoder 6 years ago
daiao 35a99b2ef0 Merge branch 'develop' into educoder 6 years ago
cxt 4f9d818011 导出调整 6 years ago
cxt 431942d7a7 调整 6 years ago
cxt 3499ffd626 调整 6 years ago
daiao b92c4507b5 Merge branch 'educoder' into develop 6 years ago
jingquan huang ba49b555cb Merge branch 'educoder' of http://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into educoder 6 years ago
jingquan huang 8ffc0d51eb user 6 years ago
daiao 30af40165d 超级管理员用户列表导出报错 6 years ago
cxt 66a1a9027a 找回密码后端加验证 6 years ago
daiao 1780153ba2 Merge branch 'develop' into educoder 6 years ago
daiao bf19cc6920 已发布的实训运行创建者修改脚本 6 years ago
jingquan huang 210d138fb9 vnc 6 years ago
jingquan huang 99bb535bcc message 500 6 years ago
jingquan huang 4a6d84487a message 500 6 years ago
jingquan huang 7dcd1c1039 email 500 6 years ago
daiao ad84f98c37 1 6 years ago
daiao 4fb4e7dbc9 1 6 years ago
daiao 44adbf8e82 1 6 years ago
cxt 88b2ff8245 Merge branch 'develop' into educoder 6 years ago
cxt 94e3289746 调试 6 years ago
cxt 9f39908587 添加客户的过滤 6 years ago
cxt 18de726bff 调整 6 years ago
jingquan huang efca753994 管理员界面搜索500问题 6 years ago
cxt 1d25444159 滚动翻页 6 years ago
cxt 885ace98a9 搜索 6 years ago
cxt 4cfc9a6171 Merge branch 'dev_partners' into develop 6 years ago
cxt 062f117191 搜索 6 years ago
daiao 58b81b21db 1 6 years ago
caishi afc456c9a3 Merge branch 'dev_partners' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into dev_partners 6 years ago
daiao aa13f63e90 Merge branch 'dev_partners' into develop 6 years ago
caishi c332ea4b0f 清空搜索框内容 6 years ago
cxt 80cdbd6ad3 调整 6 years ago
cxt 2e3c438d79 去掉多余的客户管理 6 years ago
cxt c0ef3e0e1c Merge branch 'dev_partners' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into dev_partners 6 years ago
cxt 14be55dca8 权限调整 6 years ago
jasder 402eaa52da Merge branch 'dev_partners' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into dev_partners 6 years ago
jasder 9622698953 FIX 6 years ago
daiao 10ee52c22c 1 6 years ago
cxt c95a8c60fd 调整 6 years ago
daiao d02fec75db Merge branch 'dev_partners' into develop 6 years ago
cxt 096dd01b8a 删除客户 6 years ago
cxt 30a5b1a4e6 Merge branch 'dev_partners' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into dev_partners 6 years ago
cxt d1d28d2209 头像名称 6 years ago
daiao 72e8056d7b Merge branch 'dev_partners' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into dev_partners 6 years ago
daiao c18c99c7a7 超级管理员消息的实训反馈页面增加按照评论时间检索的功能 6 years ago
cxt 770538f16f Merge branch 'dev_partners' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into dev_partners 6 years ago
cxt 1b57593e99 完善 6 years ago
caishi d5c0a5a449 显示管理员名字 6 years ago
cxt ccede5b5a0 Merge branch 'dev_partners' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into dev_partners 6 years ago
cxt 13aa9f7df6 删除管理员 6 years ago
jasder 3b584094c2 Merge 6 years ago
jasder b7bbb77aaa FIX 过滤数据 6 years ago
cxt 0b76986075 merge 6 years ago
cxt 43117e7ca1 添加管理员 6 years ago
daiao c0df561a75 合作伙伴报500 6 years ago
daiao 29caae1c36 添加客户 6 years ago
daiao 611b059e6a Merge branch 'dev_partners' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into dev_partners 6 years ago
daiao 53e792918b 1 6 years ago
cxt c56a997403 添加合作单位的调整 6 years ago
cxt 638a3ba1a3 Merge branch 'dev_partners' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into dev_partners 6 years ago
cxt eece0a31ee 添加合作者 6 years ago
jasder 42eb7ae408 Merge branch 'dev_partners' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into dev_partners 6 years ago
jasder a7034cdbe5 ADD 6 years ago
daiao cf46589485 Merge branch 'dev_partners' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into dev_partners 6 years ago
daiao dc2a59cad9 1 6 years ago
cxt 1c1735a78d Merge branch 'dev_partners' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into dev_partners 6 years ago
cxt 3f60c7eae3 添加伙伴 6 years ago
jasder 3d408ac563 FIX merger 6 years ago
jasder 85d8355541 Merge branch 'dev_partners' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into dev_partners 6 years ago
jasder 9f417e17cd FIX UI 6 years ago
cxt f5746f0839 调整 6 years ago
daiao a01d30f142 删除的实训首页还能显示 6 years ago
cxt 3d347f7f15 rename 6 years ago
SylorHuang 744c021e1c partners 6 years ago
SylorHuang 8ffdad5447 partners 6 years ago
SylorHuang 45bdbab053 partners 6 years ago
caishi 0aec53dda7 添加管理员搜索条件修改 6 years ago
jasder 367b3a6197 FIX 6 years ago
jasder cd0d8d9a35 Merge branch 'dev_partners' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into dev_partners 6 years ago
SylorHuang b3621125d5 partners 6 years ago
jasder e154b3c7fe Merge 6 years ago
jasder 2c1bd03c46 ADD 6 years ago
SylorHuang 7af1176280 partners 6 years ago
SylorHuang 828ac000e0 合作伙伴添加 6 years ago
jasder 450876fd39 FIX 6 years ago
jasder 17687f999e Merge branch 'dev_partners' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into dev_partners 6 years ago
jasder 8ccfee1299 FIX 6 years ago
cxt 0e8b1d5ee8 客户列表调整 6 years ago
daiao adcefcd8da Merge branch 'develop' into educoder 6 years ago
cxt 260cc5b598 Merge branch 'dev_partners' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into dev_partners 6 years ago
cxt 946755f9e0 客户管理列表 6 years ago
jasder 57fb324875 Merge branch 'develop' into dev_partners 6 years ago
jasder ae3965d5ed Merge branch 'dev_partners' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into dev_partners 6 years ago
jasder 47e3f87308 ADD 添加关联表 6 years ago
cxt bec7b0eb36 Merge branch 'develop' into dev_partners 6 years ago
caishi 069fae6608 Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
caishi 41cb769fba 超级管理员的添加合作伙伴页面 6 years ago
cxt b66140bcfe 加入题库报错 6 years ago
cxt 904880044c Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
cxt 00dadf7531 客户列表 6 years ago
杨树明 7370b4ffb6 Merge remote-tracking branch 'origin/develop' into develop 6 years ago
杨树明 9618334cc7 用户列表页加头部导航入口 6 years ago
cxt b930943368 Merge branch 'develop' into dev_partners 6 years ago
cxt 700a964505 cooperate controller 6 years ago
jasder f068ce5a8e ADD 合作伙伴路由 6 years ago
hjm bd13ac1776 b 6 years ago
hjm 69104e4697 Merge branch 'educoder' into develop 6 years ago
hjm 800f91bf3f status -1 6 years ago
huang 24ff3a1aa6 测试集输出的一些调整 6 years ago
huang e7e304064b 实训测试集显示问题 6 years ago
huang a199ffa2cf Merge branch 'educoder' into develop 6 years ago
huang bea1dd618d 编译通过但是测试集显示问题 6 years ago
huang 69a0a5b72b 输出字符串问题 6 years ago
杨树明 30f7a4d2bd 隐藏学校 6 years ago
杨树明 21de026a99 Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into educoder 6 years ago
杨树明 86641c67b1 隐藏学校 6 years ago
huang 0306071ed0 .. 6 years ago
huang e6b786edc0 .. 6 years ago
huang 06f29e9109 500问题 6 years ago
huang b05308baf0 Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
huang cc061a04ea Merge branch 'educoder' into develop 6 years ago
huang e8a8df58ab Merge branch 'educoder' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into educoder 6 years ago
huang 3ac9d7a736 编译失败提醒 6 years ago
cxt fa667fe665 实训评分加事务 6 years ago
cxt f5e6b4c46a 工程认证的权限调整 6 years ago
daiao 8019bc3e0b Merge branch 'develop' into educoder 6 years ago
daiao 38eb71d7f2 实训tpi的版本库可以通过id查询 6 years ago
daiao 8950bafb18 删除实训 6 years ago
daiao ed87d56f6c 删除实训的访问问题 6 years ago
daiao 53bf69e4b4 Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
daiao f8611f90b6 迁移报错的实训 6 years ago
cxt 03c3729ea3 修改邮箱报500 6 years ago
cxt f7b95af92f 调试 6 years ago
cxt ee630954d5 调试 6 years ago
cxt 29001ced81 Merge branch 'develop' into educoder 6 years ago
cxt e621a54f06 实训课程中的实训被“隐藏”后,请悬浮显示“暂未公开” 6 years ago
cxt cfcfc9c580 迁移文件 6 years ago
daiao e46a10749b Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
daiao b7b1f35913 导出实训反馈编码格式修改 6 years ago
cxt 442277519b Merge branch 'develop' into educoder 6 years ago
hjm 3577297fed game_url 6 years ago
daiao 655c62defd 实训评论url 6 years ago
jingquan huang 5a3447b5cf conflict 6 years ago
daiao 6c8517812e 评论优化 6 years ago
daiao dcc20138dd Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
daiao 3ce5c0d7b5 评论关卡位置为空时,默认第一关 6 years ago
hjm 2a8adf3f01 Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
cxt a63e45c081 用户授权列表500 6 years ago
hjm f45822e01f 权限判段有问题 6 years ago
cxt 66597eb20b pdf导出500 6 years ago
cxt 5d8a0158ae pdf导出调整 6 years ago
cxt 523fb82aa1 调试 6 years ago
cxt e5589780c7 实训报告调试 6 years ago
cxt 7454064a9c 成绩导出调整 6 years ago
cxt 059db7002e Merge branch 'develop' into educoder 6 years ago
cxt 8ba0fe6b07 Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
cxt 59884af2f9 调整 6 years ago
daiao a71e82ae78 https://www.trustie.net/issues/18634 6 years ago
daiao 49cf70f38f 【生产环境】实训配置页的评测脚本选择后,无法清空,必须通过重新技术平台才行 6 years ago
cxt 4cd1f7c305 调整 6 years ago
cxt b4bbac6fae 调整 6 years ago
cxt 1192a3c93d 课堂成绩导出调整 6 years ago
daiao 8e4bb66272 添加报错时的信息 6 years ago
daiao 9890a97e34 Merge branch 'develop' into educoder 6 years ago
daiao 12cb81b3e8 解决冲突 6 years ago
daiao b733b016e4 Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
cxt ececf85977 Merge branch 'educoder' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into educoder 6 years ago
cxt f4c637a094 实训课程的审批翻页 6 years ago
cxt b14aaab5c9 主机数调整 6 years ago
cxt 1ddfe358eb Merge branch 'educoder' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into educoder 6 years ago
cxt 295f7a1c2b 单位的修改 6 years ago
daiao a5e64635e1 Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
daiao cd8a1d061d 第一次拉取代码 6 years ago
cxt 57ae21dca9 Merge branch 'develop' into educoder 6 years ago
caishi 08a4df9698 Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
caishi bd98acb24e 课堂讨论区未登录不显示发送菜单 6 years ago
cxt 3d0b8dd2e9 Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
cxt e7c8ca039f 讨论区的发送调整 6 years ago
huang a696886800 Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
huang 0115891dee 为登陆不显示fork 6 years ago
cxt 2b691900b3 未登录导航栏调整 6 years ago
cxt 23470d542b Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
cxt 536e7f834b Merge branch 'educoder' into develop 6 years ago
daiao 03ff875279 实训反馈导出excel 6 years ago
daiao 44bd6bfd8a Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
daiao cb212407fc 1 6 years ago
huang 3b4714af23 Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
huang f60d8611ed 实训权限控制 6 years ago
daiao e6b55a7943 1 6 years ago
huang e6cec18bc5 Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
daiao 8a00748222 Merge branch 'educoder' into develop 6 years ago
daiao 3d59d46ec0 Merge branch 'educoder' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into educoder 6 years ago
daiao 7d0d89d4e2 超级管理员的实训反馈页面,增加excel导出功能和实训名称检索功能 6 years ago
cxt acc33aec5b Merge branch 'develop' into educoder 6 years ago
cxt bc74d152a5 问卷bug 6 years ago
cxt 52f57aa607 Merge branch 'develop' into educoder 6 years ago
cxt d62f927baf 调整 6 years ago
cxt ee320c4c34 Merge branch 'develop' into educoder 6 years ago
cxt 31beeaaf67 调整 6 years ago
cxt 27a913882d 调整 6 years ago
cxt 0cce39ace2 调整 6 years ago
cxt c88142d360 Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
cxt 88972c60a6 实训认证 6 years ago
杨树明 3be76d137d 工程认证调整 userid 特殊情况取不到值 6 years ago
杨树明 94f4166f5a 工程认证调整 userid 特殊情况取不到值 6 years ago
杨树明 20a65571d8 工程认证调整 6 years ago
杨树明 3992b7f9ea 工程认证调整 6 years ago
daiao 0eab38faae 还原 6 years ago
daiao d8763cf284 1 6 years ago
daiao 40c19ae0d5 1 6 years ago
daiao dad2fb6b6f 1 6 years ago
daiao 7f4aaf880e 1 6 years ago
daiao 8466c147af 1 6 years ago
daiao d4d7f812a6 添加报错信息 6 years ago
cxt 8640200398 Merge branch 'develop' into educoder 6 years ago
cxt 5a4df7c442 调整 6 years ago
cxt 5bfebb53a5 调整 6 years ago
cxt 7f2a7ad73d Merge branch 'educoder' into develop 6 years ago
cxt 05ee4e2ea0 工程认证 6 years ago
杨树明 820c662542 工程认证调整 6 years ago
huang f70c1a49c3 移动云问题 6 years ago
huang ada4254039 ecloud控制器 6 years ago
huang 6137bcc770 实训权限的一些控制 6 years ago
cxt f9ca4795b7 Merge branch 'develop' into educoder 6 years ago
cxt 1de495dc92 调整 6 years ago
cxt f1b17212b4 调整 6 years ago
cxt e3a7e90805 Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
cxt 0c643a82b8 调整 6 years ago
hjm a344eab36d Merge branch 'dev_hjm' into develop 6 years ago
hjm f811f4a927 Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
cxt 2431993071 Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
cxt ebe9ee145b 实训报告的开启时间 6 years ago
guange 24393e8ad3 Merge branch 'develop' of http://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
guange a8fb707230 移动同步过来的手机号有相同的情况处理 6 years ago
cxt 99a47e1c8e 超级管理员的自动授权单位列表中,仅给”学生“自动授权 6 years ago
cxt 58dd8d207d 【管理员页面】排序时,未带搜索条件进行排序 6 years ago
cxt 999aba69f4 超级管理员的试用授权审批-已审批列表、以及用户列表增加筛选条件 6 years ago
cxt 1675c4e1c0 Merge branch 'educoder' into develop 6 years ago
cxt 1603c34128 Merge branch 'educoder' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into educoder 6 years ago
cxt 2c6e1ba868 实训报告的数据总表与分表的数据没有匹配 6 years ago
huang 95098fafd4 .. 6 years ago
huang a791f1bc53 .. 6 years ago
jingquan huang 57d634ce1f Merge branch 'develop' of http://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into educoder 6 years ago
jingquan huang 9fee0222ba ecloud auth 6 years ago
daiao 93ed95b767 冲突 6 years ago
daiao 8dc5a6b2df 评测代码运行中 6 years ago
daiao d1b676e479 评测开始清空之前的记录 6 years ago
daiao d1f536b191 增加日志信息 6 years ago
daiao 8b26219bee 字段值 6 years ago
hjm 27240407a0 正在评测中 6 years ago
daiao d8c389757f 评测修改 6 years ago
hjm 55af94ceb4 Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
daiao d50a44dad6 迁移报错 6 years ago
杨树明 51607ca394 Merge remote-tracking branch 'origin/educoder' into educoder 6 years ago
杨树明 1935369d3c Merge remote-tracking branch 'origin/develop' into develop 6 years ago
杨树明 de55a35708 banner图调整 6 years ago
daiao 0a772dd67b 评测中的信息 6 years ago
daiao de2db8ce32 学生评测数据 6 years ago
daiao 7b906e2348 Merge branch 'educoder' into dev_shixuns 6 years ago
daiao 0b587f7217 代码评测信息更新 6 years ago
jingquan huang a3b14f86ca Merge branch 'develop' of http://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into educoder 6 years ago
guange 1608ef1f6d Merge branch 'develop' of http://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
guange 8243b33634 正式环境参数 6 years ago
jingquan huang ef0ffc1295 Merge branch 'educoder' of http://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into educoder 6 years ago
cxt fdbdb4a585 Merge branch 'develop' into educoder 6 years ago
jingquan huang 914660ad9f 一些优化 6 years ago
hjm 6786b6ee10 Merge remote-tracking branch 'origin/develop' into dev_hjm 6 years ago
hjm b6a764f0c6 statusMessage 6 years ago
cxt 0202c719f0 调整 6 years ago
cxt 8bbb5a71e0 markdown上传的文件权限调整 6 years ago
cxt eee83bc0d6 Merge branch 'educoder' into develop 6 years ago
cxt 05a7034865 Merge branch 'educoder' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into educoder 6 years ago
cxt 4b23a9a2b5 非超级管理员无法正常显示实训课程详情页的图片 6 years ago
杨树明 d12217ebe4 Merge remote-tracking branch 'origin/educoder' into educoder 6 years ago
杨树明 1c1293a32c 替换图片 6 years ago
hjm 35f4dea04a 正在编译代码。。。 6 years ago
cxt 4ead5d1fd8 Merge branch 'educoder' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into educoder 6 years ago
cxt cb171061e6 调整 6 years ago
杨树明 4793005781 Merge remote-tracking branch 'origin/educoder' into educoder 6 years ago
杨树明 353d8a0354 Merge remote-tracking branch 'origin/develop' into develop 6 years ago
杨树明 818a7c48e2 替换图片 6 years ago
hjm 63d57d11bb response.data.message || 6 years ago
cxt 23fb2e4c23 调整 6 years ago
daiao 734c65ba50 Merge branch 'educoder' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into educoder 6 years ago
daiao a4795d1414 实训作业迁移问题 6 years ago
cxt 2e37871c14 Merge branch 'educoder' into develop 6 years ago
cxt e354dcfaf0 调整 6 years ago
huang 69ae7ea7ba .. 6 years ago
huang 3839e8be60 迁移问题 6 years ago
huang cf6aa09060 Merge branch 'educoder' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into educoder 6 years ago
huang 836542759c 企业用户如果创建了不重复创建 6 years ago
cxt ea6364960b 调整 6 years ago
杨树明 49f639247e 按钮调整 6 years ago
杨树明 a5504f63d9 Merge remote-tracking branch 'origin/develop' into develop 6 years ago
杨树明 6fd67e780e 实训路径 新建,修改选择搜索为空取消按钮没有问题 6 years ago
cxt 6cb82826aa 【注册】【需求】测试环境增加一个万能验证码方便测试 6 years ago
cxt 211aaa49fa 删除迁移文件 6 years ago
huang 493872bb5b Merge branch 'develop' into educoder 6 years ago
huang 0f83d8ff9e Merge branch 'educoder' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into educoder 6 years ago
cxt 013bf80478 迁移 6 years ago
daiao 95a8be8cf6 Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
daiao a2e81a3a70 测试集问题 6 years ago
cxt ef42f1ac69 调整 6 years ago
cxt 9d606f6349 调整 6 years ago
cxt 6040f8165d 迁移文件 6 years ago
cxt 6c8401ab04 调整 6 years ago
cxt 8ba070106d 调整迁移文件 6 years ago
cxt 483123297e Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
cxt 94d022938d 更改迁移文件 6 years ago
guange 9c1f33d60a Merge branch 'develop' of http://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
guange d627f3a0b9 Merge branch 'develop' of http://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
caishi b43b3ea574 Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
caishi 69c3952b0f 实训课程--课程须知MD编辑渲染失败 6 years ago
huang d077c78845 Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
huang b96c293184 check sign 6 years ago
hjm adc51604b7 b 6 years ago
hjm db2da93eed handleGdialogClose 6 years ago
cxt 7bba4ec39e 调整 6 years ago
cxt 2614f83283 Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
cxt b9a72287d1 未登录状态下的导航栏调整 6 years ago
huang e9fe238b02 500问题 6 years ago
cxt 0b7593c4ec Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
cxt cb4b71e5cd 进入子模块需要选中对应的导航 6 years ago
huang ed08c76021 Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
huang ae69f82d73 完成各种逻辑调试 6 years ago
daiao 29cff5349b 重新迁移实训作业 6 years ago
daiao fef35fceae Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
daiao 2a68ed0cb0 已发布的实训.增加测试集,已完成关卡的用户无法更新测试集内容 6 years ago
huang 29a0b03397 完成用户动态迁移 6 years ago
杨树明 1092e02271 未登录的时候头部导航错乱/点问题出现认证 6 years ago
huang 7158b0710a 用户业务动态变更 6 years ago
hjm b9c1236ef4 b 6 years ago
hjm 1b64f09ec9 resetTestSetsExpandedArray 6 years ago
hjm 3d86a711bc b 6 years ago
hjm 33058789b0 Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
daiao 2fdf5353c4 Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
daiao 2cc7d2a849 迁移学生实训作业的实训 6 years ago
hjm 5dedb3f80a 详情请参见“测试结果” 6 years ago
guange 69db176e48 merge 6 years ago
guange 0e7bd88d69 用户同步 6 years ago
huang 4cf4655b26 完成业务退订 6 years ago
huang e1558fbd07 业务状态变更 6 years ago
hjm ed321e58ef 去掉注释 6 years ago
daiao 0fc5fadcb9 Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
daiao 3a9866943e 实训测试集问题 6 years ago
huang 43c4b784ea 完成业务开通接口 6 years ago
cxt 213dc6a0af 用户评测时更新作业分数(为迁移数据做处理) 6 years ago
cxt 312403cfc3 实训作业迁移文件 6 years ago
huang 2e0c9faf47 重构业务新增 6 years ago
huang 8b62caf8a6 完成试用转商用接口调试 6 years ago
cxt 08accb32db Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
cxt 5766a1b0b1 实训作业删除的性能优化 6 years ago
huang 4c58e97d94 未完待续 6 years ago
huang 03b67d1b4d 数据库记录用户行为数据 6 years ago
huang dcec874401 Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
huang 2b28b60828 移动云企业业务开通重构 6 years ago
hjm 29b2a85e8d COURSE 6 years ago
hjm e09c93f93d DEVELOPMENT COMMUNITY 6 years ago
guange e04f29aa44 json 6 years ago
guange 7e35e1af0d json 6 years ago
guange 0a176e78ad Merge branch 'develop' of http://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
guange 5c0e656dd3 Merge branch 'develop' of http://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
guange 6f15d83b87 Merge branch 'develop' of http://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
huang 0e445b3209 Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
huang 0f4886906a ecloud授权和取消授权的一些修改 6 years ago
cxt b0386586c9 Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
cxt d52fec1f51 超级管理员的课堂列表导出时会有部分数据缺失 6 years ago
huang f1a3459a83 . 6 years ago
huang 7e6c250e7b Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
huang 5113d5cb36 ecloud_user添加status标记 6 years ago
caishi 33071e6cb4 Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
caishi 66b12ec493 实训报告页面-图形统计页 6 years ago
daiao 33e49c039b Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
daiao c267b69fea 迁移实训通关后没得分的记录 6 years ago
caishi 2627a5da13 Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
caishi fab470bc0a 实训报告页面 6 years ago
huang 7e168f42a6 测试 6 years ago
huang d6a20f1cae Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
huang e7298c7d6f ecloud 6 years ago
cxt f1e0510b3b Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
guange 618fc93c80 Merge branch 'develop' of http://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
guange 166332c936 . 6 years ago
huang 6121b985f0 ecloud一些修改 6 years ago
cxt 2f83f54915 Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
cxt de3c5e6d42 查看成绩,关卡耗时错误 6 years ago
杨树明 09f52a4a1b build 6 years ago
cxt 6411e81440 Merge branch 'educoder' into develop 6 years ago
cxt 9fa4ac729f Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
cxt 1f6da8629f Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
guange 456ec13058 Merge branch 'develop' of http://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
guange b7d2d9d189 remove index 6 years ago
cxt 7e3a4ea2b6 合并 6 years ago
cxt 519bee1851 调整 6 years ago
杨树明 7c36bbc0fa build 6 years ago
杨树明 815d64936c 认证权限调整 6 years ago
huang ed0bf1ce08 去掉权限 6 years ago
hjm 731cf53ce1 Merge branch 'develop' into educoder 6 years ago
hjm fd6195b9c8 b 6 years ago
hjm e69de3d59b 2.“课堂”→“翻转课堂” 6 years ago
杨树明 dcc04f5448 Merge branch 'develop' into educoder 6 years ago
杨树明 d03e256822 Merge remote-tracking branch 'origin/develop' into develop 6 years ago
杨树明 6808284192 build 6 years ago
cxt f925960655 调整 6 years ago
cxt 008a1412f1 Merge branch 'develop' into educoder 6 years ago
cxt e1e02682d7 隐藏学年的导出 6 years ago
cxt 84b16ed361 Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
cxt 1d71d9ddff 调整 6 years ago
杨树明 35b3872b51 Merge remote-tracking branch 'origin/develop' into develop 6 years ago
杨树明 9b37e699d0 build 6 years ago
cxt 02c008f696 Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
cxt febf6555a9 调整 6 years ago
杨树明 6ad7734813 Merge remote-tracking branch 'origin/develop' into develop 6 years ago
杨树明 7047360b63 build 6 years ago
cxt c595ef49b3 Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
cxt bbc2c6c387 权限调整 6 years ago
杨树明 5edaa19761 Merge remote-tracking branch 'origin/develop' into develop 6 years ago
杨树明 1193340214 build 6 years ago
cxt 8470090933 调整 6 years ago
cxt 28aca2571a Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
cxt f588b0d765 Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
huang e274be5924 sign验证 6 years ago
cxt e58d7693ec 调整 6 years ago
huang e816387170 Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
huang b72c93074a ecloud相关接口修正 6 years ago
杨树明 81c0906734 build 6 years ago
cxt d7b1e1986f Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
cxt 649e2a7ba6 调整 6 years ago
hjm f01796beb5 Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
hjm 915fb90ec8 .json 6 years ago
cxt 81ab00f482 Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
cxt e40adab480 调整 6 years ago
杨树明 e4caf5da9d build 6 years ago
cxt 5adf21dffc Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
cxt d892fc0640 Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
cxt a3c7087a48 调整 6 years ago
hjm 2fd2ffc777 _data 6 years ago
jingquan huang 5fee87148a Merge branch 'develop' of http://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
jingquan huang ec87aef778 认证 6 years ago
cxt 7970754e84 Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
cxt a9c5b791b5 调整 6 years ago
杨树明 f57f7813bb Merge remote-tracking branch 'origin/develop' into develop 6 years ago
杨树明 afe9158b0f 工程认证权限调整 6 years ago
jingquan huang d1925971f7 Merge branch 'develop' of http://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
jingquan huang 82a1a21993 签名认证 6 years ago
cxt 1fb0c4771a Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
cxt f9351e259d 调整 6 years ago
jingquan huang 91c95a7988 Merge branch 'develop' of http://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
jingquan huang 9f0e30676c ecloud认证 6 years ago
hjm d5a8f3a1dc Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
hjm 045ac6bff7 is_manager 6 years ago
daiao d97281b04d Merge branch 'educoder' into develop 6 years ago
daiao 7d6c48e86c 【认证】工程认证的界别复制,没有复制毕业要求 vs 培养目标和 毕业要求 vs 通用标准两个矩阵 6 years ago
cxt 4859ce7046 权限调整 6 years ago
cxt 2fcc555ada Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
hjm e58628b38b && is_manager 6 years ago
cxt a05f1f4739 访问权限的判断 6 years ago
cxt b1a79f27ca Merge branch 'educoder' into develop 6 years ago
daiao eb6f911df5 Merge branch 'educoder' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into educoder 6 years ago
hjm 6d92d7700a Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
daiao bcdbd5a74d 工程认证问题 6 years ago
hjm 916b27d3ca b 6 years ago
cxt 9aa9b2f6a5 Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
cxt 2f9860d05c 专业管理员无删除权限 6 years ago
hjm c75168a648 Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
hjm 6142022d74 is_manager 6 years ago
cxt a17d9f2126 Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
cxt d3fee9b877 Merge branch 'educoder' into develop 6 years ago
hjm 95a3f43ca3 this.props.showModal('提示', '您没权限编辑,请联系管理员。') 6 years ago
cxt eab8ccec8b 权限调整 6 years ago
hjm fc4bcca5de is_manager 6 years ago
hjm 59e369f442 Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
hjm c174191336 real_value_total 6 years ago
guange e5252fa87e 获取用户信息 6 years ago
guange 5a3e818836 Merge branch 'develop' of http://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
guange 8da79f8125 获取用户信息 6 years ago
hjm 280d1c8d24 b 6 years ago
hjm 2d4310c4f2 real_value_total != 0 6 years ago
guange 2cd1ce8171 Merge branch 'develop' of http://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
guange 325f5c9b15 获取用户信息 6 years ago
hjm 6885ce6cdf b 6 years ago
hjm 3b8750dd2b Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
hjm 537a3cbf2e total value 6 years ago
guange ddba3d844d 获取用户信息 6 years ago
jingquan huang dc578ec876 Merge branch 'develop' of http://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
guange 9fd268b7d8 Merge branch 'develop' of http://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
guange d2f8f13237 增加签名 6 years ago
jingquan huang 28949535d8 services添加相关字段 6 years ago
huang 4d5716ea97 Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
huang 19ece63edb 移动云联调相关 6 years ago
guange cfcd3fef14 Merge branch 'develop' of http://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
杨树明 3097a01b7b 工程认证 6 years ago
guange 9d349fe567 Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
guange defbbe1c84 ecloud oauth2认证 6 years ago
杨树明 71b3b1ce4a Merge branch 'educoder' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
cxt 97179ce628 Merge branch 'educoder' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into educoder 6 years ago
cxt afa8d8f1f3 调整 6 years ago
jingquan huang befe1381c5 Merge branch 'develop' of http://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
jingquan huang 8267a5645e 企业开通 6 years ago
daiao 4fa4e2d199 在接口里增加指示点内容 (后端增加参数) 6 years ago
cxt 3bd2a00768 重置myshixun时更新用户关联的作业 6 years ago
caishi ff0115675c Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
caishi 3957f5b94c 课程体系列表-评价结果显示错误 6 years ago
jingquan huang cb73a97425 接口调试 6 years ago
段甲生 36b0e3d97f Delete 6 years ago
jasder duan 354d51ce1a Merge 6 years ago
jasder duan 9ed8741829 FIX 解决冲突文件 6 years ago
jingquan huang 3afe376f94 ecloud表结构调整 6 years ago
jingquan huang a6445b85f1 .. 6 years ago
jingquan huang e3961027a3 delete 6 years ago
jingquan huang 6517ee418f .. 6 years ago
huang 784172afcb .. 6 years ago
huang a49e220b1c Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
huang 265a928109 ecloud相关表结构 6 years ago
daiao 4aadc998b9 允许跳关的实训参数调整 6 years ago
jasder duan c5150fd29b FIX bug 6 years ago
jasder duan 9a53cebc60 Update .gitignore 6 years ago
daiao 1d53060af9 工程认证相关任务 6 years ago
caishi 54061e6a7a 工程认证首页列表-专业列表的点击事件 6 years ago
hjm 9d245f3922 b 6 years ago
daiao cb4ecb8a0f 调试问题 6 years ago
hjm 5c2eb8b1d3 snackbarOpen 6 years ago
jingquan huang 528996f57d 业务开通接口 6 years ago
jingquan huang d58ddee8d3 ecloud params 6 years ago
jingquan huang 1ad16ed3f0 Merge branch 'develop' of http://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop 6 years ago
jingquan huang 9cf02eaf28 oauth test 6 years ago
huang 850ca0e010 http.rb 6 years ago
daiao b136a7a13d Merge branch 'educoder' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into educoder 6 years ago
daiao 582e8921db 通关却没有获得金币 6 years ago
jingquan huang c8e7166d02 Merge branch 'educoder' of http://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into educoder 6 years ago
jingquan huang 045b8f7655 单点登录初步 6 years ago
jingquan huang f59338005b Merge branch 'develop' of http://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into educoder 6 years ago
daiao fa1af83d6d 参考答案前端显示问题 6 years ago
daiao d26c4a62ba 通过却没有得到金币奖励 6 years ago
jingquan huang da14bbed6f 通关没加金币的问题 6 years ago
jingquan huang bdbb982cf1 金币 6 years ago
jingquan huang 6d944721a8 答案问题 6 years ago
jingquan huang 113981f593 Merge branch 'master' of http://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into educoder 6 years ago
jingquan huang a95dc01665 ecloud 6 years ago
cxt 4fe67139a0 Merge branch 'develop' into educoder 6 years ago

10
.gitignore vendored

@ -22,6 +22,7 @@
.DS_Store
public/api_doc/
/.metadata
.byebug_history
vendor/cache
/files
/public/images/avatars
@ -35,8 +36,11 @@ tmux*.log
config/wechat.yml
config/oneapm.yml
/public/react/build
/public/react/build/
/public/react/node_modules/
/public/react/public/react/build/static/js/*.map
/public/react-mobile/node_modules/
/public/react-mobile7/node_modules/
/public/react-gatsby/node_modules/
@ -45,4 +49,8 @@ config/oneapm.yml
/public/react-mobile7/build/.project
/public/npm-debug.log
/vendor
/workspace/*
/workspace/*
.ruby-gemset
.rvmrc

@ -1,4 +1,4 @@
source 'http://gems.ruby-china.com'
source 'https://gems.ruby-china.com'
unless RUBY_PLATFORM =~ /w32/
# unix-like only
@ -60,6 +60,12 @@ gem 'kaminari'
gem 'elasticsearch-model'
gem 'elasticsearch-rails'
gem 'oauth2'
# xlsx
#gem 'axlsx', '3.0.0.pre'
#gem 'axlsx_rails', '0.3.0'
#Ruby 2.2+ has removed test/unit from the core library.
if RUBY_VERSION>='2.2'
gem 'test-unit', '~> 3.0'

@ -9,8 +9,8 @@ module Mobile
desc "ecloud接口测试"
get 'list' do
EcloudService.new.list
post 'list' do
EcloudService.new.list(params)
end
end

@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/

@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/

@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/

@ -0,0 +1,3 @@
// Place all the styles related to the cooperates controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/

@ -0,0 +1,3 @@
// Place all the styles related to the ecloud controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/

@ -0,0 +1,3 @@
// Place all the styles related to the oauth controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/

@ -141,6 +141,7 @@ class AccountController < ApplicationController
@resubmit = "#{code}"
@agreement = Help.first
@cooperation = Cooperation.all
@url = params[:url]
@com_coop_img = CooImg.where(:img_type => 'com_coop').order("position asc")
@edu_coop_img = CooImg.where(:img_type => 'edu_coop').order("position asc")
@ -208,7 +209,7 @@ class AccountController < ApplicationController
end
def insert_suggest
content = "<p>[#{params[:question_kind]}]</p>" + params[:description]
content = "<p>[#{params[:question_kind]}]</p>" + "<p>问题页面网址:#{params[:url]}</p>" + params[:description]
PrivateMessage.create(:user_id => User.current.id, :target_id => 1, :sender_id => User.current.id, :receiver_id => 1, :content => content, :send_time => Time.now, :status => 1)
PrivateMessage.create(:user_id => 1, :target_id => User.current.id, :sender_id => User.current.id, :receiver_id => 1, :content => content, :send_time => Time.now, :status => 0)
redirect_to message_detail_user_path(User.current, :user_id => 1)
@ -436,7 +437,15 @@ class AccountController < ApplicationController
# 注册完/绑定邮箱 后完善资料
def user_info
@user = User.current
#是否是Oschina过来的
@is_ecoder_user = @user.ecoder_user_id.to_i>0
#是否没设置过密码
@is_set_password = @user.hashed_password.present?
if request.get?
# 如果是登录的请求进来,则需要判断登录名是否合法
if (@user.login =~ /(^(?=.*?[a-zA-Z]).*$)/).nil? || !(@user.login =~ /[@#\$%\^&\*\.]+/).nil?
@login_error = true
@ -454,6 +463,22 @@ class AccountController < ApplicationController
apply_user.update_all(:status => 2) unless apply_user.blank?
end
if @is_ecoder_user && !@is_set_password
@user.password = params[:new_password]
@user.password_confirmation = params[:new_password_confirmation]
if @user.password.size<8
@password_len_error = true
render :user_info and return
end
if @user.password != @user.password_confirmation
@password_match_error = true
render :user_info and return
end
end
@user.lastname = params[:lastname]
@user.firstname = ""
@user.show_realname = params[:hide_realname] ? 0 : 1
@ -525,6 +550,7 @@ class AccountController < ApplicationController
return
else
@user.login = lg
logger.info "save user: #{@user.errors}"
end
end
end
@ -652,12 +678,16 @@ class AccountController < ApplicationController
req = Hash.new(false)
req[:valid] = false
type = params[:type].to_i
if type == 1 || type == 2 || type == 4 || type == 6 || params[:phone] =~ /^1\d{10}$/
code = VerificationCode.where(:phone => params[:phone], :code => params[:code], :code_type => (params[:type].to_i != 1 && params[:type].to_i != 2 && params[:type].to_i != 4) ? 2 : params[:type].to_i ).last
if Redmine::Configuration['gitlab_address'].include?("test") && params[:code] == "134790"
req[:valid] = true
else
code = VerificationCode.where(:email => params[:phone], :code => params[:code], :code_type => params[:type].to_i).last
if type == 1 || type == 2 || type == 4 || type == 6 || params[:phone] =~ /^1\d{10}$/
code = VerificationCode.where(:phone => params[:phone], :code => params[:code], :code_type => (params[:type].to_i != 1 && params[:type].to_i != 2 && params[:type].to_i != 4) ? 2 : params[:type].to_i ).last
else
code = VerificationCode.where(:email => params[:phone], :code => params[:code], :code_type => params[:type].to_i).last
end
req[:valid] = !code.nil? && (Time.now.to_i - code.created_at.to_i) <= 10*60
end
req[:valid] = !code.nil? && (Time.now.to_i - code.created_at.to_i) <= 10*60
render :json => req
end
@ -862,7 +892,7 @@ class AccountController < ApplicationController
@user = User.current
@se = @user.extensions
# 已授权的用户修改单位名称,需要重新授权
if @se.school_id != params[:occupation].to_i && @user.certification == 1
if (@se.school_id != params[:occupation].to_i || @se.identity != params[:identity].to_i) && @user.certification == 1
@user.certification = 0
apply_user = ApplyAction.where(:user_id => @user.id, :container_type => "TrialAuthorization")
apply_user.update_all(:status => 2) unless apply_user.blank?
@ -1009,7 +1039,7 @@ class AccountController < ApplicationController
apply_action = ApplyAction.where(:user_id => User.current.id, :container_type => "TrialAuthorization", :status => 0).first
school_ids = School.where(:auto_users_trial => 1).map(&:id)
user_ex = User.current.user_extensions
if (user_ex.identity == 0 || (user_ex.identity == 1 && user_ex.student_id.present?)) && !user_ex.school.nil? && school_ids.include?(user_ex.school_id)
if user_ex.identity == 1 && user_ex.student_id.present? && !user_ex.school.nil? && school_ids.include?(user_ex.school_id)
User.current.update_attributes(:certification => 1)
logger.warn("apply_trail #######{User.current.login} ****#{User.current.user_extensions.school_id}")
@tip = "申请已提交我们将在1分钟内完成审核"
@ -1030,7 +1060,7 @@ class AccountController < ApplicationController
unless apply_action.present?
ApplyAction.create(:user_id => User.current.id, :status => 0, :ip_addr => request.remote_ip, :container_type => "TrialAuthorization", :apply_reason => params[:apply_reason])
begin
status = Trustie::Sms.send(mobile:18175896138, send_type:'user_apply_auth',name:'管理员' )
status = Trustie::Sms.send(mobile:17680641960, send_type:'user_apply_auth',name:'管理员' )
rescue => e
Rails.logger.error "发送验证码出错: #{e}"
end
@ -1103,7 +1133,7 @@ class AccountController < ApplicationController
reward_grade(@user, @user.id, 'Phone', 500)
else
@user.update_attributes!(:mail => params[:value])
Gitlab.client.edit_user_email(@user.gid, :email => @user.mail) if @user.gid
# Gitlab.client.edit_user_email(@user.gid, :email => @user.mail) if @user.gid
reward_grade(@user, @user.id, 'Mail', 500)
end
end
@ -1154,24 +1184,31 @@ class AccountController < ApplicationController
def reset_psd
if params[:lost_psd_phone] && params[:lost_psd_phone].strip != ""
@user = User.where("phone = '#{params[:lost_psd_phone].to_s}'").first
code = VerificationCode.where(:phone => params[:lost_psd_phone], :code => params[:code], :code_type => 2).last
elsif params[:lost_psd_email] && params[:lost_psd_email].strip != ""
@user = User.where("mail = '#{params[:lost_psd_email].to_s}'").first
code = VerificationCode.where(:email => params[:lost_psd_email], :code => params[:code], :code_type => 3).last
end
if @user.present?
@user.password, @user.password_confirmation = params[:new_password], params[:new_password_confirmation]
if @user.save
Token.where(:user_id => @user, :action => "recovery").destroy_all
respond_to do |format|
format.js
if !code.nil? && (Time.now.to_i - code.created_at.to_i) <= 10*60
if @user.present?
@user.password, @user.password_confirmation = params[:new_password], params[:new_password_confirmation]
if @user.save
Token.where(:user_id => @user, :action => "recovery").destroy_all
respond_to do |format|
format.js
end
else
redirect_to signin_path
return
end
else
redirect_to signin_path
return
end
else
redirect_to signin_path
return
@status = 0
end
end

@ -34,6 +34,7 @@ class ApplicationController < ActionController::Base
class_attribute :accept_rss_auth_actions
class_attribute :model_object
#before_filter :update_system
# skip_before_filter :verify_authenticity_token,
@ -65,6 +66,82 @@ class ApplicationController < ActionController::Base
include Redmine::MenuManager::MenuController
helper Redmine::MenuManager::MenuHelper
# 云启训练场EduCoder个人版 产品编码appId 9200108
# 产品名称 计费类型 套餐编码
# 云启训练场EduCoder个人版 固定包月 9200108001
# 固定包月 9200108002
# 固定包月 9200108003
# ---------------------------------------------------
# 产品名称 计费类型 套餐编码
# 云启训练场EduCoder院校版 包月+按license 9200109001
# 包月+按license 9200109002
# 云启训练场EduCoder院校版 产品编码appId 9200109
# 如果不是Ecloud过来的用户则不改变用户的使用状态及权限按现有模式即可
def ecloud_auth
euser = EcloudUser.where("userid =? and opttype not in(3, 5)", User.current.id).first
if euser.present? # 开通过业务
# 获取用户的套餐信息
e_services = euser.ecloud_services.where("opttype != 1").order("ecloud_services.code desc")
# 如果用户开通过服务
if e_services.present?
if e_services.count > 1 # 说明有重复开通过业务
# 开通多业务的话以最大的套餐排序如果最大套餐还可以用则直接返回true如果最大套餐不能用则轮询返回直到找到可用的套餐
e_services.each do |e_service|
# 使用期限内套餐才有效
ecloud_services_auth(e_service.code, e_service.begintime, e_service.endtime)
end
else
# 先看套餐,再看时间区间
e_service = e_services.first
ecloud_services_auth(e_service.code, e_service.begintime, e_service.endtime)
end
else
false # 没开通过服务,或者服务被禁用则不允许访问
end
end
end
# 根据业务确定权限
def ecloud_services_auth code, begintime, endtime
# 如果当前实训不在实训课堂等级体系中,则不允许访问
subject_id = @shixun.stage_shixuns.map(&:subject_id)
if subject_id.blank?
render_403
end
subject_level = Subject.find(subject_id).subject_level_system.try(:level)
# 当前时间转毫秒
current_time = DateTime.now.strftime('%Q').to_i
if current_time - begintime > 0 && endtime - current_time > 0
case code
when "9200108001"
subject_level.to_i == 1 ? true : false
when "9200108002"
subject_level.to_i == 2 ? true : false
when "9200108003"
subject_level.to_i == 3 ? true : false
when "9200109001" # 企业用户
subject_level.to_i < 3 ? true : false
when "9200109002" # 企业用户
subject_level.to_i <= 3 ? true : false
end
else
false
end
end
def ec_public_auth major_school
unless User.current.admin? || major_school.template_major || major_school.school.users.where(:id => User.current.id).count > 0 ||
major_school.ec_major_school_users.where(:user_id => User.current.id).count > 0 ||
EcCourseUser.where(:user_id => User.current.id, :ec_course_id => EcCourse.where(:ec_year_id => major_school.ec_years.pluck(:id)).pluck(:id)).count > 0
render_403
else
true
end
end
def user_agent
logger.info "HTTP_USER_AGENT #{request.env["HTTP_USER_AGENT"]}"
end
@ -274,6 +351,7 @@ class ApplicationController < ActionController::Base
true
end
def require_admin
return unless require_login
if !User.current.admin?
@ -283,6 +361,13 @@ class ApplicationController < ActionController::Base
true
end
# 运营人员
def require_business
unless (User.current.business? || User.current.admin?)
render_403
end
end
def deny_access
User.current.logged? ? render_403 : require_login
end
@ -1035,4 +1120,41 @@ class ApplicationController < ActionController::Base
end
true
end
def update_system
redirect_to "https://www.educoder.net/update.html" if Time.now > Time.new(2019, 4, 23) &&
Time.now < Time.new(2019, 4, 23, 2)
end
# 获取Oauth Client
def get_client(site)
client_id = Redmine::Configuration['client_id']
client_secret = Redmine::Configuration['client_secret']
OAuth2::Client.new(client_id, client_secret, site: site)
end
def handle_openi_request
site = Redmine::Configuration['openi_domain']
root_url = Redmine::Configuration['educoder_domain']
get_code_url = "/oauth/get_code"
original_url = request.original_url
client = get_client(site)
redirect_uri = "#{root_url}#{get_code_url}"
authorize_url = client.auth_code.authorize_url(redirect_uri: redirect_uri)
authorize_url = authorize_url + "&gen_code=true&state=1&original_url=#{original_url}"
redirect_to authorize_url
end
def user_login_and_from_openi?
url = request.referer.nil? ? Redmine::Configuration['educoder_domain'] : request.referer
flag = URI(url).host == URI(Redmine::Configuration['openi_domain']).host && !current_user.logged?
logger.info "----------------------- request referer: #{request.referer} -------------------------"
logger.info "----------------------- url after processed: #{url} -------------------------"
logger.info "----------------------- host: #{URI(url).host} --------------------------"
logger.info "----------------------- handle_flag: #{flag} -------------------------"
flag
end
end

@ -7,6 +7,11 @@ class AvatarController < ApplicationController
include ApplicationHelper
def upload
if params[:source_type] == "User" && !(User.current.admin? || User.current.id == params[:source_id].to_i)
render_403
return
end
# Make sure that API users get used to set this content type
# as it won't trigger Rails' automatic parsing of the request body for parameters
unless request.content_type == 'application/octet-stream'

@ -1,6 +1,8 @@
# encoding: utf-8
class ChallengesController < ApplicationController
layout "base_shixun"
# 如要添加或修改before_filter时请将handle_openi_request这个before_filter放至第一位
# before_filter :handle_openi_request, if: -> { user_login_and_from_openi? }, only: [:index]
before_filter :check_authentication, :except => [:index]
before_filter :find_shixun, :only => [:index, :new, :create, :destroy, :challenge_build, :update_evaluation, :add_choose_question, :new_choose_question,
:choose_type_show, :edit_choose_question, :update_choose_question, :destroy_challenge_choose]
@ -13,7 +15,7 @@ class ChallengesController < ApplicationController
skip_before_filter :verify_authenticity_token, :only => [:create_choose_question, :update_choose_question]
#before_filter :find_shixun_language, :only => [:show, :new, :edit]
before_filter :base_index, :only => [:index, :index_down, :index_up, :destroy]
before_filter :view_allow, :only => [:index, :show]
before_filter :view_allow, :only => [:show]
include ApplicationHelper
@ -465,7 +467,9 @@ class ChallengesController < ApplicationController
render_404
return
else
if (@shixun.status == 0 && !User.current.manager_of_shixun?(@shixun))
logger.info("operable: ##{@shixun.operable?}")
logger.info("@shixun.status: ##{@shixun.status}")
if (@shixun.status == 0 && !User.current.manager_of_shixun?(@shixun)) || (!@shixun.operable? && !User.current.admin?)
render_403
return
end

@ -31,9 +31,9 @@ class CollegesController < ApplicationController
end
def verification_school_identifier
school = School.where(:identifier => params[:identifier]).first
status = school.present? ? 1 : 0
render :json => {status: status}
schools = School.where(identifier: params[:identifier])
schools = schools.where('id != ?', params[:school_id]) if params[:school_id].present?
render :json => { status: schools.exists? ? 1 : 0 }
end
def online_school
@ -44,31 +44,31 @@ class CollegesController < ApplicationController
def statistics
logger.info("#########################{params}")
@teachers_count = User.find_by_sql("SELECT COUNT(users.`id`) AS teacher_count FROM users LEFT JOIN user_extensions ON users.id=user_extensions.user_id WHERE
user_extensions.`school_id` = #{@department.school_id} AND user_extensions.`identity` = 0").first.try(:teacher_count)
user_extensions.`school_id` = #{@school.id} AND user_extensions.`identity` = 0").first.try(:teacher_count)
@students_count = User.find_by_sql("SELECT COUNT(users.`id`) AS student_count FROM users LEFT JOIN user_extensions ON users.id=user_extensions.user_id WHERE
user_extensions.`school_id` = #{@department.school_id} AND user_extensions.`identity` = 1").first.try(:student_count)
user_extensions.`school_id` = #{@school.id} AND user_extensions.`identity` = 1").first.try(:student_count)
# Redo这样做内存会卡死的
# user_ids = User.find_by_sql("SELECT users.id FROM users LEFT JOIN user_extensions ON users.id=user_extensions.user_id WHERE user_extensions.`school_id` = #{@department.school_id}").map(&:id)
# user_ids = User.find_by_sql("SELECT users.id FROM users LEFT JOIN user_extensions ON users.id=user_extensions.user_id WHERE user_extensions.`school_id` = #{@school.id}").map(&:id)
# Redo是否直接使用count会更好
all_course_ids = Course.joins("join users u on courses.tea_id = u.id").joins("join user_extensions ue on u.id = ue.user_id").where("courses.id != 1309 and ue.school_id = #{@department.school_id}")
all_course_ids = Course.joins("join users u on courses.tea_id = u.id").joins("join user_extensions ue on u.id = ue.user_id").where("courses.id != 1309 and ue.school_id = #{@school.id}")
@courses_count = all_course_ids.size
# Redo对于量比较大的尽量不使用笛卡尔积
# @shixuns_count = Shixun.where(:status => [2, 3], :user_id => user_ids).size
@shixuns_count = Shixun.find_by_sql("select count(s.id) as shixun_count from users u right join shixuns s on u.id=s.user_id and s.status in (2, 3) inner join user_extensions ue on
u.id=ue.user_id and ue.school_id=#{@department.school_id}").first.try(:shixun_count)
u.id=ue.user_id and ue.school_id=#{@school.id}").first.try(:shixun_count)
# @shixun_time_sum = (Game.where(:user_id => user_ids).pluck(:cost_time).sum / (24*60*60.0)).ceil
@shixun_time_sum = (Game.find_by_sql("select sum(g.cost_time) cost_time from users u RIGHT join games g on u.id=g.user_id inner join user_extensions ue on
u.id=ue.user_id and ue.school_id=#{@department.school_id}").first.try(:cost_time).to_i / (24 * 60 * 60.0)).ceil
u.id=ue.user_id and ue.school_id=#{@school.id}").first.try(:cost_time).to_i / (24 * 60 * 60.0)).ceil
# select count(sw.id) from users u left join student_works sw on u.id=sw.user_id and sw.myshixun_id is not null and sw.work_status !=0 inner join user_extensions ue on u.id=ue.user_id and ue.school_id=117 ;
# @shixun_report_count = StudentWork.where("work_status != 0 and user_id in (#{user_ids.join(',').strip == "" ? -1 : user_ids.join(',')}) and myshixun_id is not null").count
@shixun_report_count = StudentWork.find_by_sql("SELECT count(*) as sw_count FROM `student_works` where user_id in (SELECT users.id FROM users RIGHT JOIN user_extensions ON users.id=user_extensions.user_id WHERE
user_extensions.`school_id`=#{@department.school_id}) and work_status between 1 and 2 and myshixun_id !=0").first.try(:sw_count)
user_extensions.`school_id`=#{@school.id}) and work_status between 1 and 2 and myshixun_id !=0").first.try(:sw_count)
@teachers = User.find_by_sql("SELECT users.id, users.login, users.lastname, users.firstname, users.nickname, IFNULL((SELECT count(shixuns.id) FROM shixuns where shixuns.user_id =users.id group by shixuns.user_id), 0) AS publish_shixun_count,
(SELECT count(c.id) FROM courses c, members m, member_roles mr WHERE m.course_id = c.id AND m.id=mr.member_id AND mr.role_id in (3,7,9) AND m.user_id=users.id AND c.is_delete = 0) as course_count
FROM `users`, user_extensions ue where users.id=ue.user_id and ue.identity=0 and ue.school_id=#{@department.school_id} ORDER BY publish_shixun_count desc, course_count desc, id desc LIMIT 10")
FROM `users`, user_extensions ue where users.id=ue.user_id and ue.identity=0 and ue.school_id=#{@school.id} ORDER BY publish_shixun_count desc, course_count desc, id desc LIMIT 10")
# ).order("publish_shixun_count desc, experience desc").limit(10)
@teachers =
@teachers.map do |teacher|
@ -97,9 +97,12 @@ class CollegesController < ApplicationController
shixun_ids = HomeworkCommonsShixuns.find_by_sql("SELECT hcs.shixun_id FROM homework_commons_shixuns hcs, homework_commons hc
WHERE hc.course_id in (#{all_course_ids.map(&:id).join(',').strip == "" ? -1 : all_course_ids.map(&:id).join(',')})
AND hcs.homework_common_id = hc.id").map(&:shixun_id)
shixun_tags = TagRepertoire.find_by_sql("SELECT tr.`name`, COUNT(str.shixun_id) as shixun_count FROM tag_repertoires tr, shixun_tag_repertoires str WHERE tr.id = str.tag_repertoire_id AND str.shixun_id IN (#{shixun_ids.join(',').strip == "" ? -1 : shixun_ids.join(',')}) GROUP BY tr.id order by shixun_count desc")
shixun_tags = TagRepertoire.find_by_sql("SELECT tr.`name`, COUNT(str.shixun_id) as shixun_count FROM tag_repertoires tr,
shixun_tag_repertoires str WHERE tr.id = str.tag_repertoire_id AND str.shixun_id
IN (#{shixun_ids.join(',').strip == "" ? -1 : shixun_ids.join(',')}) GROUP BY tr.id
order by shixun_count desc")
all_shixun_count = shixun_tags.map(&:shixun_count).sum
other_count = all_shixun_count - shixun_tags[0..8].map(&:shixun_count).sum
other_count = all_shixun_count.to_i - shixun_tags[0..8].map(&:shixun_count).sum.to_i
@shixun_tags_name = []
@shixun_tags_data = []
shixun_tags[0..8].each do |tag|
@ -128,7 +131,7 @@ class CollegesController < ApplicationController
(select count(m.id) from messages m inner join boards b on b.id=m.board_id and b.parent_id=0 where b.course_id=c.id group by c.id) as messages_count,
c.tea_id, c.name, c.is_end,
(SELECT MAX(created_at) FROM `course_activities` ca WHERE ca.course_id = c.id) AS update_time
FROM `courses` c WHERE (c.school_id = #{@department.school_id} and c.is_delete = 0)")
FROM `courses` c WHERE (c.school_id = #{@school.id} and c.is_delete = 0)")
@courses.each do |course|
course[:evaluating_count] = Output.find_by_sql("select sum(g.evaluate_count) as evaluating_count from games g inner join
@ -137,6 +140,7 @@ class CollegesController < ApplicationController
course[:task_count] = course.hcm_count.to_i + course.attachments_count.to_i + course.messages_count.to_i + course.hcm_nonshixun_count.to_i + course.exercises_count.to_i + course.polls_count.to_i
end
@courses = @courses.sort{|x,y| [y[:evaluating_count], y[:task_count]] <=> [x[:evaluating_count], x[:task_count]] }
@courses = @courses.sort_by { |course| course.is_end ? 1 : 0 }
# SELECT c.id, (select concat(firstname,lastname) from users u where u.id=c.tea_id) as username,
# (select count(sfc.id) from students_for_courses sfc where c.id=sfc.course_id group by c.id) as student_count,
@ -153,11 +157,11 @@ class CollegesController < ApplicationController
# 学生实训
def student_shixun
user_ids = User.find_by_sql("SELECT users.id FROM users, user_extensions WHERE users.id=user_extensions.user_id AND user_extensions.`school_id` = #{@department.school_id}").map(&:id)
user_ids = User.find_by_sql("SELECT users.id FROM users, user_extensions WHERE users.id=user_extensions.user_id AND user_extensions.`school_id` = #{@school.id}").map(&:id)
@students = User.find_by_sql("SELECT users.id, users.login, users.lastname, users.firstname, users.nickname, users.grade,
users.experience, ue.student_id, (SELECT COUNT(myshixuns.id) FROM `myshixuns` WHERE myshixuns.user_id
= users.id AND myshixuns.status = 1 GROUP BY users.id) AS myshixun_count FROM users join user_extensions ue on
users.id = ue.user_id where ue.school_id = #{@department.school_id} AND ue.identity = 1 AND `users`.`type` IN ('User', 'AnonymousUser') ORDER BY experience DESC, myshixun_count DESC LIMIT 10")
users.id = ue.user_id where ue.school_id = #{@school.id} AND ue.identity = 1 AND `users`.`type` IN ('User', 'AnonymousUser') ORDER BY experience DESC, myshixun_count DESC LIMIT 10")
## outputs基数过大用inner join有奇效
@shixun_tags = TagRepertoire.find_by_sql(%Q{
@ -168,7 +172,7 @@ class CollegesController < ApplicationController
AND str.shixun_id = myshixuns.`shixun_id`
AND myshixuns.id = games.`myshixun_id`
AND myshixuns.`user_id` IN (
SELECT users.id FROM users, user_extensions WHERE users.id=user_extensions.user_id AND user_extensions.`school_id` = #{@department.school_id}
SELECT users.id FROM users, user_extensions WHERE users.id=user_extensions.user_id AND user_extensions.`school_id` = #{@school.id}
)
) a on a.id = outputs.game_id and outputs.`test_set_position` = 1 group by trid
ORDER BY test_count DESC
@ -193,50 +197,50 @@ class CollegesController < ApplicationController
@eval_data = []
case @index
when "day"
same_count = Output.find_by_sql("select count(outputs.id) as count from outputs RIGHT JOIN (SELECT games.id FROM games RIGHT JOIN user_extensions ue ON games.`user_id` = ue.`user_id` AND ue.`school_id`=#{@department.school_id}) b
same_count = Output.find_by_sql("select count(outputs.id) as count from outputs RIGHT JOIN (SELECT games.id FROM games RIGHT JOIN user_extensions ue ON games.`user_id` = ue.`user_id` AND ue.`school_id`=#{@school.id}) b
ON outputs.`game_id` = b.id WHERE outputs.test_set_position = 1 AND outputs.created_at > '#{(end_day - 365.days).beginning_of_day}' AND outputs.created_at < '#{(end_day - 365.days).end_of_day}'").first.try(:count).to_i
last_count = Output.find_by_sql("select count(outputs.id) as count from outputs RIGHT JOIN (SELECT games.id FROM games RIGHT JOIN user_extensions ue ON games.`user_id` = ue.`user_id` AND ue.`school_id`=#{@department.school_id}) b
last_count = Output.find_by_sql("select count(outputs.id) as count from outputs RIGHT JOIN (SELECT games.id FROM games RIGHT JOIN user_extensions ue ON games.`user_id` = ue.`user_id` AND ue.`school_id`=#{@school.id}) b
ON outputs.`game_id` = b.id WHERE outputs.test_set_position = 1 AND outputs.created_at > '#{(end_day - 1.day).beginning_of_day}' AND outputs.created_at < '#{(end_day - 1.day).end_of_day}'").first.try(:count).to_i
@time_range = "#{end_day.strftime("%Y-%m-%d")}~#{end_day.strftime("%Y-%m-%d")}"
@time_data = ["2:00", "4:00", "6:00", "8:00", "10:00", "12:00", "14:00", "16:00", "18:00", "20:00", "22:00", "24:00"]
for i in 0..11
@eval_data << Output.find_by_sql("select count(outputs.id) as count from outputs RIGHT JOIN (SELECT games.id FROM games RIGHT JOIN user_extensions ue ON games.`user_id` = ue.`user_id` AND ue.`school_id`=#{@department.school_id}) b
@eval_data << Output.find_by_sql("select count(outputs.id) as count from outputs RIGHT JOIN (SELECT games.id FROM games RIGHT JOIN user_extensions ue ON games.`user_id` = ue.`user_id` AND ue.`school_id`=#{@school.id}) b
ON outputs.`game_id` = b.id WHERE outputs.test_set_position = 1 AND outputs.created_at > '#{end_day.beginning_of_day + (i * 2).hour}' AND outputs.created_at < '#{end_day.beginning_of_day + ((i + 1) * 2).hour}'").first.try(:count).to_i
end
when "week"
start_day = end_day - 6.days
same_count = Output.find_by_sql("select count(outputs.id) as count from outputs RIGHT JOIN (SELECT games.id FROM games RIGHT JOIN user_extensions ue ON games.`user_id` = ue.`user_id` AND ue.`school_id`=#{@department.school_id}) b
same_count = Output.find_by_sql("select count(outputs.id) as count from outputs RIGHT JOIN (SELECT games.id FROM games RIGHT JOIN user_extensions ue ON games.`user_id` = ue.`user_id` AND ue.`school_id`=#{@school.id}) b
ON outputs.`game_id` = b.id WHERE outputs.test_set_position = 1 AND outputs.created_at > '#{(start_day - 365.days).beginning_of_day}' AND outputs.created_at < '#{(end_day - 365.days).end_of_day}'").first.try(:count).to_i
last_count = Output.find_by_sql("select count(outputs.id) as count from outputs RIGHT JOIN (SELECT games.id FROM games RIGHT JOIN user_extensions ue ON games.`user_id` = ue.`user_id` AND ue.`school_id`=#{@department.school_id}) b
last_count = Output.find_by_sql("select count(outputs.id) as count from outputs RIGHT JOIN (SELECT games.id FROM games RIGHT JOIN user_extensions ue ON games.`user_id` = ue.`user_id` AND ue.`school_id`=#{@school.id}) b
ON outputs.`game_id` = b.id WHERE outputs.test_set_position = 1 AND outputs.created_at > '#{(start_day - 7.days).beginning_of_day}' AND outputs.created_at < '#{(end_day - 7.days).end_of_day}'").first.try(:count).to_i
@time_range = "#{start_day.strftime("%Y-%m-%d")}~#{end_day.strftime("%Y-%m-%d")}"
for i in 0..6
@time_data << (start_day + i.days).strftime("%m.%d")
@eval_data << Output.find_by_sql("select count(outputs.id) as count from outputs RIGHT JOIN (SELECT games.id FROM games RIGHT JOIN user_extensions ue ON games.`user_id` = ue.`user_id` AND ue.`school_id`=#{@department.school_id}) b
@eval_data << Output.find_by_sql("select count(outputs.id) as count from outputs RIGHT JOIN (SELECT games.id FROM games RIGHT JOIN user_extensions ue ON games.`user_id` = ue.`user_id` AND ue.`school_id`=#{@school.id}) b
ON outputs.`game_id` = b.id WHERE outputs.test_set_position = 1 AND outputs.created_at > '#{(start_day + i.days).beginning_of_day}' AND outputs.created_at < '#{(start_day + (i + 1).days).end_of_day}'").first.try(:count).to_i
end
when "mon"
start_day = end_day - 30.days
same_count = Output.find_by_sql("select count(outputs.id) as count from outputs RIGHT JOIN (SELECT games.id FROM games RIGHT JOIN user_extensions ue ON games.`user_id` = ue.`user_id` AND ue.`school_id`=#{@department.school_id}) b
same_count = Output.find_by_sql("select count(outputs.id) as count from outputs RIGHT JOIN (SELECT games.id FROM games RIGHT JOIN user_extensions ue ON games.`user_id` = ue.`user_id` AND ue.`school_id`=#{@school.id}) b
ON outputs.`game_id` = b.id WHERE outputs.test_set_position = 1 AND outputs.created_at > '#{(start_day - 365.days).beginning_of_day}' AND outputs.created_at < '#{(end_day - 365.days).end_of_day}'").first.try(:count).to_i
last_count = Output.find_by_sql("select count(outputs.id) as count from outputs RIGHT JOIN (SELECT games.id FROM games RIGHT JOIN user_extensions ue ON games.`user_id` = ue.`user_id` AND ue.`school_id`=#{@department.school_id}) b
last_count = Output.find_by_sql("select count(outputs.id) as count from outputs RIGHT JOIN (SELECT games.id FROM games RIGHT JOIN user_extensions ue ON games.`user_id` = ue.`user_id` AND ue.`school_id`=#{@school.id}) b
ON outputs.`game_id` = b.id WHERE outputs.test_set_position = 1 AND outputs.created_at > '#{(start_day - 30.days).beginning_of_day}' AND outputs.created_at < '#{(end_day - 30.days).end_of_day}'").first.try(:count).to_i
@time_range = "#{start_day.strftime("%Y-%m-%d")}~#{end_day.strftime("%Y-%m-%d")}"
for i in 0..9
@time_data << (start_day + (3 * i).days).strftime("%m.%d")
@eval_data << Output.find_by_sql("select count(outputs.id) as count from outputs RIGHT JOIN (SELECT games.id FROM games RIGHT JOIN user_extensions ue ON games.`user_id` = ue.`user_id` AND ue.`school_id`=#{@department.school_id}) b
@eval_data << Output.find_by_sql("select count(outputs.id) as count from outputs RIGHT JOIN (SELECT games.id FROM games RIGHT JOIN user_extensions ue ON games.`user_id` = ue.`user_id` AND ue.`school_id`=#{@school.id}) b
ON outputs.`game_id` = b.id WHERE outputs.test_set_position = 1 AND outputs.created_at > '#{(start_day + (3 * i).days).beginning_of_day}' AND outputs.created_at < '#{(start_day + (3 * (i + 1)).days).end_of_day}'").first.try(:count).to_i
end
when "year"
start_day = end_day - 365.days
same_count = Output.find_by_sql("select count(outputs.id) as count from outputs RIGHT JOIN (SELECT games.id FROM games RIGHT JOIN user_extensions ue ON games.`user_id` = ue.`user_id` AND ue.`school_id`=#{@department.school_id}) b
same_count = Output.find_by_sql("select count(outputs.id) as count from outputs RIGHT JOIN (SELECT games.id FROM games RIGHT JOIN user_extensions ue ON games.`user_id` = ue.`user_id` AND ue.`school_id`=#{@school.id}) b
ON outputs.`game_id` = b.id WHERE outputs.test_set_position = 1 AND outputs.created_at > '#{(start_day - 365.days).beginning_of_day}' AND outputs.created_at < '#{(end_day - 365.days).end_of_day}'").first.try(:count).to_i
last_count = same_count
@time_range = "#{start_day.strftime("%Y-%m-%d")}~#{end_day.strftime("%Y-%m-%d")}"
for i in 0..11
@time_data << (start_day + i.month).strftime("%m.%d")
@eval_data << Output.find_by_sql("select count(outputs.id) as count from outputs RIGHT JOIN (SELECT games.id FROM games RIGHT JOIN user_extensions ue ON games.`user_id` = ue.`user_id` AND ue.`school_id`=#{@department.school_id}) b
@eval_data << Output.find_by_sql("select count(outputs.id) as count from outputs RIGHT JOIN (SELECT games.id FROM games RIGHT JOIN user_extensions ue ON games.`user_id` = ue.`user_id` AND ue.`school_id`=#{@school.id}) b
ON outputs.`game_id` = b.id WHERE outputs.test_set_position = 1 AND outputs.created_at > '#{(start_day + i.days).beginning_of_day}' AND outputs.created_at < '#{(start_day + (i + 1).days).end_of_day}'").first.try(:count).to_i
end
end
@ -244,9 +248,9 @@ class CollegesController < ApplicationController
@same_rate = (@new_count == 0 || same_count == 0) ? 0 : (@new_count * 1.0 / same_count - 1).to_f
@last_rate = (@new_count == 0 || last_count == 0) ? 0 : (@new_count * 1.0 / last_count - 1).to_f
@total_count = Output.find_by_sql("select count(outputs.id) as count from outputs RIGHT JOIN (SELECT games.id FROM games RIGHT JOIN user_extensions ue ON games.`user_id` = ue.`user_id` AND ue.`school_id`=#{@department.school_id}) b
@total_count = Output.find_by_sql("select count(outputs.id) as count from outputs RIGHT JOIN (SELECT games.id FROM games RIGHT JOIN user_extensions ue ON games.`user_id` = ue.`user_id` AND ue.`school_id`=#{@school.id}) b
ON outputs.`game_id` = b.id WHERE outputs.test_set_position = 1 ").first.try(:count).to_i
@trend_count = Output.find_by_sql("select count(outputs.id) as count from outputs RIGHT JOIN (SELECT games.id FROM games RIGHT JOIN user_extensions ue ON games.`user_id` = ue.`user_id` AND ue.`school_id`=#{@department.school_id}) b
@trend_count = Output.find_by_sql("select count(outputs.id) as count from outputs RIGHT JOIN (SELECT games.id FROM games RIGHT JOIN user_extensions ue ON games.`user_id` = ue.`user_id` AND ue.`school_id`=#{@school.id}) b
ON outputs.`game_id` = b.id WHERE outputs.test_set_position = 1 AND outputs.created_at > '#{Time.now - 7.days}'").first.try(:count).to_i
end
@ -254,7 +258,10 @@ class CollegesController < ApplicationController
def manager_auth
# unless (User.current.admin? || DepartmentMember.where(:user_id => User.current.id, :department_id => @department.id).first.present?)
unless (User.current.admin? || DepartmentMember.where(:user_id => User.current.id, :department_id => @department.id).first.present? || (User.current.user_extensions.try(:school_id) == @department.school_id && User.current.user_extensions.try(:identity) == 0))
unless (User.current.admin? || User.current.business? ||
(@department.present? && DepartmentMember.where(:user_id => User.current.id, :department_id => @department.id).first.present?) ||
(User.current.user_extensions.try(:school_id) == @school.id && User.current.user_extensions.try(:identity) == 0) ||
(@school.try(:customer_id) && User.current.try(:partner).try(:customer_ids) && User.current.try(:partner).try(:customer_ids).include?(@school.try(:customer_id))))
render_403
end
end
@ -263,6 +270,8 @@ class CollegesController < ApplicationController
@department = Department.find_by_identifier(params[:id])
if @department.present?
@school = @department.school
else
@school = School.find_by_id(params[:id])
end
rescue ActiveRecord::RecordNotFound
render_404

@ -0,0 +1,36 @@
class CooperatesController < ApplicationController
before_filter :require_login
before_filter :find_partner, only: [:partner_list]
before_filter :is_admin, only: [:partner_list]
def partner_list
search = params[:search]
@schools = School.where(customer_id: @partner.customer_ids)
@all_count = @schools.size
unless search.blank?
@schools = @schools.where("name like ?", "%#{search}%")
end
@search_count = @schools.size
@schools = paginateHelper @schools, 15
@schools = @schools.includes(:courses, users: :user_extensions)
respond_to do |format|
format.js
format.html{render :layout => "base_edu"}
end
end
def find_partner
@partner = Partner.find_by_id(params[:id])
render_404 if @partner.nil?
rescue ActiveRecord::RecordNotFound
render_404
end
def is_admin
unless User.current.admin? || (User.current.partner.present? && User.current.partner == @partner)
render_403
end
end
end

@ -1190,9 +1190,16 @@ class CoursesController < ApplicationController
@all_members = searchmember_by_name(student_homework_score(0, 0, 10,"desc"), q)
end
@homeworks = @course.homework_commons.where("publish_time <= '#{Time.now}'").order("publish_time asc")
@exercises = @course.exercises.where("publish_time <= '#{Time.now}'").order("publish_time asc")
@tasks = @course.graduation_tasks.where("publish_time <= '#{Time.now}'").order("publish_time asc")
@homeworks = @course.homework_commons.where("publish_time <= '#{Time.now}'").order("publish_time asc, created_at asc")
@exercises = @course.exercises.where("publish_time <= '#{Time.now}'").order("publish_time asc, created_at asc")
@tasks = @course.graduation_tasks.where("publish_time <= '#{Time.now}'").order("publish_time asc, created_at asc")
@homeworks.where(:homework_type => 4).each do |homework|
items = homework.student_works.where("work_status != 0")
if items.count == 0 && homework.publish_time < Time.now && !@course.is_end
update_shixun_work_status homework
end
end
respond_to do |format|
format.xls {
@ -1474,14 +1481,14 @@ class CoursesController < ApplicationController
def new
if User.current.login?
@course_type = params[:course_type] ||= params[:course]
@issue_custom_fields = IssueCustomField.sorted.all
@trackers = Tracker.sorted.all
@course = Course.new
@course.safe_attributes = params[:course]
@syllabus = Syllabus.where("id = #{params[:syllabus_id].to_i}").first if params[:syllabus_id]
# month = Time.now.month
render :layout => 'base_edu'
if User.current.user_extensions.try(:identity) == 1
render_403
else
@course = Course.new
@course.safe_attributes = params[:course]
# month = Time.now.month
render :layout => 'base_edu'
end
else
redirect_to signin_url
end
@ -1628,7 +1635,7 @@ class CoursesController < ApplicationController
@course_modules = @course.course_modules.where(:hidden => 0)
course_module_type = @course_modules.map(&:module_type)
@is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin?
@is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin? || User.current.business?
if User.current.member_of_course?(@course) && !@is_teacher
member = @course.members.where(:user_id => User.current.id).first
if member.try(:course_group_id).to_i == 0
@ -2387,11 +2394,12 @@ class CoursesController < ApplicationController
sheet1[4,0] = "排名"
sheet1[4,1] = "学生姓名"
sheet1[4,2] = "昵称"
sheet1[4,3] = "学号"
sheet1[4,4] = "分班"
current_col = 4
for i in 0 ... homeworks.where(:homework_type => 4).count
sheet1[4,current_col+=1] = "实训作业第"+(i+1).to_s+""
sheet1[4,3] = "邮箱"
sheet1[4,4] = "学号"
sheet1[4,5] = "分班"
current_col = 5
homeworks.where(:homework_type => 4).each do |homework|
sheet1[4,current_col+=1] = "#{homework.name}"
end
for i in 0 ... homeworks.where(:homework_type => 1).count
sheet1[4,current_col+=1] = "普通作业第"+(i+1).to_s+""
@ -2421,67 +2429,68 @@ class CoursesController < ApplicationController
sheet1[count_row,column]= i+1
sheet1[count_row,column+=1] = member.user.show_real_name
sheet1[count_row,column+=1] = member.user.login
sheet1[count_row,column+=1] = member.user.mail
sheet1[count_row,column+=1] = member.user.user_extensions.student_id
sheet1[count_row,column+=1] = member.course_group_id == 0 ? "暂无" : member.course_group.name
# current_col = 5
shixun_score = 0
homeworks.where(:homework_type => 4).each do |homework|
homeworks.where(:homework_type => 4).includes(:student_works).each do |homework|
student_works = homework.student_works.where("user_id = #{member.user.id}")
if student_works.empty?
sheet1[count_row,column+=1] = 0
else
work_score = student_works.first.work_score.nil? ? 0 : student_works.first.work_score
sheet1[count_row,column+=1] = work_score < 0 ? 0 : work_score.round(2)
shixun_score += work_score < 0 ? 0 : work_score.round(2)
sheet1[count_row,column+=1] = work_score < 0 ? 0 : work_score.round(1)
shixun_score += work_score < 0 ? 0 : work_score.round(1)
end
# current_col += 1
end
common_score = 0
homeworks.where(:homework_type => 1).each do |homework|
homeworks.where(:homework_type => 1).includes(:student_works).each do |homework|
student_works = homework.student_works.where("user_id = #{member.user.id}")
if student_works.empty?
sheet1[count_row,column+=1] = 0
else
work_score = student_works.first.work_score.nil? ? 0 : student_works.first.work_score
sheet1[count_row,column+=1] = work_score < 0 ? 0 : work_score.round(2)
common_score += work_score < 0 ? 0 : work_score.round(2)
sheet1[count_row,column+=1] = work_score < 0 ? 0 : work_score.round(1)
common_score += work_score < 0 ? 0 : work_score.round(1)
end
# current_col += 1
end
group_score = 0
homeworks.where(:homework_type => 3).each do |homework|
homeworks.where(:homework_type => 3).includes(:student_works).each do |homework|
student_works = homework.student_works.where("user_id = #{member.user.id}")
if student_works.empty?
sheet1[count_row,column+=1] = 0
else
work_score = student_works.first.work_score.nil? ? 0 : student_works.first.work_score
sheet1[count_row,column+=1] = work_score < 0 ? 0 : work_score.round(2)
group_score += work_score < 0 ? 0 : work_score.round(2)
sheet1[count_row,column+=1] = work_score < 0 ? 0 : work_score.round(1)
group_score += work_score < 0 ? 0 : work_score.round(1)
end
# current_col += 1
end
exercise_score = 0
exercises.each do |exercise|
exercises.includes(:exercise_users).each do |exercise|
exercise_user = exercise.exercise_users.where("user_id = #{member.user.id}")
if exercise_user.empty?
sheet1[count_row,column+=1] = 0
else
work_score = exercise_user.first.score.nil? ? 0 : exercise_user.first.score
sheet1[count_row,column+=1] = work_score < 0 ? 0 : work_score.round(2)
exercise_score += work_score < 0 ? 0 : work_score.round(2)
sheet1[count_row,column+=1] = work_score < 0 ? 0 : work_score.round(1)
exercise_score += work_score < 0 ? 0 : work_score.round(1)
end
# current_col += 1
end
graduation_score = 0
tasks.each do |task|
tasks.includes(:graduation_works).each do |task|
graduation_works = task.graduation_works.where("user_id = #{member.user.id}")
if graduation_works.empty?
sheet1[count_row,column+=1] = 0
else
work_score = graduation_works.first.work_score.nil? ? 0 : graduation_works.first.work_score
sheet1[count_row,column+=1] = work_score < 0 ? 0 : work_score.round(2)
graduation_score += work_score < 0 ? 0 : work_score.round(2)
sheet1[count_row,column+=1] = work_score < 0 ? 0 : work_score.round(1)
graduation_score += work_score < 0 ? 0 : work_score.round(1)
end
# current_col += 1
end
@ -2494,7 +2503,7 @@ class CoursesController < ApplicationController
if tasks.count > 0
sheet1[count_row,column+=1] = graduation_score
end
sheet1[count_row,column+=1] = sum.round(2)
sheet1[count_row,column+=1] = sum.round(1)
count_row += 1
end
@ -2550,8 +2559,8 @@ class CoursesController < ApplicationController
count_row += 1
end
homeworks.where(:homework_type => 4).each_with_index do |home, i|
sheet = book.create_worksheet :name => "实训作业第#{i+1}"
homeworks.where(:homework_type => 4).includes(:student_works).each_with_index do |home, i|
sheet = book.create_worksheet :name => "#{home.name}"
sheet[0,0] = "课程编号"
sheet[0,1] = course.id
sheet[1,0] = "课程名称"
@ -2567,6 +2576,10 @@ class CoursesController < ApplicationController
sheet.row(4).concat([l(:excel_rank),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_homework_des),l(:excel_l_penalty),l(:excel_f_score),l(:excel_commit_time)])
count_row = 5
items = home.student_works.where("work_status != 0").order("work_score desc")
if items.count == 0 && home.publish_time < Time.now && !course.is_end
update_shixun_work_status home
items = StudentWork.where("work_status != 0 and homework_common_id = #{home.id}").order("work_score desc")
end
items.each_with_index do |stu, j|
sheet[count_row,0]= j + 1
sheet[count_row,1] = stu.user.show_real_name
@ -2574,13 +2587,13 @@ class CoursesController < ApplicationController
sheet[count_row,3] = stu.user.user_extensions.student_id
sheet[count_row,4] = strip_html stu.description
sheet[count_row,5] = stu.late_penalty
sheet[count_row,6] = stu.work_score.nil? ? l(:label_without_score) : stu.work_score.round(2)
sheet[count_row,6] = stu.work_score.nil? ? l(:label_without_score) : stu.work_score.round(1)
sheet[count_row,7] = format_time(stu.commit_time)
count_row += 1
end
end
homeworks.where(:homework_type => 1).each_with_index do |home, i|
homeworks.where(:homework_type => 1).includes(:student_works).each_with_index do |home, i|
sheet = book.create_worksheet :name => "普通作业第#{i+1}"
sheet[0,0] = "课程编号"
sheet[0,1] = course.id
@ -2609,17 +2622,17 @@ class CoursesController < ApplicationController
sheet[count_row,2] = stu.user.login
sheet[count_row,3] = stu.user.user_extensions.student_id
sheet[count_row,4] = strip_html stu.description
sheet[count_row,5] = stu.teacher_score.nil? ? l(:label_without_score) : stu.teacher_score.round(2)
sheet[count_row,6] = stu.teaching_asistant_score.nil? ? l(:label_without_score) : stu.teaching_asistant_score.round(2)
sheet[count_row,5] = stu.teacher_score.nil? ? l(:label_without_score) : stu.teacher_score.round(1)
sheet[count_row,6] = stu.teaching_asistant_score.nil? ? l(:label_without_score) : stu.teaching_asistant_score.round(1)
if home.anonymous_comment ==0
sheet[count_row,7] = stu.student_score.nil? ? l(:label_without_score) : stu.student_score.round(2)
sheet[count_row,7] = stu.student_score.nil? ? l(:label_without_score) : stu.student_score.round(1)
sheet[count_row,8] = (home.teacher_priority == 1 && !stu.teacher_score.nil?) ? 0 : stu.absence_penalty
sheet[count_row,9] = (home.teacher_priority == 1 && !stu.teacher_score.nil?) ? 0 : stu.late_penalty
sheet[count_row,10] = stu.work_score.nil? ? l(:label_without_score) : stu.work_score.round(2)
sheet[count_row,10] = stu.work_score.nil? ? l(:label_without_score) : stu.work_score.round(1)
sheet[count_row,11] = format_time(stu.commit_time)
else
sheet[count_row,7] = (home.teacher_priority == 1 && !stu.teacher_score.nil?) ? 0 : stu.late_penalty
sheet[count_row,8] = stu.work_score.nil? ? l(:label_without_score) : stu.work_score.round(2)
sheet[count_row,8] = stu.work_score.nil? ? l(:label_without_score) : stu.work_score.round(1)
sheet[count_row,9] = format_time(stu.commit_time)
end
count_row += 1
@ -2627,7 +2640,7 @@ class CoursesController < ApplicationController
end
homeworks.where(:homework_type => 3).each_with_index do |home, i|
homeworks.where(:homework_type => 3).includes(:student_works).each_with_index do |home, i|
sheet = book.create_worksheet :name => "分组作业第#{i+1}"
sheet[0,0] = "课程编号"
sheet[0,1] = course.id
@ -2658,17 +2671,17 @@ class CoursesController < ApplicationController
sheet[count_row,3] = stu.user.user_extensions.student_id
sheet[count_row,4] = get_group_member_names home.student_works.where(:group_id => stu.group_id).pluck(:user_id)
sheet[count_row,5] = strip_html stu.description
sheet[count_row,6] = stu.teacher_score.nil? ? l(:label_without_score) : stu.teacher_score.round(2)
sheet[count_row,7] = stu.teaching_asistant_score.nil? ? l(:label_without_score) : stu.teaching_asistant_score.round(2)
sheet[count_row,6] = stu.teacher_score.nil? ? l(:label_without_score) : stu.teacher_score.round(1)
sheet[count_row,7] = stu.teaching_asistant_score.nil? ? l(:label_without_score) : stu.teaching_asistant_score.round(1)
if home.anonymous_comment ==0
sheet[count_row,8] = stu.student_score.nil? ? l(:label_without_score) : stu.student_score.round(2)
sheet[count_row,8] = stu.student_score.nil? ? l(:label_without_score) : stu.student_score.round(1)
sheet[count_row,9] = (home.teacher_priority == 1 && !stu.teacher_score.nil?) ? 0 : stu.absence_penalty
sheet[count_row,10] = (home.teacher_priority == 1 && !stu.teacher_score.nil?) ? 0 : stu.late_penalty
sheet[count_row,11] = stu.work_score.nil? ? l(:label_without_score) : stu.work_score.round(2)
sheet[count_row,11] = stu.work_score.nil? ? l(:label_without_score) : stu.work_score.round(1)
sheet[count_row,12] = format_time(stu.commit_time)
else
sheet[count_row,8] = (home.teacher_priority == 1 && !stu.teacher_score.nil?) ? 0 : stu.late_penalty
sheet[count_row,9] = stu.work_score.nil? ? l(:label_without_score) : stu.work_score.round(2)
sheet[count_row,9] = stu.work_score.nil? ? l(:label_without_score) : stu.work_score.round(1)
sheet[count_row,10] = format_time(stu.commit_time)
end
count_row += 1
@ -2700,7 +2713,7 @@ class CoursesController < ApplicationController
sheet[count_row,3] = stu.user.user_extensions.student_id
sheet[count_row,4] = stu.objective_score == -1 ? "0.0" : format("%.1f",stu.objective_score)
sheet[count_row,5] = stu.subjective_score == -1 ? "0.0" : format("%.1f",stu.subjective_score)
sheet[count_row,6] = stu.score.nil? ? '--' : stu.score.round(2)
sheet[count_row,6] = stu.score.nil? ? '--' : stu.score.round(1)
sheet[count_row,7] = stu.commit_status == 0 ? l(:excel_no_answer) : format_time(stu.start_at)
count_row += 1
end
@ -2741,12 +2754,12 @@ class CoursesController < ApplicationController
sheet[count_row,column+=1] = get_group_member_names task.graduation_works.where(:group_id => stu.group_id).pluck(:user_id)
end
sheet[count_row,column+=1] = strip_html stu.description
sheet[count_row,column+=1] = stu.teacher_score.nil? ? l(:label_without_score) : stu.teacher_score.round(2)
sheet[count_row,column+=1] = stu.teacher_score.nil? ? l(:label_without_score) : stu.teacher_score.round(1)
if task.cross_comment
sheet[count_row,column+=1] = stu.cross_score.nil? ? l(:label_without_score) : stu.cross_score.round(2)
sheet[count_row,column+=1] = stu.cross_score.nil? ? l(:label_without_score) : stu.cross_score.round(1)
end
sheet[count_row,column+=1] = stu.late_penalty
sheet[count_row,column+=1] = stu.work_score.nil? ? l(:label_without_score) : stu.work_score.round(2)
sheet[count_row,column+=1] = stu.work_score.nil? ? l(:label_without_score) : stu.work_score.round(1)
sheet[count_row,column+=1] = format_time(stu.commit_time)
count_row += 1
end

@ -2,6 +2,7 @@
class EcCourseAchievementMethodsController < ApplicationController
before_filter :find_target, :only => [:edit_course_target, :create_evaluation_methods]
skip_before_filter :verify_authenticity_token, :only => [:create_evaluation_methods, :sync_course_data]
before_filter :find_ec_course, :only => [:index]
include ApplicationHelper
@ -59,11 +60,9 @@ class EcCourseAchievementMethodsController < ApplicationController
###############################################################
def index
achievement_list = []
# 具体工程课程
ec_course = EcCourse.find params[:ec_course_id]
# 课程的所有目标
targets = ec_course.ec_course_targets
targets = @ec_course.ec_course_targets
targets.each do |target|
evaluate_data = []
# 评价环节
@ -95,7 +94,7 @@ class EcCourseAchievementMethodsController < ApplicationController
end
achievement_list << {target_id: target.id, target_evaluate_data: evaluate_data}
end
render :json => {achievement_list: achievement_list}
render :json => {achievement_list: achievement_list, is_manager: @is_manager}
end
@ -306,4 +305,13 @@ class EcCourseAchievementMethodsController < ApplicationController
@target = EcCourseTarget.find params[:ec_course_target_id]
end
def find_ec_course
@ec_course = EcCourse.find(params[:ec_course_id])
@year = @ec_course.ec_year
@ec_major_school = @year.ec_major_school
@template_major = User.current.admin? || @ec_major_school.school.ec_school_users.pluck(:user_id).include?(User.current.id) ||
@ec_major_school.ec_major_school_users.pluck(:user_id).include?(User.current.id)
@is_manager = @template_major || @ec_course.ec_course_users.pluck(:user_id).include?(User.current.id)
end
end

@ -2,6 +2,8 @@
class EcCourseSupportsController < ApplicationController
before_filter :find_year, :except => [:edit_require_vs_course, :destroy_require_vs_course]
skip_before_filter :verify_authenticity_token, :only => [:create, :edit_require_vs_course, :destroy_require_vs_course]
before_filter :require_login
before_filter :ec_auth, :except => [:edit_require_vs_course, :destroy_require_vs_course]
###############################################################################
# 毕业要求vs课程体系
@ -47,6 +49,8 @@ class EcCourseSupportsController < ApplicationController
course_support_data = []
max_support_count = 0
subitems_count = 0
major_school = @year.ec_major_school
is_manager = User.current.admin? || major_school.school.ec_school_users.pluck(:user_id).include?(User.current.id) || major_school.ec_major_school_users.pluck(:user_id).include?(User.current.id)
ec_graduation_requirements.each_with_index do |gr, i|
logger.info("#############index:#{i}#####_ec_gradiation_reqiorements: #{gr.id}")
subitems_count += gr.ec_graduation_subitems.count
@ -60,7 +64,12 @@ class EcCourseSupportsController < ApplicationController
course_data << { name: name, top_relation: cs.top_relation, weigths: cs.weigths}
end
gs.ec_course_supports.count > max_support_count && max_support_count = gs.ec_course_supports.count
course_support_data << {sequence_num: sequence_num, ec_graduation_subitem_id: gs.id, course_data: course_data, num_total: gs.ec_course_supports.count, weights_total: weigths_sum}
course_support_data << {sequence_num: sequence_num,
sequence_title: gs.content,
ec_graduation_subitem_id: gs.id,
course_data: course_data,
num_total: gs.ec_course_supports.count,
weights_total: weigths_sum}
end
end
render :json => {ec_year_id: @year.id,
@ -69,7 +78,8 @@ class EcCourseSupportsController < ApplicationController
subitems_url: "#{graduation_requirement_ec_major_school_ec_year_path(@year, :ec_major_school_id => @year.ec_major_school_id)}",
course_count: @year.ec_courses.count,
course_url: "#{ec_course_setting_ec_major_school_ec_year_path(@year, :ec_major_school_id => @year.ec_major_school_id)}",
max_support_count: max_support_count}
max_support_count: max_support_count,
is_manager: is_manager}
end
# 毕业要求vs课程体系 详情页面
@ -208,4 +218,9 @@ class EcCourseSupportsController < ApplicationController
def find_year
@year = EcYear.find(params[:ec_year_id])
end
# 职业认证的权限判断
def ec_auth
ec_public_auth @year.ec_major_school
end
end

@ -1,8 +1,10 @@
#encoding: utf-8
class EcCoursesController < ApplicationController
layout 'base_ec'
before_filter :find_ec_course, :except => [:create, :get_calculation_data, :sync_all_course_data]
before_filter :find_ec_course, :except => [:create, :get_calculation_data, :sync_all_course_data, :search_courses]
before_filter :find_year, :only => [:create, :get_calculation_data]
before_filter :require_login, :except => [:search_courses, :correlation_course]
before_filter :ec_auth, :except => [:sync_all_course_data, :search_courses, :correlation_course]
skip_before_filter :verify_authenticity_token, :only => [:crud_targets, :crud_score_level, :sync_all_course_data, :search_courses,
:correlation_course, :delete_course]
@ -77,7 +79,8 @@ class EcCoursesController < ApplicationController
end
calculation_data << {first_level: first_level, first_leval_data: first_leval_data}
end
render :json => {calculation_data: calculation_data, calculation_value: @year.calculation_value, course_ids: course_ids.uniq}
render :json => {calculation_data: calculation_data, calculation_value: @year.calculation_value, course_ids: course_ids.uniq,
is_manager: @template_major}
end
# 课程目标配置
@ -100,6 +103,12 @@ class EcCoursesController < ApplicationController
end
end
def ec_course_support_setting_data
course_targets = @ec_course.ec_course_targets.includes(:ec_graduation_subitems)
json_data = target_list_data(course_targets)
render :json => json_data
end
# 课程目标配置的更新操作()
# /ec_courses/1/crud_targets
def crud_targets
@ -340,11 +349,11 @@ class EcCoursesController < ApplicationController
if user.try(:admin?)
courses = Course.where(:is_delete => 0)
else
course_ids = Member.where("user_id = #{params[:user_id]} and course_id != -1").pluck(:course_id)
course_ids = Member.where("user_id = #{user.try(:id)} and course_id != -1").pluck(:course_id)
courses = Course.where(:is_delete => 0, :id => course_ids)
end
if params[:search] && params[:search].strip != ""
courses = courses.where("name like '%#{params[:search].strip}%'").reorder("created_at desc")
courses = courses.where("name like ?", "%#{params[:search].strip}%").reorder("created_at desc")
else
courses = courses.reorder("created_at desc")
end
@ -414,6 +423,8 @@ class EcCoursesController < ApplicationController
def score_level
respond_to do |format|
format.html{
Rails.logger.info("1111111111111111111template_major: #{@template_major}")
Rails.logger.info("1111111111111111111is_manager: #{@is_manager}")
render "/common/index", :layout => false
}
format.json{
@ -429,11 +440,27 @@ class EcCoursesController < ApplicationController
{score: 70, level: ""},
{score: 60, level: ""}]
end
render :json => {levels: ls}
render :json => {levels: ls, is_manager: @is_manager}
}
end
end
def score_level_data
levels = @ec_course.ec_score_levels
ls = []
if levels.present?
levels.each do |l|
ls << {score: l.score, level: l.level}
end
else
ls = [{score: 90, level: ""},
{score: 80, level: ""},
{score: 70, level: ""},
{score: 60, level: ""}]
end
render :json => {levels: ls, is_manager: @is_manager}
end
def crud_score_level
levels = params[:levels]
render :json => {status: -1, message: "参数不能为空"} if levels.blank?
@ -574,6 +601,11 @@ class EcCoursesController < ApplicationController
#@is_manager = @template_major || @ec_course.ec_course_users.pluck(:user_id).include?(User.current.id)
end
# 职业认证的权限判断
def ec_auth
ec_public_auth @ec_major_school
end
def target_list_data course_targets
targets = []
course_targets.each do |ct|
@ -595,6 +627,10 @@ class EcCoursesController < ApplicationController
end
end
Rails.logger.info("111111111111111user_id: #{User.current.try(:id)}")
Rails.logger.info("template_major: #{@template_major}")
Rails.logger.info("is_manager: #{@is_manager}")
return {ec_year_id: @ec_course.ec_year_id, ec_course_id: @ec_course.id, course_targets: targets,
requirements: requirements, is_manager: @is_manager}
end
@ -630,7 +666,7 @@ class EcCoursesController < ApplicationController
# 遍历学生成绩统计数据
student_scores.each do |sc|
sub_ecss = EcCourseStudentScore.where(:ec_course_id => @ec_course.id, :ec_year_student_id => sc.ec_year_student_id).first
sub_score = base_score == 0 ? 0 : ((sc.try(:score).to_f/base_score) * percentage).round(3)
sub_score = base_score == 0 || sc.try(:score).nil? ? 0 : ((sc.try(:score).to_f/base_score) * percentage).round(3)
if sub_ecss
ess_target = sub_ecss.ec_student_score_targets.where(:ec_course_target_id => target.id,
@ -660,15 +696,16 @@ class EcCoursesController < ApplicationController
# 毕业要求指标点达成评价
total_rate = []
total_arry = EcCourseStudentScore.find_by_sql("SELECT avg(score) as averge_score, ec_target_position as position,
ect.weigths FROM ec_student_score_targets esst, ec_course_targets ect
where esst.ec_course_target_id=ect.id group by ec_course_target_id")
ect.weigths FROM ec_student_score_targets esst, ec_course_targets ect where
esst.ec_course_target_id=ect.id and ect.ec_course_id = #{course_id}
group by ec_course_target_id")
all_score = 0
total_arry.try(:each) do |ta|
total_rate << {:position => ta.position, :score => ta.averge_score.round(1), :rate => ta.weigths}
total_rate << {:position => ta.position, :score => ta.averge_score.round(2), :rate => ta.weigths}
logger.info("##############total_rate: #{total_rate.to_json}")
all_score += ta.averge_score * ta.weigths
end
total_rate << {:total_score => (all_score).round(1)}
total_rate << {:total_score => (all_score).round(2)}
ecg_targets = EcGraduationSubitemCourseTarget.where(:ec_course_target_id => @ec_course.ec_course_targets)
ecg_targets.chunk{|c| c.ec_graduation_subitem_id}.try(:each) do |key, egs_t|
@ -688,8 +725,12 @@ class EcCoursesController < ApplicationController
va = total_rate.select{|tra| tra[:position] == po}.first
reach_real_target += va[:score] * va[:rate] if va.present?
end
Rails.logger.info("######round11111111#{(target_total_rates == 0 ? 0 : (reach_real_target * weight)/(target_total_rates.round(3)*100))}")
reach_real_target = target_total_rates == 0 ? 0 : (reach_real_target * weight)/(target_total_rates*100)
Rails.logger.info("######round2222222#{reach_real_target}")
if ec_course_support.present?
logger.info("----------ec_course_support: #{ec_course_support.id}")
egrc = ec_course_support.ec_graduation_requirement_calculation

@ -2,7 +2,10 @@
class EcMajorSchoolsController < ApplicationController
layout "base_ec"
before_filter :require_login
before_filter :find_major_school, :except => [:get_navigation_data]
before_filter :ec_auth, :except => [:get_navigation_data]
def show
@years = @major_school.ec_years
@ -119,13 +122,15 @@ class EcMajorSchoolsController < ApplicationController
requirement_vs_objective_url: "#{requirement_vs_objective_ec_major_school_ec_year_path(@year, :ec_major_school_id => @year.ec_major_school_id)}",
requirement_vs_standard: "#{requirement_vs_standard_ec_major_school_ec_year_path(@year, :ec_major_school_id => @year.ec_major_school_id)}",
requirement_vs_courses: "#{requirement_vs_courses_ec_major_school_ec_year_path(@year, :ec_major_school_id => @year.ec_major_school_id)}",
students_url: student_lists_ec_major_schools_ec_years_path(@year, ec_major_school_id: @year.ec_major_school_id),
go_back_url: ec_major_school_path(major),
ec_course_support_setting_url: ec_course_support_setting_url,
ec_course_reach_setting_url: ec_course_reach_setting_url,
evaluation_methods_url: evaluation_methods_url,
competition_calculation_info_url: competition_calculation_info_url,
score_level_setting_url: score_level_setting_url,
example_major: example_major
example_major: example_major,
allow_visit: User.current.admin? || (User.current.ec_school.present? && User.current.ec_school == major.school.id)
}
end
@ -181,4 +186,9 @@ class EcMajorSchoolsController < ApplicationController
# 管理员权限
@major_manager = User.current.admin? || @major_school.school.ec_school_users.pluck(:user_id).include?(User.current.id) || @major_school.ec_major_school_users.pluck(:user_id).include?(User.current.id)
end
# 职业认证的权限判断
def ec_auth
ec_public_auth @major_school
end
end

@ -3,6 +3,9 @@ class EcYearsController < ApplicationController
layout "base_ec"
before_filter :find_major_and_year, except: [:create]
before_filter :require_login
before_filter :ec_auth, except: [:create]
#before_filter :find_year, only: [:set_calculation_value]
skip_before_filter :verify_authenticity_token, :only => [:import_students, :set_calculation_value, :destroy_students]
require 'simple_xlsx_reader'
@ -14,26 +17,17 @@ class EcYearsController < ApplicationController
# 添加年份
def create
@major_school = EcMajorSchool.find(params[:ec_major_school_id])
ec_years = @major_school.ec_years.pluck(:year)
exist_year = ec_years.include?(params[:year].to_i)
if exist_year
if @major_school.ec_years.exists?(year: params[:year].to_i)
@status = -1
else
prev_year = "#{params[:year].to_i - 1}"
prev_ec_year = @major_school.ec_years.where(:year => prev_year).first
if prev_ec_year.blank?
EcYear.create!(:year => params[:year], :ec_major_school_id => @major_school.id)
else
copy_year(prev_ec_year, params[:year])
end
service = CopyEcYearService.new(@major_school, params[:year].to_i)
service.call
@status = 1
end
@major_manager = User.current.admin? ||
@major_school.school.ec_school_users.pluck(:user_id).include?(User.current.id) ||
@major_school.ec_major_school_users.pluck(:user_id).include?(User.current.id)
@major_manager = true
@btn_text = @major_school.template_major && User.current.admin? ? "立即配置" :
(!@major_school.template_major && @major_manager ? "立即配置" : "查看")
@years = @major_school.ec_years
@years = EcYear.where(:ec_major_school_id => @major_school.id)
@years = paginateHelper @years, 10
respond_to do |format|
format.js
@ -54,37 +48,38 @@ class EcYearsController < ApplicationController
format.html {
render "/common/index", :layout => false
}
format.json {
template_file = EcTemplate.find_by_name "学生列表导入模板"
if template_file.present?
file = template_file.attachments.first
template_url = "/attachments/download/#{file.id}/#{file.filename}"
else
template_url = "javascript:void(0);"
end
end
end
students = @year.ec_year_students
show_name = @year.ec_year_students.where(:name => nil).count == 0
def student_lists_data
template_file = EcTemplate.find_by_name "学生列表导入模板"
if template_file.present?
file = template_file.attachments.first
template_url = "/attachments/download/#{file.id}/#{file.filename}"
else
template_url = "javascript:void(0);"
end
page = params[:page] || 1
total_student = students.count
total_page = (total_student / 50.0).ceil
students = paginateHelper students, 50
students = @year.ec_year_students
show_name = @year.ec_year_students.where(:name => nil).count == 0
ec_students = []
students.each_with_index do |student, index|
student = {index: (50*(page.to_i - 1) + index + 1),
student_name: student.name,
student_id: student.student_id}
ec_students << student
end
page = params[:page] || 1
total_student = students.count
total_page = (total_student / 50.0).ceil
students = paginateHelper students, 50
import_url = "/ec_major_schools/#{@ec_major_school.id}/academic_years/#{@year.id}/import_students"
render :json => {template_url: template_url, ec_students: ec_students, total_page: total_page, import_url: import_url,
show_name: show_name, :total_student => total_student}
}
ec_students = []
students.each_with_index do |student, index|
student = {index: (50*(page.to_i - 1) + index + 1),
student_name: student.name,
student_id: student.student_id}
ec_students << student
end
import_url = "/ec_major_schools/#{@ec_major_school.id}/academic_years/#{@year.id}/import_students"
render :json => {template_url: template_url, ec_students: ec_students, total_page: total_page, import_url: import_url,
show_name: show_name, :total_student => total_student, :is_manager => @template_major}
end
# DELETE: /ec_major_schools/:major_id/academic_years/:year_id/destroy_students
@ -244,7 +239,7 @@ class EcYearsController < ApplicationController
template_file = EcTemplate.find_by_name "课程列表导入模板"
if template_file.present?
file = template_file.attachments.first
@file_url = "/attachments/download/#{file.id}/#{file.filename}"
@file_url = '' #"/attachments/download/#{file.id}/#{file.filename}"
else
@file_url = "javascript:void(0);"
end
@ -346,212 +341,13 @@ class EcYearsController < ApplicationController
@template_major = User.current.admin? || @ec_major_school.school.ec_school_users.pluck(:user_id).include?(User.current.id) || @ec_major_school.ec_major_school_users.pluck(:user_id).include?(User.current.id)
end
def find_year
@year = EcYear.find(params[:id])
# 职业认证的权限判断
def ec_auth
ec_public_auth @ec_major_school
end
# 复制最新一届下的所有数据. previous_ec_year: 本专业最新一届, new_year: 新建的届别
def copy_year previous_ec_year, new_year
ActiveRecord::Base.transaction do
begin
# 如果是第一次创建届别,则直接创建
if previous_ec_year.blank?
raise("没有界别可以复制")
else
logger.info("############previous_ec_year: #{previous_ec_year.id}")
# 多个中间表需要替换的id
egs_record = [] # 记录ec_graduation_subitems的新旧值 例如: [[prev_egs, new_egs], [...]]
egr_record = [] # 记录ec_graduation_requirements的新旧值, 例如: [[prev_egr, new_egr], [...]]
ec_record = [] # 记录ec_courses
ece_record = [] # 记录ec_course_evaluations
eces_record= [] # 记录ec_course_evaluation_subitems
ect_record = [] # 记录ec_course_targets
# 复制 "届别"
ec_year = EcYear.create!(:year => new_year,
:ec_major_school_id => previous_ec_year.ec_major_school_id,
:calculation_value => previous_ec_year.calculation_value)
# 复制 "毕业要求"
previous_ec_year.ec_graduation_requirements.try(:each) do |pre_egr|
new_egr = EcGraduationRequirement.new
new_egr.attributes = pre_egr.attributes.dup.except("id", "ec_year_id")
new_egr.ec_year_id = ec_year.id
new_egr.save!
egr_record << [pre_egr.id, new_egr.id]
# 复制 "毕业要求子标点"
pre_egr.ec_graduation_subitems.try(:each) do |pre_egs|
new_egs = EcGraduationSubitem.new
new_egs.attributes = pre_egs.attributes.dup.except("id", "ec_graduation_requirement_id")
new_egs.ec_graduation_requirement_id = new_egr.id
new_egs.save!
# 记录新旧对应关系,为之后的中间表做记录
egs_record << [pre_egs.id, new_egs.id]
end
end
# 复制 "培养目标"
pre_eto = previous_ec_year.ec_training_objective
if pre_eto.present?
new_eto = EcTrainingObjective.new
new_eto.attributes = pre_eto.attributes.dup.except("id", "ec_year_id")
new_eto.ec_year_id = ec_year.id
new_eto.save!
# 复制 "培养目标分项"
pre_eto.ec_training_subitems.try(:each) do |pre_ets|
new_ets = EcTrainingSubitem.new
new_ets.attributes = pre_ets.attributes.dup.except("id", "ec_training_objective_id")
new_ets.ec_training_objective_id = new_eto.id
new_ets.save!
end
end
# 复制 "课程体系"
previous_ec_year.ec_courses.try(:each) do |pre_ec|
new_ec = EcCourse.create!(name: pre_ec.name, ec_year_id: ec_year.id)
ec_record << [pre_ec.id, new_ec.id]
# 复制 "课程考核标准"
pre_ec.ec_course_evaluations.try(:each) do |pre_ece|
new_ece = EcCourseEvaluation.create!(name: pre_ece.name,
evluation_count: pre_ece.evluation_count,
ec_course_id: new_ec.id,
is_course_type: pre_ece.is_course_type)
ece_record << [pre_ece.id, new_ece.id]
# 复制 "考核分项"
pre_ece.ec_course_evaluation_subitems.try(:each) do |pre_eces|
new_eces = EcCourseEvaluationSubitem.create!(name: pre_eces.name, ec_course_evaluation_id: new_ece.id)
# 记录新旧对应关系,为之后的中间表做记录
eces_record << [pre_eces.id, new_eces.id]
end
end
# 复制 "课程目标"
pre_ec.ec_course_targets.try(:each) do |pre_ect|
new_ect = EcCourseTarget.new
new_ect.attributes = pre_ect.attributes.dup.except("id", "ec_course_id")
new_ect.ec_course_id = new_ec.id
new_ect.save!
# 记录新旧对应关系,为之后的中间表做记录
ect_record << [pre_ect.id, new_ect.id]
# 复制 "课程目标和毕业要求指标点"
pre_ect.ec_graduation_subitem_course_targets.try(:each) do |pre_egsct|
new_egsct = EcGraduationSubitemCourseTarget.new
new_egsct.attributes = pre_egsct.attributes.dup.except("id", "ec_graduation_subitem_id", "ec_course_target_id")
# 寻找对应的new_egs_id
logger.info("############egs_record:#{egs_record}")
logger.info("############ec_graduation_subitem_id: #{pre_egsct.ec_graduation_subitem_id}")
new_egs_id = -1
egs_record.each do |id|
if id[0] == pre_egsct.ec_graduation_subitem_id
new_egs_id = id[1]
end
end
raise("课程目标和毕业要求指标点找不到对应关系.") if new_egs_id == -1
new_egsct.ec_graduation_subitem_id = new_egs_id
new_egsct.ec_course_target_id = new_ect.id
new_egsct.save!
end
# 复制 "课程达成方法"
pre_ect.ec_course_achievement_methods.each do |pre_ecam|
# 寻找对应的 ec_course_id
new_ec_id = -1
new_ece_id = -1
new_eces_id = -1
ec_record.each do |ec_id|
if ec_id[0] == pre_ecam.ec_course_id
new_ec_id = ec_id[1]
end
end
# 寻找对应的ec_course_evaluation_id
ece_record.each do |ece_id|
if ece_id[0] == pre_ecam.ec_course_evaluation_id
new_ece_id = ece_id[1]
end
end
# 寻找对应的ec_course_evaluation_subitem_id
eces_record.each do |eces_id|
if eces_id[0] == pre_ecam.ec_course_evaluation_subitem_id
new_eces_id = eces_id[1]
end
end
new_ecam = EcCourseAchievementMethod.new
new_ecam.attributes = pre_ecam.attributes.dup.except("id", "ec_course_id", "ec_course_evaluation_id",
"ec_course_evaluation_subitem_id", "ec_course_target_id")
new_ecam.ec_course_id = new_ec_id if new_ec_id != -1
new_ecam.ec_course_evaluation_id = new_ece_id if new_ece_id != -1
new_ecam.ec_course_evaluation_subitem_id = new_eces_id if new_eces_id != -1
new_ecam.ec_course_target_id = new_ect.id
new_ecam.save!
# 复制 "课程评价达成关系"
pre_ecam.ec_achievement_evaluation_relates.each do |pre_eaer|
new_eaer = EcAchievementEvaluationRelate.new
new_eaer.attributes = pre_eaer.attributes.dup.except("id", "ec_course_achievement_method_id",
"ec_course_evaluation_subitem_id", "ec_course_target_id")
new_eaer.ec_course_achievement_method_id = new_ecam.id
# 寻找对应的 ec_course_evaluation_subitem_id
new_eces_id = -1
eces_record.each do |eces_id|
if eces_id[0] == pre_eaer.ec_course_evaluation_subitem_id
new_eces_id = eces_id[1]
end
end
new_eaer.ec_course_evaluation_subitem_id = new_eces_id if new_eces_id != -1
# 寻找对应的 ec_course_target_id
new_ect_id = -1
ect_record.each do |ect_id|
if ect_id[0] == pre_eaer.ec_course_target_id
new_ect_id = ect_id[1]
end
end
new_eaer.ec_course_target_id = new_ect_id if new_ect_id != -1
new_eaer.save!
end
end
end
# 复制 "课程支撑"
pre_ec.ec_course_supports.try(:each) do |pre_ecs|
new_ecs = EcCourseSupport.new
new_ecs.attributes = pre_ecs.attributes.dup.except("id", "ec_course_id")
new_ecs.ec_course_id = new_ec.id
new_ecs.save!
# 复制 "课程vs毕业要求"
pre_ecs.ec_graduation_subitem_courses.try(:each) do |pre_egsc|
new_egs_id = -1
egs_record.each do |egs_id|
if egs_id[0] == pre_egsc.ec_graduation_subitem_id
new_egs_id = egs_id[1]
end
end
new_egsc = EcGraduationSubitemCourse.new
new_egsc.attributes = pre_egsc.attributes.dup.except("id", "ec_graduation_subitem_id", "ec_course_support_id")
raise("找不到课程vs毕业要求的关联关系!") if new_egs_id == -1
new_egsc.ec_graduation_subitem_id = new_egs_id
new_egsc.ec_course_support_id = new_ecs.id
new_egsc.save!
end
end
# 复制 "成绩等级设置"
pre_ec.ec_score_levels.try(:each) do |pre_esl|
new_esl = EcScoreLevel.new
new_esl.attributes = pre_esl.attributes.dup.except("id", "ec_course_id")
new_esl.ec_course_id = new_ec.id
new_esl.save!
end
end
end
rescue Exception => e
logger.error("###########error_message: #{e.message}")
raise ActiveRecord::Rollback
end
end
def find_year
@year = EcYear.find(params[:id])
end
# 导出培养目标excel

@ -0,0 +1,381 @@
#encoding=utf-8
# 云启训练场EduCoder个人版 产品编码appId 9200108
# 产品名称 计费类型 套餐编码
# 云启训练场EduCoder个人版 固定包月 9200108001
# 固定包月 9200108002
# 固定包月 9200108003
# ---------------------------------------------------
# 产品名称 计费类型 套餐编码
# 云启训练场EduCoder院校版 包月+按license 9200109001
# 包月+按license 9200109002
# 云启训练场EduCoder院校版 产品编码appId 9200109
require 'net/http'
require 'digest'
class EcloudController < ApplicationController
skip_before_filter :verify_authenticity_token
before_filter :save_para
before_filter :check_sign, only: [:ps_new, :ps_update, :bs_new, :bs_update]
before_filter :user_setup
# before_filter :require_login, only: [:authorize]
skip_before_filter :verify_authenticity_token, only: [:ps_new, :ps_update, :bs_new, :bs_update, :ecloud_login_callback]
def index
render file: 'public/react-oschina/build/index.html', :layout => false
end
def trustie_login
end
# 测试环境
# CLIENT_ID = '1022'
# CLIENT_SECRET = '2112037a-6d7a-432b-9081-feb1153d8668'
# SERVER_URL = "https://221.176.54.92:9081/restful/services/"
#
# 正式环境
CLIENT_ID = '1056'
CLIENT_SECRET = '2e84256a-3de4-4713-9e02-10ee88a14592'
SERVER_URL = "https://221.176.53.130:44390/services/"
## 签名
def sign(timestamp)
Digest::MD5.hexdigest("client_id=#{CLIENT_ID}client_key=#{CLIENT_SECRET}timestamp=#{timestamp}").upcase
end
# 企业/个人业务开通
# applyno 申请单号,唯一
# ecordercode 唯一标志一个企业的订购关系
# params['opttype']操作类型。0开通1变更2试用转商用4再次开通
# 业务列表opttype: 0新增1注销2修改
# serviceparas: 但是由于企业版是按成员收费的所以serviceparas里面会传成员数个人版是包月计费的serviceparas不会传成员数
def bs_new
ActiveRecord::Base.transaction do
begin
if params['opttype'] == 0 # 开通企业/个人业务
ecloud = Ecloud.create!(eloud_params)
create_service(params['services'], ecloud.try(:id)) if params['services'].present?
create_product_params(params['productparas'], ecloud.try(:id)) if params['productparas'].present?
# 为管理员添加一条记录
# 开通的时候都是用户的opttype也是0
# 如果管理员已经存在,则不用重复开通
euser = EcloudUser.where(userid: params['userid'], custid: params['custid']).first
unless euser
EcloudUser.create!(custid: params['custid'], opttype: params['opttype'], userid: params['userid'],
username: params['username'], useralias: params['useralias'],
mobile: params['mobile'], email: params['email'], begintime: params['begintime'],
endtime: params['endtime'])
end
elsif params['opttype'] == 2 # 试用转商用 # 变更企业/个人业务
# 业务列表:注销业务(注销试用的套餐),另一个业务项的操作代码是:新增业务(开通商用的套餐)
# 需要通过产品服务编号和业务编码来区分哪个产品
ecloud = Ecloud.where(custid: params['custid'], custcode: params['custcode'], productcode: params['productcode'], trial: true).first
# 注销试用的套餐
## 需要注销的套餐; 试用转商用是不会有批量操作的所以可以使用first
des_service = params['services'].select{|s| s['opttype'] == 1}.first
esd = EcloudService.where(ecloud_id: ecloud.try(:id), code: des_service['code']).first
ecloud.update_attribute(:trial, params['trial'])
esd.update_attributes!(opttype: des_service['opttype'], begintime: des_service['begintime'], endtime: des_service['endtime'])
# 试用转商用是不会有批量操作的
# 新增业务
add_service = params['services'].select{|s| s['opttype'] == 0}
create_service(add_service, ecloud.try(:id))
#
elsif params['opttype'] == 1 # 业务变更
ecloud = Ecloud.where(custid: params['custid'], custcode: params['custcode'], productcode: params['productcode']).first
# 套餐变更
# 操作代码 0新增业务1注销业务2修改业务
# # 新增服务
add_service = params['services'].select{|s| s['opttype'] == 0}
create_service(add_service, ecloud.try(:id)) if add_service.present?
# 如果有注销业务,注销业务
des_services = params['services'].select{|s| s['opttype'] == 1}
if des_services.present?
des_services.each do |ds|
logger.info("666666#{ecloud.try(:id)}, 55555555#{ds['code']}")
esd = EcloudService.where(ecloud_id: ecloud.try(:id), code: ds['code']).first
esd.update_attributes!(opttype: ds['opttype'], begintime: ds['begintime'], endtime: ds['endtime'])
end
end
# 变更业务
edt_services = params['services'].select{|s| s['opttype'] == 2}
if edt_services.present?
edt_services.each do |es|
ese = EcloudService.where(ecloud_id: ecloud.try(:id), code: es['code']).first
ese.update_attributes!(opttype: es['opttype'], begintime: es['begintime'], endtime: es['endtime']) if ese.present?
create_serviceparas(es['serviceparas'].first, ese.id) if ese.present?
end
end
# ecloud = Ecloud.where(bossorderid: params['bossorderid']).first
# ecloud.update_attributes!(eloud_params)
# ecloud.ecloud_productparas.destroy
# ecloud.ecloud_services.destroy
#
# ecloud_id = ecloud.try(:id)
elsif params['opttype'] == 4 # 再次重复开通
# 再次申请开通,这种情况就是累加时间
ecloud = Ecloud.where(custid: params['custid'], custcode: params['custcode'], productcode: params['productcode']).first
create_service(params['services'], ecloud.try(:id))
create_product_params(params['productparas'], ecloud.try(:id)) if params['productparas'].present?
end
#
# # 非试用情况下,为管理员单独创建一条账号,企业账号
# unless params['trial']
# EcloudUser.create!(ecloud_id: ecloud.try(:id), opttype: params['opttype'], userid: params['userid'],
# username: params['username'], useralias: params['useralias'],
# mobile: params['mobile'], email: params['email'])
# end
render :json => {result: true, errmsg: ""}
# rescue Exception => e
# logger.error(e.message)
# render :json => {code: 500, msg: "#{e.message}"}
# raise ActiveRecord::Rollback
end
end
end
# 企业/个人业务变更、注销
# 处理业务平台退订、暂停(欠费暂停,信控暂停等)、暂停后恢复应用业务
# 这个接口是不会新增业务的
# 试用退订的时候bossorderid传空字符
def bs_update
ActiveRecord::Base.transaction do
begin
case params['opttype']
when 0 # 退订
opttype = 6
when 1 # 暂停
opttype = 7
when 2 # 恢复
opttype = 8
end
if params['bossorderid'].present?
ecloud = Ecloud.where(bossorderid: params['bossorderid']).first
ecloud.update_attribute(:opttype, opttype)
else
# 试用退订
params['services'].each do |service|
ecloud_id = EcloudService.where(code: service['packagecode']).first.try(:ecloud_id)
Ecloud.find(ecloud_id).update_attribute(:opttype, opttype)
end
end
render :json => {result: true, errmsg: ""}
rescue Exception => e
logger.error(e.message)
render :json => {code: 500, msg: "#{e.message}"}
raise ActiveRecord::Rollback
end
end
end
# 用户业务开通与变更接口
# 授权statu为1取消授权status为0
# user['opttype']: 操作类型0开通1变更3: 取消授权4暂停5恢复
def ps_new
ActiveRecord::Base.transaction do
begin
user_params = params['users']
user_params.each do |user_param|
if user_param['opttype'] == 0 # 开通
EcloudUser.create!(custid: params['custid'], opttype: user_param['opttype'], userid: user_param['userid'],
username: user_param['username'], useralias: user_param['useralias'],
mobile: user_param['mobile'], email: user_param['email'], begintime: user_param['begintime'].to_s,
endtime: user_param['endtime'].to_s)
elsif user_param['opttype'] == 1 # 变更
ecloud_user = EcloudUser.where(custid: params['custid'], userid: user_param['userid']).first
ecloud_user.update_attributes!(opttype: user_param['opttype'], username: user_param['username'],
useralias: user_param['useralias'], mobile: user_param['mobile'], email: user_param['email'],
begintime: user_param['begintime'].to_s, endtime: user_param['endtime'].to_s)
end
end
render :json => {success: true, errmsg: ""}
# end
rescue Exception => e
logger.error(e.message)
render :json => {code: 500, msg: "#{e.message}"}
raise ActiveRecord::Rollback
end
end
end
# 用户业务状态变更
# user['opttype']: 操作类型0开通1变更3: 取消授权4暂停5恢复
def ps_update
begin
user_params = params['users']
user_params.each do |user_param|
case user_param['opttype']
when 0 # 取消授权
opttype = 3
when 1 # 暂停
opttype = 4
when 2 # 恢复
opttype = 5
end
ecloud_user = EcloudUser.where(custid: params['custid'], userid: user_param['userid']).first
ecloud_user.update_attributes!(opttype: opttype, operatime: params['operatime'], effecttime: params['effecttime'])
end
render :json => {success: true, errmsg: ""}
rescue Exception => e
logger.error(e.message)
render :json => {code: 500, msg: "#{e.message}"}
end
end
def ecloud_login_callback
unless params["test"] == 'true'
#获取code
logger.info "oauth2 login_callback: #{params}"
raise "没有code" unless params[:code]
url = "#{SERVER_URL}/oauth2/authorization?grant_type=authorization_code" +
"&client_id=#{CLIENT_ID}&scope=&redirect_uri=&code=#{params[:code]}"
res = post(url)
logger.info "oauth2 authorization resp: #{res}"
# {"access_token":"ae673b2d-88b4-46cc-aa74-0b031f24b76f","expires":6,"refresh_token":"7380cc67-a59c-4c21-9000-70e12a58d175","username":"15111030087@QW_er","uid":2147}
body = decode(res)
raise '登录失败' unless body["access_token"]
#获取此用户信息
res = get("#{SERVER_URL}/user/info?access_token=#{body['access_token']}&userid=#{body['uid']}")
logger.info "oauth2 get user info: #{res}"
# {"userid":2147,"custid":2104,"custcode":"E0002018042810010054","custtype":2,"status":2,"username":"15111030087@QW_er","useralias":"15111030087","isadmin":true,"entprise":"04**004","departments":"","departmentnames":"","mobile":"15365386520","email":"15111030087@139.com"}
else
res = '{"userid":2147,"custid":2104,"custcode":"E0002018042810010054","custtype":2,"status":2,"username":"15111030087@QW_er","useralias":"15111030087","isadmin":true,"entprise":"04**004","departments":"","departmentnames":"","mobile":"15365386520","email":"15111030087@139.com"}'
end
# 同步用户
info = decode(res)
user = User.find_by_ecoder_user_id(info["userid"])
unless user
#新建用户
user = User.create_with_ecoder!(info)
end
self.logged_user = user
user = UserExtensions.where(:user_id => User.current.id).first
if user.gender.nil? || user.school_id.nil? || User.current.lastname.nil?
redirect_to my_account_path
elsif user.identity == 3 && user.school_id.nil?
redirect_to my_account_path
else
redirect_to User.current
end
end
private
def get(url)
uri = URI(url)
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = url.start_with?('https')
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(uri.request_uri)
request['Content-Type'] = 'application/json'
request['Accept'] = 'application/json'
response = http.request(request)
response.body
end
def post(url)
uri = URI(url)
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = url.start_with?('https')
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(uri.request_uri)
request['Content-Type'] = 'application/json'
request['Accept'] = 'application/json'
response = http.request(request)
response.body
end
def decode(s)
begin
obj = ActiveSupport::JSON.decode(s)
rescue ActiveSupport::JSON.parse_error
logger.error("Attempted to decode invalid JSON: #{s}")
end
end
private
def eloud_params
return {applyno: params['applyno'], ecordercode: params['ecordercode'], opttype: params['opttype'],
trial: params['trial'], bossorderid: params['bossorderid'], custid: params['custid'], custtype: params['custtype'],
custcode: params['custcode'], registersource: params['registersource'], custname: params['custname'],
userid: params['userid'], username: params['username'], useralias: params['useralias'], mobile: params['mobile'],
email: params['email'], productcode: params['productcode'], begintime: params['begintime'],
endtime: params['endtime']}
end
# 新增套餐
def create_service services, ecloud_id
services.each do |service|
ese = EcloudService.create!(opttype: service['opttype'], code: service['code'], begintime: service['begintime'],
endtime: service['endtime'], ecloud_id: ecloud_id)
if service['serviceparas'].present?
create_serviceparas(service['serviceparas'].first, ese.id)
end
end
end
def create_serviceparas params_serviceparas, ese_id
if params_serviceparas.present?
EcloudServieceServicepara.create(key: params_serviceparas['key'], value: params_serviceparas['value'], ecloud_service_id: ese_id)
end
end
def create_product_params params, ecloud_id
params.each do |p|
EcloudProductpara.create(key: p['key'], value: p['value'], ecloud_id: ecloud_id)
end
end
def check_sign
sign = sign(params['timestamp'])
if sign != params['sign']
render :json => {code: 501, msg: "sign的值错误"}
return
end
end
def save_para
EcloudLog.create(url: request.url, para_value: params, applyno: params['applyno'], custid: params['custid'],
custcode: params['custcode'], userid: params['userid'], username: params['username'])
end
end

@ -1,5 +1,7 @@
class EcsController < ApplicationController
before_filter :require_login
before_filter :find_school, :except => [:get_navigation_url]
before_filter :school_manager, :except => [:department, :get_navigation_url]
layout 'base_ec'
def department
@ -10,26 +12,30 @@ class EcsController < ApplicationController
@major_schools = @school.ec_major_schools.where(:template_major => false)
unless @is_school_manager
ec_major_school_ids = EcMajorSchoolUser.where(:user_id => User.current.id).pluck(:ec_major_school_id)
ec_course_major_ids = EcYear.where(:id => EcCourseUser.where(:user_id => User.current.id).pluck(:ec_year_id)).pluck(:ec_major_school_id)
ec_course_major_ids = EcYear.where(:id => EcCourse.where(:id => EcCourseUser.where(:user_id => User.current.id).pluck(:ec_course_id)).pluck(:ec_year_id)).pluck(:ec_major_school_id)
@major_schools = @major_schools.where(:id => (ec_major_school_ids + ec_course_major_ids).uniq)
end
@major_count = @major_schools.count
if params[:search].present?
major_ids = EcMajor.where("name like '%#{params[:search]}%' or code like '%#{params[:search]}%'").pluck(:id)
@major_schools = @major_schools.where(:ec_major_id => major_ids)
end
if !@is_school_manager && @major_count == 0
render_403
else
if params[:search].present?
major_ids = EcMajor.where("name like '%#{params[:search]}%' or code like '%#{params[:search]}%'").pluck(:id)
@major_schools = @major_schools.where(:ec_major_id => major_ids)
end
@obj_count = @major_schools.count
@limit = 10
@is_remote = true
@obj_pages = Paginator.new @obj_count, @limit, params['page'] || 1
@offset ||= @obj_pages.offset
@major_schools = paginateHelper @major_schools, @limit
respond_to do |format|
format.js
format.html
@obj_count = @major_schools.count
@limit = 10
@is_remote = true
@obj_pages = Paginator.new @obj_count, @limit, params['page'] || 1
@offset ||= @obj_pages.offset
@major_schools = paginateHelper @major_schools, @limit
respond_to do |format|
format.js
format.html
end
end
end
@ -62,4 +68,10 @@ class EcsController < ApplicationController
def find_school
@school = School.find(params[:school_id])
end
def school_manager
unless User.current.admin? || @school.users.where(:id => User.current.id).count > 0
render_403
end
end
end

@ -81,12 +81,11 @@ class ExerciseController < ApplicationController
@can_edit_excercise = can_edit_exercise @exercise, @exercise_user
if !@can_edit_excercise && !@exercise_user.status
time = (@exercise_user.start_at.to_i + @exercise.time.to_i * 60) > @exercise.end_time.to_i ? @exercise.end_time : Time.at(@exercise_user.start_at.to_i + @exercise.time.to_i * 60)
@exercise_user.update_attributes(:status => true, :end_at => time, :commit_status => 1)
s_score = calculate_student_score(@exercise, @exercise_user.user)
@exercise_user.update_attributes(:objective_score => s_score, :score => (s_score + (@exercise_user.subjective_score && @exercise_user.subjective_score > 0 ? @exercise_user.subjective_score : 0)))
if @exercise_user.user.exercise_answer.where(:exercise_question_id => @exercise.exercise_questions.where(:question_type => 4).map(&:id)).empty?
@exercise_user.update_attributes(:subjective_score => 0)
end
sub_score = @exercise_user.user.exercise_answer.where(:exercise_question_id => @exercise.exercise_questions.where(:question_type => 4).map(&:id)).empty? ? 0 : @exercise_user.subjective_score
total_score = s_score + (sub_score && sub_score > 0 ? sub_score : 0)
@exercise_user.update_attributes(:status => true, :end_at => time, :commit_status => 1, :objective_score => s_score,
:subjective_score => sub_score, :score => total_score)
end
if @exercise_user.commit_status == 1 && @exercise.end_time > Time.now
@ -313,12 +312,11 @@ class ExerciseController < ApplicationController
@exercise.exercise_status = 3
@exercise.exercise_users.each do |exercise_user|
if exercise_user.commit_status == 0 && !exercise_user.start_at.nil?
exercise_user.update_attributes(:commit_status => 1, :end_at => params[:exercise_end_time], :status => true)
s_score = calculate_student_score(@exercise, exercise_user.user)
exercise_user.update_attributes(:objective_score => s_score, :score => (s_score + (exercise_user.subjective_score && exercise_user.subjective_score > 0 ? exercise_user.subjective_score : 0)))
if exercise_user.user.exercise_answer.where(:exercise_question_id => @exercise.exercise_questions.where(:question_type => 4).map(&:id)).empty?
exercise_user.update_attributes(:subjective_score => 0)
end
sub_score = exercise_user.user.exercise_answer.where(:exercise_question_id => @exercise.exercise_questions.where(:question_type => 4).map(&:id)).empty? ? 0 : exercise_user.subjective_score
total_score = s_score + (sub_score && sub_score > 0 ? sub_score : 0)
exercise_user.update_attributes(:commit_status => 1, :end_at => params[:exercise_end_time], :status => true, :objective_score => s_score,
:subjective_score => sub_score, :score => total_score)
end
end
elsif @exercise.end_time > Time.now && @exercise.exercise_status == 3
@ -373,7 +371,7 @@ class ExerciseController < ApplicationController
:question_title => question_title,
:question_type => params[:question_type] || 1,
:question_number => @exercise.exercise_questions.count + 1,
:question_score => params[:question_score],
:question_score => params[:question_type] == '5' ? 0 : params[:question_score],
:shixun_id => params[:shixun]
}
@exercise_questions = @exercise.exercise_questions.new option
@ -450,7 +448,7 @@ class ExerciseController < ApplicationController
def update_exercise_question
@exercise_question = ExerciseQuestion.find params[:exercise_question]
@exercise_question.question_title = params[:question_title].nil? || params[:question_title].empty? ? l(:label_enter_single_title) : params[:question_title]
@exercise_question.question_score = params[:question_score]
@exercise_question.question_score = params[:question_score] if @exercise_question.question_type != 5
# 处理选项:如果选了某个选项,那么则要删除之前的选项
if params[:question_answer]
@exercise_question.exercise_choices.each do |answer|
@ -766,12 +764,10 @@ class ExerciseController < ApplicationController
exercise_users.each do |exercise_user|
if exercise_user.commit_status == 0 && !exercise_user.start_at.nil?
time = (exercise_user.start_at.to_i + @exercise.time.to_i * 60) > @exercise.end_time.to_i ? @exercise.end_time : Time.at(exercise_user.start_at.to_i + @exercise.time.to_i * 60)
exercise_user.update_attributes(:status => 1, :commit_status => 1, :end_at => time)
s_score = calculate_student_score(@exercise, exercise_user.user)
exercise_user.update_attributes(:objective_score => s_score, :score => (s_score + (exercise_user.subjective_score && exercise_user.subjective_score > 0 ? exercise_user.subjective_score : 0)))
if exercise_user.user.exercise_answer.where(:exercise_question_id => @exercise.exercise_questions.where(:question_type => 4).map(&:id)).empty?
exercise_user.update_attributes(:subjective_score => 0)
end
sub_score = exercise_user.user.exercise_answer.where(:exercise_question_id => @exercise.exercise_questions.where(:question_type => 4).map(&:id)).empty? ? 0 : exercise_user.subjective_score
exercise_user.update_attributes(:status => 1, :commit_status => 1, :end_at => time, :objective_score => s_score, :subjective_score => sub_score,
:score => (s_score + (exercise_user.subjective_score && exercise_user.subjective_score > 0 ? exercise_user.subjective_score : 0)))
end
end
#end
@ -827,23 +823,20 @@ class ExerciseController < ApplicationController
setting_time = exercise_group_setting @exercise, member.try(:course_group)
if ((Time.now.to_i - exercise_user.start_at.to_i) > @exercise.time.to_i * 60) || setting_time.end_time < Time.now
time = (exercise_user.start_at.to_i + @exercise.time.to_i * 60) > setting_time.end_time.to_i ? setting_time.end_time : Time.at(exercise_user.start_at.to_i + @exercise.time.to_i * 60)
exercise_user.update_attributes(:commit_status => 1, :end_at => time, :status => true)
s_score = calculate_student_score(@exercise, exercise_user.user)
exercise_user.update_attributes(:objective_score => s_score, :score => (s_score + (exercise_user.subjective_score && exercise_user.subjective_score > 0 ? exercise_user.subjective_score : 0)))
if exercise_user.user.exercise_answer.where(:exercise_question_id => @exercise.exercise_questions.where(:question_type => 4).map(&:id)).empty?
exercise_user.update_attributes(:subjective_score => 0)
end
sub_score = exercise_user.user.exercise_answer.where(:exercise_question_id => @exercise.exercise_questions.where(:question_type => 4).map(&:id)).empty? ? 0 : exercise_user.subjective_score
total_score = s_score + (sub_score && sub_score > 0 ? sub_score : 0)
exercise_user.update_attributes(:commit_status => 1, :end_at => time, :status => true, :objective_score => s_score,
:subjective_score => sub_score, :score => total_score)
end
end
end
@exercise.exercise_users.where("commit_status = 1 and score is null").each do |exercise_user|
s_score = calculate_student_score(@exercise, exercise_user.user)
exercise_user.update_attributes(:objective_score => s_score, :score => (s_score + (exercise_user.subjective_score && exercise_user.subjective_score > 0 ? exercise_user.subjective_score : 0)))
if exercise_user.user.exercise_answer.where(:exercise_question_id => @exercise.exercise_questions.where(:question_type => 4).map(&:id)).empty?
exercise_user.update_attributes(:subjective_score => 0)
end
sub_score = exercise_user.user.exercise_answer.where(:exercise_question_id => @exercise.exercise_questions.where(:question_type => 4).map(&:id)).empty? ? 0 : exercise_user.subjective_score
total_score = s_score + (sub_score && sub_score > 0 ? sub_score : 0)
exercise_user.update_attributes(:objective_score => s_score, :subjective_score => sub_score, :score => total_score)
end
@group_teacher = @is_teacher && @member.present? && @member.teacher_course_groups.count > 0
@ -1119,13 +1112,12 @@ class ExerciseController < ApplicationController
# 试卷未截止且试卷未提交过才能提交
if @exercise.exercise_status == 2 && cur_exercise_user.present? && cur_exercise_user.commit_status == 0
cur_exercise_user.update_attributes(:status => 1, :commit_status => 1, :end_at => Time.now)
#if @exercise.time && @exercise.time != -1
score = calculate_student_score(@exercise, User.current)
cur_exercise_user.update_attributes(:objective_score => score, :score => score + (cur_exercise_user.subjective_score > 0 ? cur_exercise_user.subjective_score : 0))
if User.current.exercise_answer.where(:exercise_question_id => @exercise.exercise_questions.where(:question_type => 4).map(&:id)).empty?
cur_exercise_user.update_attributes(:subjective_score => 0)
end
sub_score = User.current.exercise_answer.where(:exercise_question_id => @exercise.exercise_questions.where(:question_type => 4).map(&:id)).empty? ? 0 : cur_exercise_user.subjective_score
total_score = score + (sub_score && sub_score > 0 ? sub_score : 0)
cur_exercise_user.update_attributes(:status => 1, :commit_status => 1, :end_at => Time.now, :objective_score => score,
:subjective_score => sub_score, :score => total_score)
# 提交后给老师和助教发消息
tid_str = ""

@ -219,10 +219,10 @@ class GamesController < ApplicationController
@had_passed_testsests_public_count = had_test.blank? ? 0 : had_test.select{|had_test| had_test.result == true && had_test.is_public == true}.count
@mirror_name = @myshixun.mirror_name
@final_score = ((@shixun.status <= 1) ? 0 : @game.final_score.to_i)
if @myshixun.shixun.status <= 1 || (@game.final_score != 0 && @game.answer_open?)
if @myshixun.shixun.status <= 1 || (@game.final_score != 0 && @game.answer_open > 0)
@gold = 0
else
if @game.answer_open? && @game.final_score ==0
if @game.answer_open > 0 && @game.final_score ==0
@gold = -@game_challenge.score.to_i
else
@gold = @game.final_score.to_i

@ -16,7 +16,7 @@ class HomeworkCommonController < ApplicationController
before_filter :teacher_of_course, :only => [:new, :create, :edit, :update, :destroy, :start_anonymous_comment, :stop_anonymous_comment, :alert_anonymous_comment,
:start_evaluation_set,:set_evaluation_attr,:score_rule_set,:alert_forbidden_anonymous_comment,:alert_open_student_works,
:open_student_works,:add_to_homework_bank,:publish_notice,:end_notice,:publish_homework,:end_homework,:update_explanation,
:cancel_publish, :move_to_category]
:cancel_publish, :move_to_category,:homework_setting]
# before_filter :member_of_course, :only => [:index,:setting]
@ -30,9 +30,9 @@ class HomeworkCommonController < ApplicationController
@homework_type = params[:homework_type].to_i
@is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course))
if @search
@homework_commons = @course.homework_commons.where(:homework_type => @homework_type).where("homework_commons.name like '%#{@search}%'").includes(:homework_detail_manual, :homework_group_settings, :student_works)
@homework_commons = @course.homework_commons.where(:homework_type => @homework_type).where("homework_commons.name like '%#{@search}%'")
else
@homework_commons = @course.homework_commons.where(:homework_type => @homework_type).includes(:homework_detail_manual, :homework_group_settings, :student_works)
@homework_commons = @course.homework_commons.where(:homework_type => @homework_type)
end
if @is_teacher
@homework_commons = @homework_commons
@ -72,6 +72,9 @@ class HomeworkCommonController < ApplicationController
@is_new = params[:is_new]
@homeworks = paginateHelper @homework_commons,15
@homeworks = @homework_type == 4 ? @homeworks.includes(:homework_detail_manual, :homework_group_settings, [homework_commons_shixuns: :shixun]) :
@homeworks.includes(:homework_detail_manual, :homework_group_settings)
#设置at已读
=begin
ids = @homeworks.inject([]) do |ids, homework|
@ -282,93 +285,94 @@ class HomeworkCommonController < ApplicationController
end
def homework_setting
if @homework.homework_detail_manual.try(:comment_status) == 0 && @course.course_groups.count > 1
@homework.unified_setting = params[:unified_setting] ? true :false
end
ActiveRecord::Base.transaction do
if @homework.homework_detail_manual.try(:comment_status) == 0 && @course.course_groups.count > 1
@homework.unified_setting = params[:unified_setting] ? true :false
end
if @homework.unified_setting
params_publish_time = params[:homework_publish_time]
params_end_time = params[:homework_end_time]
# params_archive_time = params[:homework_archive_time]
min_publish_time = params_publish_time
max_end_time = params_end_time
else
# 获取最小发布时间和最大截止时间赋值给homework
params_publish_time = params[:homework_publish_time_group]
params_end_time = params[:homework_end_time_group]
# params_archive_time = params[:homework_archive_time_group]
min_publish_time = @homework.publish_time ? (format_time @homework.publish_time).to_s : ""
max_end_time = @homework.end_time ? (format_time @homework.end_time).to_s : ""
if params[:homework_end_time_group]
max_end_time = ""
params[:homework_end_time_group].each_with_index do |end_time, index|
if end_time != ""
if max_end_time == "" || end_time > max_end_time
max_end_time = end_time
if @homework.unified_setting
params_publish_time = params[:homework_publish_time]
params_end_time = params[:homework_end_time]
# params_archive_time = params[:homework_archive_time]
min_publish_time = params_publish_time
max_end_time = params_end_time
else
# 获取最小发布时间和最大截止时间赋值给homework
params_publish_time = params[:homework_publish_time_group]
params_end_time = params[:homework_end_time_group]
# params_archive_time = params[:homework_archive_time_group]
min_publish_time = @homework.publish_time ? (format_time @homework.publish_time).to_s : ""
max_end_time = @homework.end_time ? (format_time @homework.end_time).to_s : ""
if params[:homework_end_time_group]
max_end_time = ""
params[:homework_end_time_group].each_with_index do |end_time, index|
if end_time != ""
if max_end_time == "" || end_time > max_end_time
max_end_time = end_time
end
end
end
end
end
if params[:homework_publish_time_group]
params[:homework_publish_time_group].each_with_index do |publish_time, index|
if publish_time != ""
if min_publish_time == "" || publish_time < min_publish_time
min_publish_time = publish_time
if params[:homework_publish_time_group]
params[:homework_publish_time_group].each_with_index do |publish_time, index|
if publish_time != ""
if min_publish_time == "" || publish_time < min_publish_time
min_publish_time = publish_time
end
end
end
end
end
end
# 不统一设置且分班数大于一则更新分组设置
if !@homework.unified_setting && @course.course_groups.count > 1
@course.course_groups.each_with_index do |group, index|
homework_group_setting = @homework.homework_group_settings.where(:course_group_id => group.id).first
unless homework_group_setting
homework_group_setting = HomeworkGroupSetting.create(:homework_common_id => @homework.id, :course_group_id => group.id, :course_id => @course.id)
# 不统一设置且分班数大于一则更新分组设置
if !@homework.unified_setting && @course.course_groups.count > 1
@course.course_groups.each_with_index do |group, index|
homework_group_setting = @homework.homework_group_settings.where(:course_group_id => group.id).first
unless homework_group_setting
homework_group_setting = HomeworkGroupSetting.create(:homework_common_id => @homework.id, :course_group_id => group.id, :course_id => @course.id)
end
end
end
group_id = []
@homework.homework_group_settings.where("publish_time is null or publish_time > '#{Time.now}'").joins(:course_group).reorder("CONVERT(course_groups.name USING gbk) COLLATE gbk_chinese_ci ASC").each_with_index do |setting, index|
if params[:homework_publish_time_group] && min_publish_time != ""
if params[:homework_publish_time_group][index] && params[:homework_publish_time_group][index] != ""
setting.update_column(:publish_time, params[:homework_publish_time_group][index])
group_id = []
@homework.homework_group_settings.where("publish_time is null or publish_time > '#{Time.now}'").joins(:course_group).reorder("CONVERT(course_groups.name USING gbk) COLLATE gbk_chinese_ci ASC").each_with_index do |setting, index|
if params[:homework_publish_time_group] && min_publish_time != ""
if params[:homework_publish_time_group][index] && params[:homework_publish_time_group][index] != ""
setting.update_column(:publish_time, params[:homework_publish_time_group][index])
end
elsif params[:homework_publish_time_group] && min_publish_time == ""
setting.update_column(:publish_time, Time.now)
group_id << setting.course_group_id
end
elsif params[:homework_publish_time_group] && min_publish_time == ""
setting.update_column(:publish_time, Time.now)
group_id << setting.course_group_id
end
end
@homework.homework_group_settings.where("end_time is null or end_time > '#{Time.now}'").joins(:course_group).reorder("CONVERT(course_groups.name USING gbk) COLLATE gbk_chinese_ci ASC").each_with_index do |setting, index|
if params[:homework_end_time_group] && max_end_time != ""
if params[:homework_end_time_group][index] && params[:homework_end_time_group][index] != ""
setting.update_column(:end_time, params[:homework_end_time_group][index])
@homework.homework_group_settings.where("end_time is null or end_time > '#{Time.now}'").joins(:course_group).reorder("CONVERT(course_groups.name USING gbk) COLLATE gbk_chinese_ci ASC").each_with_index do |setting, index|
if params[:homework_end_time_group] && max_end_time != ""
if params[:homework_end_time_group][index] && params[:homework_end_time_group][index] != ""
setting.update_column(:end_time, params[:homework_end_time_group][index])
end
elsif params[:homework_end_time_group] && max_end_time == ""
setting.update_column(:end_time, Time.at(((1.month.since.to_i)/3600.0).ceil * 3600))
end
elsif params[:homework_end_time_group] && max_end_time == ""
setting.update_column(:end_time, Time.at(((1.month.since.to_i)/3600.0).ceil * 3600))
end
# 统一设置则删除分组设置
elsif @homework.unified_setting
@homework.homework_group_settings.destroy_all
end
# 统一设置则删除分组设置
elsif @homework.unified_setting
@homework.homework_group_settings.destroy_all
end
# homework 的记录更新
# 发布时间不为空
if params_publish_time && min_publish_time != ""
@homework.publish_time = min_publish_time
@homework.end_time = max_end_time
# @homework.archive_time = params_archive_time if params_archive_time
if @homework.publish_time < Time.now and @homework_detail_manual.comment_status == 0
@homework_detail_manual.comment_status = 1
create_homework_user = 1
if @homework.course_acts.size == 0
@homework.course_acts << CourseActivity.new(:user_id => @homework.user_id,:course_id => @homework.course_id)
# homework 的记录更新
# 发布时间不为空
if params_publish_time && min_publish_time != ""
@homework.publish_time = min_publish_time if @homework.publish_time.nil? || @homework.publish_time > Time.now
@homework.end_time = max_end_time if @homework.end_time.nil? || @homework.end_time > Time.now
# @homework.archive_time = params_archive_time if params_archive_time
if @homework.publish_time < Time.now and @homework_detail_manual.comment_status == 0
@homework_detail_manual.comment_status = 1
create_homework_user = 1
if @homework.course_acts.size == 0
@homework.course_acts << CourseActivity.new(:user_id => @homework.user_id,:course_id => @homework.course_id)
end
end
end
=begin
if @homework.archive_time < Time.now && @homework_detail_manual.comment_status < 6
@homework_detail_manual.comment_status = 6
@ -376,22 +380,22 @@ class HomeworkCommonController < ApplicationController
@homework_detail_manual.comment_status = 5
end
=end
# 发布时间未设置 则按当前时间立即发布
elsif params_publish_time && min_publish_time == ""
@homework_detail_manual.comment_status = 1
@homework.publish_time = Time.now
@homework.unified_setting = 1
@homework.end_time = Time.at(((1.month.since.to_i)/3600.0).ceil * 3600)
# @homework.archive_time = Time.at(((2.months.since.to_i)/3600.0).ceil * 3600)
create_homework_user = 1
if @homework.course_acts.size == 0
@homework.course_acts << CourseActivity.new(:user_id => @homework.user_id,:course_id => @homework.course_id)
end
# 已发布的作业,只更新截止时间和结束时间
else
@homework.end_time = max_end_time if params_end_time
# @homework.archive_time = params_archive_time if params_archive_time
# 发布时间未设置 则按当前时间立即发布
elsif params_publish_time && min_publish_time == ""
@homework_detail_manual.comment_status = 1 if @homework_detail_manual.comment_status == 0
@homework.publish_time = Time.now if @homework.publish_time.nil? || @homework.publish_time > Time.now
@homework.unified_setting = 1
@homework.end_time = Time.at(((1.month.since.to_i)/3600.0).ceil * 3600) if @homework.end_time.nil? || @homework.end_time > Time.now
# @homework.archive_time = Time.at(((2.months.since.to_i)/3600.0).ceil * 3600)
create_homework_user = 1
if @homework.course_acts.size == 0
@homework.course_acts << CourseActivity.new(:user_id => @homework.user_id,:course_id => @homework.course_id)
end
# 已发布的作业,只更新截止时间和结束时间
else
@homework.end_time = max_end_time if params_end_time && (@homework.end_time.nil? || @homework.end_time > Time.now)
# @homework.archive_time = params_archive_time if params_archive_time
=begin
if @homework.archive_time < Time.now && @homework_detail_manual.comment_status < 6
@ -400,189 +404,190 @@ class HomeworkCommonController < ApplicationController
@homework_detail_manual.comment_status = 5
end
=end
end
end
if params[:homework_allow_late] == '1'
@homework.allow_late = true
if @homework.late_penalty != params[:homework_late_penalty].to_i
@homework.student_works.where(:work_status => 2).each do |work|
work.late_penalty = params[:homework_late_penalty].to_i
work.save
if params[:homework_allow_late] == '1'
@homework.allow_late = true
if @homework.late_penalty != params[:homework_late_penalty].to_i
@homework.student_works.where(:work_status => 2).each do |work|
work.late_penalty = params[:homework_late_penalty].to_i
work.save
end
end
@homework.late_penalty = params[:homework_late_penalty].to_i
else
@homework.allow_late = false
@homework.late_penalty = 0
end
@homework.late_penalty = params[:homework_late_penalty].to_i
else
@homework.allow_late = false
@homework.late_penalty = 0
end
anonymous_comment = @homework.anonymous_comment
absence_penalty = @homework_detail_manual.absence_penalty
appeal_penalty = @homework_detail_manual.appeal_penalty
if @homework_detail_manual.comment_status < 3
if params[:homework_anonymous_comment]
@homework.anonymous_comment = 0
@homework_detail_manual.evaluation_start = params[:homework_evaluation_start] if params[:homework_evaluation_start]
anonymous_comment = @homework.anonymous_comment
absence_penalty = @homework_detail_manual.absence_penalty
appeal_penalty = @homework_detail_manual.appeal_penalty
if @homework_detail_manual.comment_status < 3
if params[:homework_anonymous_comment]
@homework.anonymous_comment = 0
@homework_detail_manual.evaluation_start = params[:homework_evaluation_start] if params[:homework_evaluation_start]
@homework_detail_manual.evaluation_end = params[:homework_evaluation_end] if params[:homework_evaluation_end]
@homework_detail_manual.evaluation_num = params[:homework_evaluation_num] if params[:homework_evaluation_num]
@homework_detail_manual.absence_penalty = params[:homework_absence_penalty] if params[:homework_absence_penalty]
else
@homework.anonymous_comment = 1
@homework_detail_manual.evaluation_start = nil
@homework_detail_manual.evaluation_end = nil
@homework_detail_manual.evaluation_num = 0
@homework_detail_manual.absence_penalty = 0
end
else
@homework_detail_manual.evaluation_end = params[:homework_evaluation_end] if params[:homework_evaluation_end]
@homework_detail_manual.evaluation_num = params[:homework_evaluation_num] if params[:homework_evaluation_num]
@homework_detail_manual.absence_penalty = params[:homework_absence_penalty] if params[:homework_absence_penalty]
end
if anonymous_comment != @homework.anonymous_comment
@homework_detail_manual.te_proportion = 1
@homework_detail_manual.ta_proportion = 0
@homework_detail_programing.ta_proportion = 0 if @homework_detail_programing
end
if @homework_detail_manual.comment_status < 4
if @homework.anonymous_comment == 0 && params[:homework_anonymous_appeal]
@homework.anonymous_appeal = 1
@homework_detail_manual.appeal_time = params[:homework_appeal_time] if params[:homework_appeal_time]
@homework_detail_manual.appeal_penalty = params[:homework_appeal_penalty] if params[:homework_appeal_penalty]
else
@homework.anonymous_appeal = 0
@homework_detail_manual.appeal_time = nil
@homework_detail_manual.appeal_penalty = 0
end
else
@homework.anonymous_comment = 1
@homework_detail_manual.evaluation_start = nil
@homework_detail_manual.evaluation_end = nil
@homework_detail_manual.evaluation_num = 0
@homework_detail_manual.absence_penalty = 0
end
else
@homework_detail_manual.evaluation_end = params[:homework_evaluation_end] if params[:homework_evaluation_end]
@homework_detail_manual.evaluation_num = params[:homework_evaluation_num] if params[:homework_evaluation_num]
@homework_detail_manual.absence_penalty = params[:homework_absence_penalty] if params[:homework_absence_penalty]
end
if anonymous_comment != @homework.anonymous_comment
@homework_detail_manual.te_proportion = 1
@homework_detail_manual.ta_proportion = 0
@homework_detail_programing.ta_proportion = 0 if @homework_detail_programing
end
if @homework_detail_manual.comment_status < 4
if @homework.anonymous_comment == 0 && params[:homework_anonymous_appeal]
@homework.anonymous_appeal = 1
@homework_detail_manual.appeal_time = params[:homework_appeal_time] if params[:homework_appeal_time]
@homework_detail_manual.appeal_penalty = params[:homework_appeal_penalty] if params[:homework_appeal_penalty]
else
@homework.anonymous_appeal = 0
@homework_detail_manual.appeal_time = nil
@homework_detail_manual.appeal_penalty = 0
end
else
@homework_detail_manual.appeal_time = params[:homework_appeal_time] if params[:homework_appeal_time]
@homework_detail_manual.appeal_penalty = params[:homework_appeal_penalty] if params[:homework_appeal_penalty]
end
if absence_penalty != @homework_detail_manual.absence_penalty && @homework_detail_manual.comment_status >= 4
all_dis_eva = StudentWorksEvaluationDistribution.where(:student_work_id => @homework.student_works.map(&:id))
has_sw_count = all_dis_eva.select("distinct user_id").count
anon_count = all_dis_eva.count / has_sw_count
@homework.student_works.where("work_status != 0").each do |student_work|
absence_penalty_count = student_work.user.student_works_evaluation_distributions.where(:student_work_id => @homework.student_works.map(&:id)).count - student_work.user.student_works_scores.where(:student_work_id => @homework.student_works.map(&:id), :reviewer_role => 3).count
student_work.absence_penalty = absence_penalty_count > 0 ? absence_penalty_count * @homework_detail_manual.absence_penalty : 0
student_work.save
end
end
if appeal_penalty != @homework_detail_manual.appeal_penalty && @homework_detail_manual.comment_status >= 4
@homework.student_works.each do |student_work|
appeal_penalty_count = student_work.user.student_works_scores.where(:student_work_id => @homework.student_works.map(&:id), :appeal_status => 3).count
student_work.appeal_penalty = appeal_penalty_count > 0 ? appeal_penalty_count * @homework_detail_manual.absence_penalty : 0
student_work.save
end
end
# 助教评分模式有变更 则更新学生分数
if params[:homework_ta_mode] && @homework_detail_manual.ta_mode.to_i != params[:homework_ta_mode].to_i
@homework_detail_manual.ta_mode = params[:ta_mode].to_i
@homework_detail_manual.save
if @homework_detail_manual.ta_mode == 1
if absence_penalty != @homework_detail_manual.absence_penalty && @homework_detail_manual.comment_status >= 4
all_dis_eva = StudentWorksEvaluationDistribution.where(:student_work_id => @homework.student_works.map(&:id))
has_sw_count = all_dis_eva.select("distinct user_id").count
anon_count = all_dis_eva.count / has_sw_count
@homework.student_works.where("work_status != 0").each do |student_work|
ts_score = StudentWorksScore.find_by_sql("SELECT AVG(score) AS score FROM (SELECT * FROM (SELECT * FROM student_works_scores WHERE student_work_id = #{student_work.id} AND reviewer_role = 2 AND score IS NOT NULL ORDER BY created_at DESC) AS t GROUP BY user_id) AS a")
student_work.teaching_asistant_score = ts_score.first.score.nil? ? nil : ts_score.first.score.try(:round, 2).to_f
absence_penalty_count = student_work.user.student_works_evaluation_distributions.where(:student_work_id => @homework.student_works.map(&:id)).count - student_work.user.student_works_scores.where(:student_work_id => @homework.student_works.map(&:id), :reviewer_role => 3).count
student_work.absence_penalty = absence_penalty_count > 0 ? absence_penalty_count * @homework_detail_manual.absence_penalty : 0
student_work.save
end
else
@homework.student_works.where("work_status != 0").each do |student_work|
ts_score = StudentWorksScore.where("student_work_id = #{student_work.id} AND reviewer_role = 2 AND score IS NOT NULL").order("created_at DESC")
student_work.teaching_asistant_score = ts_score.first.nil? ? nil : ts_score.first.score
end
if appeal_penalty != @homework_detail_manual.appeal_penalty && @homework_detail_manual.comment_status >= 4
@homework.student_works.each do |student_work|
appeal_penalty_count = student_work.user.student_works_scores.where(:student_work_id => @homework.student_works.map(&:id), :appeal_status => 3).count
student_work.appeal_penalty = appeal_penalty_count > 0 ? appeal_penalty_count * @homework_detail_manual.absence_penalty : 0
student_work.save
end
end
end
# 最终成绩组成
if params[:homework_final_mode] && params[:homework_final_mode].to_i != @homework_detail_manual.final_mode
@homework_detail_manual.final_mode = params[:homework_final_mode].to_i
if params[:homework_final_mode].to_i == 0
@homework_detail_manual.te_proportion = params[:te_proportion]
@homework_detail_manual.ta_proportion = params[:ta_proportion]
@homework_detail_programing.ta_proportion = params[:sy_proportion] if @homework_detail_programing
@homework_detail_programing.save if @homework_detail_programing
end
@homework_detail_manual.save if @homework_detail_manual
@homework.save
@homework = HomeworkCommon.find @homework.id
@homework.student_works.where("work_status != 0").each do |student_work|
# set_final_score @homework,student_work
student_work.save
# 助教评分模式有变更 则更新学生分数
if params[:homework_ta_mode] && @homework_detail_manual.ta_mode.to_i != params[:homework_ta_mode].to_i
@homework_detail_manual.ta_mode = params[:ta_mode].to_i
@homework_detail_manual.save
if @homework_detail_manual.ta_mode == 1
@homework.student_works.where("work_status != 0").each do |student_work|
ts_score = StudentWorksScore.find_by_sql("SELECT AVG(score) AS score FROM (SELECT * FROM (SELECT * FROM student_works_scores WHERE student_work_id = #{student_work.id} AND reviewer_role = 2 AND score IS NOT NULL ORDER BY created_at DESC) AS t GROUP BY user_id) AS a")
student_work.teaching_asistant_score = ts_score.first.score.nil? ? nil : ts_score.first.score.try(:round, 2).to_f
student_work.save
end
else
@homework.student_works.where("work_status != 0").each do |student_work|
ts_score = StudentWorksScore.where("student_work_id = #{student_work.id} AND reviewer_role = 2 AND score IS NOT NULL").order("created_at DESC")
student_work.teaching_asistant_score = ts_score.first.nil? ? nil : ts_score.first.score
student_work.save
end
end
end
elsif params[:homework_final_mode] && @homework_detail_manual.final_mode == 0
if (params[:te_proportion] && params[:te_proportion].to_s != @homework_detail_manual.te_proportion.to_s) || (params[:ta_proportion] && params[:ta_proportion].to_s != @homework_detail_manual.ta_proportion.to_s) || (@homework_detail_programing && @homework_detail_programing.ta_proportion.to_s != params[:sy_proportion].to_s)
@homework_detail_manual.te_proportion = params[:te_proportion]
@homework_detail_manual.ta_proportion = params[:ta_proportion]
@homework_detail_programing.ta_proportion = params[:sy_proportion] if @homework_detail_programing
# 最终成绩组成
if params[:homework_final_mode] && params[:homework_final_mode].to_i != @homework_detail_manual.final_mode
@homework_detail_manual.final_mode = params[:homework_final_mode].to_i
if params[:homework_final_mode].to_i == 0
@homework_detail_manual.te_proportion = params[:te_proportion]
@homework_detail_manual.ta_proportion = params[:ta_proportion]
@homework_detail_programing.ta_proportion = params[:sy_proportion] if @homework_detail_programing
@homework_detail_programing.save if @homework_detail_programing
end
@homework_detail_manual.save if @homework_detail_manual
@homework_detail_programing.save if @homework_detail_programing
@homework.save
@homework = HomeworkCommon.find @homework.id
@homework.student_works.where("work_status != 0").each do |student_work|
# set_final_score @homework,student_work
student_work.save
end
elsif params[:homework_final_mode] && @homework_detail_manual.final_mode == 0
if (params[:te_proportion] && params[:te_proportion].to_s != @homework_detail_manual.te_proportion.to_s) || (params[:ta_proportion] && params[:ta_proportion].to_s != @homework_detail_manual.ta_proportion.to_s) || (@homework_detail_programing && @homework_detail_programing.ta_proportion.to_s != params[:sy_proportion].to_s)
@homework_detail_manual.te_proportion = params[:te_proportion]
@homework_detail_manual.ta_proportion = params[:ta_proportion]
@homework_detail_programing.ta_proportion = params[:sy_proportion] if @homework_detail_programing
@homework_detail_manual.save if @homework_detail_manual
@homework_detail_programing.save if @homework_detail_programing
@homework.save
@homework = HomeworkCommon.find @homework.id
@homework.student_works.where("work_status != 0").each do |student_work|
# set_final_score @homework,student_work
student_work.save
end
end
end
end
if @homework.homework_type == 4
@homework.work_efficiency = params[:work_efficiency] ? 1 : 0
if params[:eff_score] != @homework.eff_score
@homework.eff_score = params[:eff_score]
score_change = true
end
if @homework_detail_manual.answer_open_evaluation != params[:answer_open_evaluation].to_i
@homework_detail_manual.answer_open_evaluation = params[:answer_open_evaluation].to_i
score_change = true
end
if @homework_detail_manual.shixun_evaluation != params[:shixun_evaluation].to_i
@homework_detail_manual.shixun_evaluation = params[:shixun_evaluation].to_i
score_change = true
end
if params[:challenge]
score_change = true
params[:challenge].each_with_index do |challenge_id, index|
setting = @homework.homework_challenge_settings.where(:challenge_id => challenge_id).first
if setting
setting.update_attributes(:score => params[:score][index])
else
HomeworkChallengeSetting.create(:homework_common_id => @homework.id, :challenge_id => challenge_id, :shixun_id => @homework.homework_commons_shixuns.shixun_id, :score => params[:score][index])
if @homework.homework_type == 4
@homework.work_efficiency = params[:work_efficiency] ? 1 : 0
if params[:eff_score] != @homework.eff_score
@homework.eff_score = params[:eff_score]
score_change = true
end
if @homework_detail_manual.answer_open_evaluation != params[:answer_open_evaluation].to_i
@homework_detail_manual.answer_open_evaluation = params[:answer_open_evaluation].to_i
score_change = true
end
if @homework_detail_manual.shixun_evaluation != params[:shixun_evaluation].to_i
@homework_detail_manual.shixun_evaluation = params[:shixun_evaluation].to_i
score_change = true
end
if params[:challenge]
score_change = true
params[:challenge].each_with_index do |challenge_id, index|
setting = @homework.homework_challenge_settings.where(:challenge_id => challenge_id).first
if setting
setting.update_attributes(:score => params[:score][index])
else
HomeworkChallengeSetting.create(:homework_common_id => @homework.id, :challenge_id => challenge_id, :shixun_id => @homework.homework_commons_shixuns.shixun_id, :score => params[:score][index])
end
end
@homework.homework_challenge_settings.where("challenge_id not in (#{params[:challenge].join(',')})").destroy_all
end
@homework.homework_challenge_settings.where("challenge_id not in (#{params[:challenge].join(',')})").destroy_all
end
@homework.score_open = params[:homework_score_open] ? 1 : 0
@homework.save!
if score_change
homework_challenge_settings = HomeworkChallengeSetting.where(:homework_common_id => @homework.id)
@homework.student_works.where("work_status != 0").each do |student_work|
set_shixun_final_score student_work, @homework_detail_manual.answer_open_evaluation, homework_challenge_settings
@homework.score_open = params[:homework_score_open] ? 1 : 0
@homework.save!
if score_change
homework_challenge_settings = HomeworkChallengeSetting.where(:homework_common_id => @homework.id)
@homework.student_works.where("work_status != 0").each do |student_work|
set_shixun_final_score student_work, @homework_detail_manual.answer_open_evaluation, homework_challenge_settings
end
# 更新所有学生的效率分
update_student_eff_score HomeworkCommon.where(:id => @homework.id).first
end
# 更新所有学生的效率分
update_student_eff_score HomeworkCommon.where(:id => @homework.id).first
else
@homework.work_public = params[:homework_work_public] ? 1 : 0
@homework.score_open = params[:homework_score_open] ? 1 : 0
@homework.answer_public = params[:homework_answer_public] ? 1 : 0
@homework.comment_public = params[:homework_comment_public] ? 1 : 0
@homework.save!
end
else
@homework.work_public = params[:homework_work_public] ? 1 : 0
@homework.score_open = params[:homework_score_open] ? 1 : 0
@homework.answer_public = params[:homework_answer_public] ? 1 : 0
@homework.comment_public = params[:homework_comment_public] ? 1 : 0
@homework.save!
end
@homework_detail_manual.save
if create_homework_user.present?
if group_id.present? && group_id.size != 0
if group_id.size == @course.course_groups.count
create_works_tiding @homework, @course.student
@homework_detail_manual.save
if create_homework_user.present?
if group_id.present? && group_id.size != 0
if group_id.size == @course.course_groups.count
create_works_tiding @homework, @course.student
else
members = @course.members.where(:course_group_id => group_id)
create_works_tiding @homework, members
end
else
members = @course.members.where(:course_group_id => group_id)
create_works_tiding @homework, members
create_works_tiding @homework, @course.student
end
else
create_works_tiding @homework, @course.student
end
end
redirect_to student_work_index_path(:homework => @homework.id)
@ -671,6 +676,7 @@ class HomeworkCommonController < ApplicationController
def destroy
if @homework.destroy
StudentWork.where(:homework_common_id => @homework.id).destroy_all
#更新CourseHomeworkStatistics中每个学生的未交作品数、已交作品数、迟交作品数
# hw_count = @course.homework_commons.includes(:homework_detail_manual).where("homework_detail_manuals.comment_status > 0").count
# homework_ids = @course.homework_commons.empty? ? "(-1)" : "(" + @course.homework_commons.map{|hw| hw.id}.join(",") + ")"
@ -928,60 +934,62 @@ class HomeworkCommonController < ApplicationController
end
def publish_homework
if @homework.homework_detail_manual.try(:comment_status) == 0
if params[:group_ids]
if @course.course_groups.where(:id => params[:group_ids].split(",")).count == @course.course_groups.count
@homework.homework_group_settings.destroy_all
@homework.update_attribute("unified_setting", true)
# 发消息
create_works_tiding @homework, @course.student
else
@homework.update_attribute("unified_setting", false)
@course.course_groups.each do |group|
homework_group_setting = @homework.homework_group_settings.where(:course_group_id => group.id).first
unless homework_group_setting
HomeworkGroupSetting.create(:homework_common_id => @homework.id, :course_group_id => group.id, :course_id => @course.id, :publish_time => @homework.publish_time, :end_time => @homework.end_time)
ActiveRecord::Base.transaction do
if @homework.homework_detail_manual.try(:comment_status) == 0
if params[:group_ids]
if @course.course_groups.where(:id => params[:group_ids].split(",")).count == @course.course_groups.count
@homework.homework_group_settings.destroy_all
@homework.update_attribute("unified_setting", true)
# 发消息
create_works_tiding @homework, @course.student
else
@homework.update_attribute("unified_setting", false)
@course.course_groups.each do |group|
homework_group_setting = @homework.homework_group_settings.where(:course_group_id => group.id).first
unless homework_group_setting
HomeworkGroupSetting.create(:homework_common_id => @homework.id, :course_group_id => group.id, :course_id => @course.id, :publish_time => @homework.publish_time, :end_time => @homework.end_time)
end
end
@homework.homework_group_settings.where(:course_group_id => params[:group_ids].split(",")).update_all(:publish_time => Time.now)
@homework.homework_group_settings.where(:course_group_id => params[:group_ids].split(","), :end_time => nil).update_all(:end_time => Time.at(((1.month.since.to_i)/3600.0).ceil * 3600))
# 发消息
members = @course.members.where(:course_group_id => params[:group_ids].split(","))
create_works_tiding @homework, members
end
@homework.homework_group_settings.where(:course_group_id => params[:group_ids].split(",")).update_all(:publish_time => Time.now)
@homework.homework_group_settings.where(:course_group_id => params[:group_ids].split(","), :end_time => nil).update_all(:end_time => Time.at(((1.month.since.to_i)/3600.0).ceil * 3600))
# 发消息
members = @course.members.where(:course_group_id => params[:group_ids].split(","))
create_works_tiding @homework, members
else
@homework.homework_group_settings.destroy_all
create_works_tiding @homework, @course.student
end
else
@homework.homework_group_settings.destroy_all
create_works_tiding @homework, @course.student
end
@homework.update_attribute("publish_time", Time.now)
@homework.update_attribute("publish_time", Time.now)
if @homework.end_time.nil?
@homework.update_attribute("end_time", Time.at(((1.month.since.to_i)/3600.0).ceil * 3600))
elsif HomeworkGroupSetting.where("homework_common_id = #{@homework.id} and end_time is not null").count > 0
@homework.update_attribute("end_time", HomeworkGroupSetting.where("homework_common_id = #{@homework.id} and end_time is not null").map(&:end_time).max)
end
if @homework.end_time.nil?
@homework.update_attribute("end_time", Time.at(((1.month.since.to_i)/3600.0).ceil * 3600))
elsif HomeworkGroupSetting.where("homework_common_id = #{@homework.id} and end_time is not null").count > 0
@homework.update_attribute("end_time", HomeworkGroupSetting.where("homework_common_id = #{@homework.id} and end_time is not null").map(&:end_time).max)
end
=begin
if @homework.archive_time.nil?
@homework.update_attribute("archive_time", Time.at(((2.months.since.to_i)/3600.0).ceil * 3600))
end
=end
@homework.homework_detail_manual.update_attribute('comment_status', 1)
@homework.homework_detail_manual.update_attribute('comment_status', 1)
if @homework.course_acts.size == 0
@homework.course_acts << CourseActivity.new(:user_id => @homework.user_id,:course_id => @homework.course_id)
if @homework.course_acts.size == 0
@homework.course_acts << CourseActivity.new(:user_id => @homework.user_id,:course_id => @homework.course_id)
end
else
@homework.homework_group_settings.where(:course_group_id => params[:group_ids].split(",")).update_all(:publish_time => Time.now)
@homework.homework_group_settings.where(:course_group_id => params[:group_ids].split(","), :end_time => nil).update_all(:end_time => Time.at(((1.month.since.to_i)/3600.0).ceil * 3600))
if HomeworkGroupSetting.where("homework_common_id = #{@homework.id} and end_time is not null").count > 0
@homework.update_attribute("end_time", HomeworkGroupSetting.where("homework_common_id = #{@homework.id} and end_time is not null").map(&:end_time).max)
end
# 发消息
members = @course.members.where(:course_group_id => params[:group_ids].split(","))
create_works_tiding @homework, members
end
else
@homework.homework_group_settings.where(:course_group_id => params[:group_ids].split(",")).update_all(:publish_time => Time.now)
@homework.homework_group_settings.where(:course_group_id => params[:group_ids].split(","), :end_time => nil).update_all(:end_time => Time.at(((1.month.since.to_i)/3600.0).ceil * 3600))
if HomeworkGroupSetting.where("homework_common_id = #{@homework.id} and end_time is not null").count > 0
@homework.update_attribute("end_time", HomeworkGroupSetting.where("homework_common_id = #{@homework.id} and end_time is not null").map(&:end_time).max)
if @homework.end_time > Time.now && @homework.homework_detail_manual.try(:comment_status) > 1
@homework.homework_detail_manual.update_attribute("comment_status", 1)
end
# 发消息
members = @course.members.where(:course_group_id => params[:group_ids].split(","))
create_works_tiding @homework, members
end
if @homework.end_time > Time.now && @homework.homework_detail_manual.try(:comment_status) > 1
@homework.homework_detail_manual.update_attribute("comment_status", 1)
end
redirect_to student_work_index_path(:homework => @homework.id)
end
@ -1031,7 +1039,8 @@ class HomeworkCommonController < ApplicationController
def end_homework
time = Time.now
student_works = @homework.student_works.where("0=1")
# if @homework.homework_detail_manual.try(:comment_status) == 1 && @homework.end_time > time
ActiveRecord::Base.transaction do
# if @homework.homework_detail_manual.try(:comment_status) == 1 && @homework.end_time > time
if params[:group_ids]
# @homework.homework_group_settings.where(:course_group_id => params[:group_id]).where("publish_time > '#{Time.now}' or publish_time is null").update_all(:publish_time => time)
@homework.homework_group_settings.where(:course_group_id => params[:group_ids].split(",")).update_all(:end_time => time)
@ -1068,7 +1077,9 @@ class HomeworkCommonController < ApplicationController
# 更新所有学生的效率分
update_student_eff_score HomeworkCommon.where(:id => @homework.id).first
end
# end
# end
end
redirect_to student_work_index_path(:homework => @homework.id)
end
@ -1347,7 +1358,7 @@ class HomeworkCommonController < ApplicationController
def find_homework
@homework = HomeworkCommon.find params[:id]
@homework_detail_manual = @homework.homework_detail_manual
@homework_detail_programing = @homework.homework_detail_programing
# @homework_detail_programing = @homework.homework_detail_programing
@homework_detail_group = @homework.homework_detail_group
@course = @homework.course
rescue

@ -0,0 +1,5 @@
class Managements::BaseController < ApplicationController
layout 'base_management'
before_filter :require_business
end

@ -0,0 +1,82 @@
class Managements::SchoolsController < Managements::BaseController
before_filter :set_navigation_bar
before_filter :contrast_column_select_options, only: [:data_contrast]
def statistics
@sub_type = 1
params[:sort_by] = params[:sort_by].presence || :teacher_count
params[:sort_direction] = params[:sort_direction].presence || :desc
service = Management::SchoolReportService.new(params)
@obj_count, @schools = service.call
@obj_pages = Paginator.new(@obj_count, 20, params[:page])
respond_to do |format|
format.html { load_statistic_total }
format.js
end
end
def data_grow
@sub_type = 2
params[:data_type] ||= 'grow'
params[:sort_by] = params[:sort_by].presence || :teacher_increase_count
params[:sort_direction] = params[:sort_direction].presence || :desc
service = Management::SchoolDataGrowService.new(params)
@grow_summary = service.grow_summary
@obj_count, @reports = service.call
@obj_pages = Paginator.new(@obj_count, 20, params[:page])
end
def data_contrast
params[:contrast_column] = params[:contrast_column].presence || :teacher_increase_count
params[:sort_direction] ||= :desc
params[:sort_by] = :percentage
# 无对比日期时直接返回无数据页面
if useless_contrast_date_parameter?
@obj_count, @reports = 0, []
return
end
@obj_count, @reports = Management::SchoolDataContrastService.new(params).call
@obj_pages = Paginator.new(@obj_count, 20, params[:page])
rescue Management::SchoolDataContrastService::ParameterError
raise '参数错误'
end
def statistics_xlsx
params[:per_page] = 10000
_count, @schools = Management::SchoolReportService.new(params).call
filename = ['学校统计总表', params[:keyword], Time.zone.now.strftime('%Y%m%d%H%M%S')].join('-') << '.xlsx'
render xlsx: 'statistics_xlsx', filename: filename
end
private
def set_navigation_bar
@menu_type = 1
end
def contrast_column_select_options
@select_options = Management::SchoolDataContrastService::CONTRAST_COLUMN_LIST.map do |column|
[I18n.t("school_daily_report.#{column}"), column]
end
end
def useless_contrast_date_parameter?
params[:begin_date].blank? && params[:end_date].blank? &&
params[:other_begin_date].blank? &&params[:other_end_date].blank?
end
def load_statistic_total
@teacher_total = User.teacher.count
@student_total = User.student.count
@course_total = Course.count
@active_course_total = Course.where(is_end: false).count
@shixun_homework_total = HomeworkCommon.where(homework_type: 4).count
@other_homework_total = HomeworkCommon.where(homework_type: [1, 3]).count
end
end

@ -1,6 +1,12 @@
# encoding: utf-8
class ManagementsController < ApplicationController
before_filter :require_admin
before_filter :require_business
before_filter :require_admin, :only => [:shixun_setting_list, :mirror_repository, :mirror_picture_shixuns, :editmd_template,
:editmd_template, :subject_level_system, :subject_setting_list, :auto_users_trial,
:evaluate_records, :identity_authentication, :identity_authentication, :professional_authentication,
:shixun_authorization, :graduation_standard, :ec_template, :codemirror_template,
:course_guide_template, :shixun_quality_score, :tech_system, :update_notice, :setting_banner,
:training_2018]
layout 'base_management'
include ManagementsHelper
include SortHelper
@ -63,7 +69,6 @@ class ManagementsController < ApplicationController
# 工程认证视频导入模板
def ec_template
@template = EcTemplate.where(nil)
end
def add_template
@ -158,7 +163,11 @@ class ManagementsController < ApplicationController
@sub_type = 8
@g = Gitlab.client
if params[:search]
myshixun_id = Game.where(:identifier => params[:search]).pluck(:myshixun_id)
if params[:search].to_i.to_s == params[:search].to_s
myshixun_id = Game.where(:myshixun_id => params[:search].to_i).pluck(:myshixun_id)
else
myshixun_id = Game.where(:identifier => params[:search]).pluck(:myshixun_id)
end
@myshixuns = Myshixun.where(:id => myshixun_id).includes(:shixun)
else
@myshixuns = Myshixun.where("0=0").includes(:shixun)
@ -193,6 +202,7 @@ class ManagementsController < ApplicationController
if request.post?
@user.nickname = params[:nickname]
@user.lastname = params[:lastname]
@user.business = params[:business].to_i
@user.firstname = ""
@user.mail = params[:mail].strip == "" ? nil : params[:mail]
@user.phone = params[:phone].strip == "" ? nil : params[:phone]
@ -791,7 +801,24 @@ class ManagementsController < ApplicationController
def shixun_feedback_message
@menu_type = 8
@sub_type = 2
@discusses = Discuss.where(:dis_type => "Shixun").reorder("created_at desc")
@search = params[:search]
@beginTime = params[:beginTime]
@endTime = params[:endTime]
if @search.present?
shixun_ids = Shixun.where("name like ?", "%#{params[:search]}%").pluck(:id)
@discusses = Discuss.where(:dis_type => "Shixun", :dis_id => shixun_ids).reorder("created_at desc")
else
@discusses = Discuss.where(:dis_type => "Shixun").reorder("created_at desc")
end
if params[:beginTime] && params[:beginTime].strip != ""
@discusses = @discusses.where("created_at >= '#{Time.parse(params[:beginTime])}'")
end
if params[:endTime] && params[:endTime].strip != ""
@discusses = @discusses.where("created_at <= '#{Time.parse(params[:endTime])}'")
end
@all_discusses = @discusses
@discusses_count = @discusses.count
@limit = 20
@is_remote = true
@ -802,6 +829,11 @@ class ManagementsController < ApplicationController
respond_to do |format|
format.js
format.html
format.xls{
shixun_ids = @all_discusses.pluck(:dis_id).uniq
filename = "#{Time.now.strftime("%Y%m%d")}-实训反馈.xls"
send_data(shixun_feedback_xls(shixun_ids, @beginTime, @endTime), :type => "text/excel;charset=utf-8; header=present", :filename => filename_for_content_disposition(filename))
}
end
end
@ -819,6 +851,15 @@ class ManagementsController < ApplicationController
@front_js = eva.front_js
end
def evaluate_simple
page = params[:page]
@recodes = EvaluateRecord.where("created_at > ?", Time.now - 1.days).reorder("consume_time desc")
@recodes_count = @recodes.size
@record_pages = Paginator.new @recodes_count, 20, page || 1
@offset ||= @record_pages.offset
@recodes = paginateHelper @recodes, 20
end
# 评测时间列表
def evaluate_records
shixun_tomcat = Redmine::Configuration['shixun_tomcat']
@ -834,7 +875,7 @@ class ManagementsController < ApplicationController
keyword = params[:keyword]
limit = 20
if search
if search.present?
if "u_name" == keyword
@evaluate_recods = EvaluateRecord.joins("join users u on evaluate_records.user_id = u.id").where("concat(u.lastname, u.firstname) like '%#{search}%'")
# @evaluate_recods = EvaluateRecord.where(user_id: User.where("concat(lastname, firstname) like '%#{search}%'").pluck(:id))
@ -843,7 +884,12 @@ class ManagementsController < ApplicationController
# @evaluate_recods = EvaluateRecord.where(user_id: UserExtensions.where(school_id: School.where("name like '%#{search}%'").pluck(:id)).pluck(:user_id))
end
else
@evaluate_recods = EvaluateRecord.where("0=0")
@evaluate_recods = EvaluateRecord.where(nil)
end
if params[:beginTime].present?
endTime = params[:endTime].present? ? params[:endTime] : Time.now
@evaluate_recods = @evaluate_recods.where("created_at >= ? and created_at <= ?", params[:beginTime], endTime)
end
@evaluate_recods_count = @evaluate_recods.count
@ -979,7 +1025,7 @@ class ManagementsController < ApplicationController
end
@courselist = @courselist.reorder("created_at desc")
@courselist_count = @courselist.count
@limit = 15
@is_remote = true
@page = params['page'] ? params['page'].to_i : 1
@ -1159,6 +1205,143 @@ end
end
end
def partners
@menu_type = 6
@sub_type = 3
if params[:search].blank?
@partners = Partner.includes(:school).order("partners.created_at desc")
else
@partners = Partner.includes(:school).where("schools.name like ? ", "%#{params[:search]}%").order("partners.created_at desc")
end
@current_partner = nil
if params[:partner]
@current_partner = @partners.find params[:partner]
else
@current_partner = @partners[0] if @partners.size > 0
end
respond_to do |format|
format.js
format.html
end
end
def get_partner
@partner = Partner.find partner
end
def delete_partner
partner = Partner.find params[:partner_id]
partner.destroy
@partners = Partner.includes(:school).order("partners.created_at desc")
@current_partner = nil
end
# 添加客户
def customers_list
@search = params[:search]
@province = params[:province]
partner_id = params[:partner_id]
@partner = Partner.find partner_id
@customers = @partner.customers
existed_school_ids = @customers.pluck(:school_id)
existed_school_ids = existed_school_ids.present? ? existed_school_ids.join(",") : -1
@schools = School.where("id not in (#{existed_school_ids})")
if params[:search]
@schools = @schools.where("name like ?", "%#{@search}%")
end
if params[:province] && params[:province] != '0'
@schools = @schools.where("province like ?", "%#{@province}%")
end
@limit = 10
@page = params[:page] || 1
@schools_count = @schools.count
@total_pages = (@schools_count / 10.0).ceil
@schools = paginateHelper @schools, @limit
respond_to do |format|
format.js
format.json {
render json: @schools
}
end
end
def add_customers
school_ids = params[:school_ids]
partner_id = params[:partner_id]
if school_ids.length > 0 && partner_id.present?
school_ids.each do |s|
school = School.where("id = ?",s).first
if school.present?
customer = Customer.new(school_id: s)
customer.save!
PartnerCustomer.create!(partner_id: partner_id,customer_id: customer.id )
school.update_attributes(customer_id: customer.id)
end
end
render :json => {status: 1, message: "创建成功!"}
end
end
def delete_customers
if params[:customer]
customer = Customer.find(params[:customer])
@current_partner = Partner.find(params[:partner_id])
customer.destroy
end
end
# 添加合作伙伴弹框数据
def all_partners
@search = params[:search]
@province = params[:province]
# 已经选过的合作伙伴不能再再列表中显示
used_school_ids = Partner.pluck(:school_id)
used_school_ids = used_school_ids.blank? ? -1 : used_school_ids.join(",")
@schools = School.where("id not in (#{used_school_ids})")
if params[:search]
@schools = @schools.where("name like ?", "%#{@search}%")
end
if params[:province] && params[:province] != '0'
@schools = @schools.where("province like ?", "%#{@province}%")
end
@limit = 10
@page = params[:page] || 1
@schools_count = @schools.count
@total_pages = (@schools_count / 10.0).ceil
@schools = paginateHelper @schools, @limit
respond_to do |format|
format.js
format.json {
render json: @schools
}
end
end
def add_partner
school_ids = params[:school_ids]
if school_ids.length > 0
school_ids.each do |s|
old_partner = Partner.where(:school_id => s)
if old_partner.blank?
partner = Partner.new(school_id: s)
partner.save
end
end
end
render :json => {status: 1, message: "创建成功!"}
end
# 删除部门管理员
def delete_depart_member
DepartmentMember.where(:department_id => params[:depart], :user_id => params[:user_id]).destroy_all
@ -1186,8 +1369,55 @@ end
@department.department_members << DepartmentMember.new(:user_id => member)
end
end
redirect_to partners_managments_path
# respond_to do |format|
# format.html {render :layout => "base_edu"}
# format.js
# end
end
# 添加合作伙伴管理员- 弹框
def add_partner_member_box
@partner = Partner.where(:id => params[:partner]).first
@members =
if params[:search]
User.where("LOWER(concat(lastname, firstname, nickname, mail)) LIKE '%#{params[:search]}%' AND partner_id is NULL")
else
User.where(:certification => 1, :partner_id => nil )
end
@total_pages = (@members.count / 10.0).ceil
@members = paginateHelper @members, 10
respond_to do |format|
format.js
format.json {
render json: member_json_data(@members)
}
end
end
# 合作伙伴添加管理员
def add_partner_member
if params[:partner] && params[:partner_member]
@partner = Partner.find_by_id params[:partner]
params[:partner_member].each do |member|
user = User.find_by_id member
user.update_attributes(partner_id: @partner.id) if !@partner.nil? && !user.nil?
end
end
end
# 合作伙伴删除管理员
def delete_partner_member
if params[:partner] && params[:partner_member]
@partner = Partner.find_by_id params[:partner]
user = User.find_by_id params[:partner_member]
user.update_attributes(partner_id: nil) if !@partner.nil? && !user.nil?
end
end
# check 部门 identifier是否重复
def check_depart_identifier
logger.info("###############{params}")
@ -1201,7 +1431,8 @@ end
def update_depart_identifier
if params[:depart] && params[:identifier]
@department = Department.where(:id => params[:depart]).first
@department.update_attributes(:identifier => params[:identifier]) if @department.present?
identifier = params[:identifier].strip.blank? ? nil : params[:identifier].strip
@department.update_attributes(:identifier => identifier) if @department.present?
end
end
@ -1287,7 +1518,7 @@ end
if search.blank?
@schools = School.where("0=0")
else
@schools = School.where("name like '%#{search}%'")
@schools = School.where("name like ?", "%#{search}%")
end
if params[:index] == '8'
@schools = @schools.reorder("created_at #{@sx_order}")
@ -1356,6 +1587,7 @@ end
after_dep = Department.where(:school_id => params[:school_id], :name => department.name).first
if after_dep
UserExtensions.where(:school_id => params[:applied_id], :department_id => department.id).update_all(:department_id => after_dep.id)
department.apply_add_departments.destroy_all
department.destroy
else
department.apply_add_departments.update_all(:school_id => params[:school_id])
@ -1796,7 +2028,7 @@ end
@school_id = params[:school_id]
if params[:school_id] && params[:school_id] != ''
@courses = Course.joins("join users u on courses.tea_id = u.id").joins("join user_extensions ue on u.id = ue.user_id").where("ue.school_id = #{params[:school_id]}")
@courses = @courses.joins("join user_extensions ue on courses.tea_id = ue.user_id").where("ue.school_id = #{params[:school_id]}")
end
if params[:homepage_show]
@ -1819,7 +2051,7 @@ end
user_id = User.where("concat(lastname, firstname) like '%#{@search}%'")
@courses = @courses.joins("join users u on courses.tea_id = u.id").where("concat(u.lastname, u.firstname) like '%#{@search}%'")
end
else
elsif "dep_name" == @keyword
school = School.where("name like '%#{@search}%'").map(&:id)
@courses = @courses.where(:school_id => school)
# @courses= @courses.where("name like '%#{@search}%'")
@ -2104,25 +2336,36 @@ end
condition = (params[:research_condition].nil? || params[:research_condition] == "name") ? "concat(lastname, firstname)" : params[:research_condition]
if 0 == status
if params[:research_condition] == "phone" && params[:research_contents].blank?
@users = User.order("#{@order_key} #{@us_order}")
@users = User.where(nil)
else
@users = User.where("#{condition} like '%#{params[:research_contents]}%'").order("#{@order_key} #{@us_order}")
@users = User.where("#{condition} like '%#{params[:research_contents]}%'")
end
else
if params[:research_condition] == "phone" && params[:research_contents].blank?
@users = User.where(:status => status).order("#{@order_key} #{@us_order}")
@users = User.where(:status => status)
else
@users = User.where("status = #{status} and #{condition} like '%#{params[:research_contents]}%'").order("#{@order_key} #{@us_order}")
@users = User.where("status = #{status} and #{condition} like '%#{params[:research_contents]}%'")
end
end
if params[:identity] && params[:identity].to_i != -1
@users = @users.includes(:user_extensions).where("user_extensions.identity = ?", params[:identity].to_i)
end
if params[:auto_school] && params[:auto_school].to_i != 0
@users = @users.includes(:user_extensions => [:school]).where("schools.auto_users_trial = ?", params[:auto_school].to_i == 1 ? 1 : 0)
end
if params[:school] && params[:school] != ''
school_name = params[:school]
school = School.where("name like '%#{school_name}%'")
school_id = school.map(&:id)
user_id = UserExtensions.where(:school_id => school_id).map(&:user_id)
@users = @users.where(:id => user_id).order("#{@order_key} #{@us_order}")
@users = @users.where(:id => user_id)
end
@users = @users.order("#{@order_key} #{@us_order}")
@page = (params['page'] || 1).to_i
@users_count = @users.count
@limit = 20
@ -2700,7 +2943,7 @@ end
attachment.save
path = attachment.disk_directory
name = attachment.disk_filename
if name.split(".").last == "xls" || name.split(".").last == "xlsx"
if name.split(".").last == "xlsx"
# lists = readXlsData("files/baolong.xlsx")
lists = readXlsData("files/#{path}/#{name}")
school_id = nil
@ -3129,7 +3372,7 @@ end
end
@users = User.where(:id => user_id).where("#{sql}").includes(:apply_actions, user_extensions: [:department, :school]).order("last_login_on desc")
@xls_users = @users #导出excel用户
@xls_users = @users.reorder("created_on desc").limit(3000) #导出excel用户
@page = (params['page'] || 1).to_i
@users_count = @users.count
@limit = 20
@ -3183,28 +3426,49 @@ end
def trial_authorization
@menu_type =10
@sub_type = 2
search = params[:search]
name_search = params[:search]
@status = trial_authorization_status(params[:status])
# @status = (params[:status].blank? || params[:status] == "0") ? 0 : [1,2]
if search.blank?
@authorizations = ApplyAction.where(:container_type => "TrialAuthorization", :status => @status).includes(:user)
else
user_id = User.find_by_sql("select id from users where concat(lastname,firstname) like '%#{search}%'")
@authorizations = ApplyAction.where(:container_type => "TrialAuthorization", :status => @status, :user_id => user_id).includes(:user)
user_id = []
search = false
@authorizations = ApplyAction.where(:container_type => "TrialAuthorization", :status => @status)
unless name_search.blank?
new_user_id = User.find_by_sql("select id from users where concat(lastname,firstname) like '%#{name_search}%'").map(&:id)
user_id = user_id.size == 0 ? new_user_id : user_id & new_user_id
search = true
end
if params[:sname] && params[:sname] != ''
if params[:sname] && params[:sname].strip != ''
school_id = School.where("name like '%#{params[:sname]}%'")
user_id = UserExtensions.where(:school_id => school_id).map(&:user_id)
@authorizations = @authorizations.where(:user_id => user_id).order("updated_at desc")
new_user_id = UserExtensions.where(:school_id => school_id).map(&:user_id)
user_id = user_id.size == 0 ? new_user_id : user_id & new_user_id
search = true
end
if params[:identity] && params[:identity].to_i != -1
new_user_id = UserExtensions.where(:identity => params[:identity].to_i).map(&:user_id)
user_id = user_id.size == 0 ? new_user_id : user_id & new_user_id
search = true
end
if params[:auto_school] && params[:auto_school].to_i != 0
school_id = School.where(auto_users_trial: params[:auto_school].to_i == 1 ? 1 : 0)
new_user_id = UserExtensions.where(:school_id => school_id).map(&:user_id)
user_id = user_id.size == 0 ? new_user_id : user_id & new_user_id
search = true
end
@authorizations = user_id.size == 0 && !search ? @authorizations.order("updated_at desc") : @authorizations.where(:user_id => user_id.uniq).order("updated_at desc")
@autu_count = @authorizations.count
@limit = 15
@is_remote = true
@autu_pages = Paginator.new @autu_count, @limit, params['page'] || 1
@offset ||= @autu_pages.offset
@authorizations = paginateHelper @authorizations, @limit
@authorizations = @authorizations.includes(:user)
respond_to do |format|
format.js
format.html
@ -3227,7 +3491,7 @@ end
type = params[:type]
search = params[:search]
if type == "0"
authentication_user = AuthenticationsUsers.where(:user_id => apply_action.user_id).first
authentication_user = AuthenticationsUsers.where(user_id: apply_action.user_id).first
if authentication_user.blank?
AuthenticationsUsers.create(:user_id => apply_action.user_id, :authentication_id => 1)
end
@ -3258,17 +3522,21 @@ end
Tiding.create(:user_id => apply_action.user_id, :trigger_user_id => 0, :container_id => apply_action.id, :container_type => 'ApplyAction',
:parent_container_id => apply_action.container_id, :parent_container_type => apply_action.container_type, :belong_container_id => apply_action.container_id, :belong_container_type => "User", :tiding_type => "System", :status => type == "0" ? 1 : 2)
apply_action.update_attributes(:status => (params[:type] == "1" ? 2 : 1), :reason => params[:reject_reason], :dealer_id => User.current.id, :noticed => false)
reject_reason = Array(params[:reasons]).join('')
apply_action.update_attributes(status: (params[:type] == "1" ? 2 : 1), reason: reject_reason, reject_description: params[:reject_description], dealer_id: User.current.id, noticed: false)
User.where(:id => apply_action.user_id).first.update_attributes(:certification => (params[:type] == "1" ? 2 : 1))
user_id = User.find_by_sql("select id from users where concat(lastname,firstname) like '%#{search}%'")
@authorizations = ApplyAction.where(:container_type => "TrialAuthorization", :status => 0, :user_id => user_id).includes(:user)
@autu_count = @authorizations.count
@limit = 15
@is_remote = true
@autu_pages = Paginator.new @autu_count, @limit, params['page'] || 1
@offset ||= @autu_pages.offset
@authorizations = paginateHelper @authorizations, @limit
if params[:reject_type] != "revocation"
user_id = User.find_by_sql("select id from users where concat(lastname,firstname) like '%#{search}%'")
@authorizations = ApplyAction.where(:container_type => "TrialAuthorization", :status => 0, :user_id => user_id).includes(:user)
@autu_count = @authorizations.count
@limit = 15
@is_remote = true
@autu_pages = Paginator.new @autu_count, @limit, params['page'] || 1
@offset ||= @autu_pages.offset
@authorizations = paginateHelper @authorizations, @limit
end
respond_to do |format|
format.js
end
@ -3387,7 +3655,7 @@ end
apply_user.tidings.where(:tiding_type => "Apply").update_all(:status => 1)
Tiding.create(:user_id => apply_user.user_id ,:trigger_user_id => 0, :container_id => apply_user.id, :container_type => "ApplyUserAuthentication", :belong_container_id => apply_user.user_id, :belong_container_type =>'User', :status => 1, :tiding_type => "System")
@unapproved_user = ApplyUserAuthentication.where(:status => 0, :auth_type => 1).order("updated_at desc")
@unapproved_user_count = @unapproved_user.count
@limit = 15
@ -3859,7 +4127,7 @@ end
sheet1 = book.create_worksheet :name => "sheet"
blue = Spreadsheet::Format.new :color => :blue, :weight => :bold, :size => 10
sheet1.row(0).default_format = blue
sheet1.row(0).concat(["序号","创建者","发布时间", "ID", "实训名称","技术平台","fork源", "实践任务"])
sheet1.row(0).concat(["序号","创建者","发布时间", "ID", "实训名称","技术平台","fork源", "实践任务", "实训链接"])
count_row = 1
shixuns.find_each do |shixun|
sheet1[count_row, 0] = count_row
@ -3870,6 +4138,7 @@ end
sheet1[count_row, 5] = show_shixun_mirror(shixun)
sheet1[count_row, 6] = shixun.fork_identifier
sheet1[count_row, 7] = shixun.challenges.count
sheet1[count_row, 8] = Setting.server_url + shixun_path(shixun)
count_row += 1
end
book.write xls_report
@ -3916,7 +4185,7 @@ end
sheet1.row(0).default_format = blue
sheet1.row(0).concat(["用户姓名","性别","职业","职称","地区"," 单位","子单位","注册时间","最后登录时间","授权"])
count_row = 1
users.find_each do |user|
users.each do |user|
sheet1[count_row,0] = user.try(:show_real_name)
sheet1[count_row,1] = user.sex
sheet1[count_row,2] = user.user_extensions.try(:show_identity)
@ -3939,7 +4208,7 @@ end
sheet1 = book.create_worksheet :name => "course"
blue = Spreadsheet::Format.new :color => :blue, :weight => :bold, :size => 10
sheet1.row(0).default_format = blue
sheet1.row(0).concat(["ID","课堂名称","成员","资源","普通作业"," 实训作业","试卷","私有","状态","创建者单位","创建者","动态时间"])
sheet1.row(0).concat(["ID","课堂名称","成员","资源","普通作业"," 实训作业","试卷","评测次数", "私有","状态","创建者单位","创建者","动态时间","创建时间"])
count_row = 1
courses.each do |course|
school = course.teacher.try(:user_extensions).try(:school).try(:name).blank? ? "--" : course.teacher.school_name
@ -3951,11 +4220,13 @@ end
sheet1[count_row,4] = course.homework_commons.where(:homework_type => 1).count
sheet1[count_row,5] = course.homework_commons.where(:homework_type => 4).count
sheet1[count_row,6] = course.exercises.count
sheet1[count_row,7] = course.is_public.to_i == 1 ? '否' : '是'
sheet1[count_row,8] = course.is_end ? "已结束" : "正在进行"
sheet1[count_row,9] = school
sheet1[count_row,10] = teacher_name
sheet1[count_row,11] = format_time(course.updatetime)
sheet1[count_row,7] = course.evaluate_count
sheet1[count_row,8] = course.is_public.to_i == 1 ? '否' : '是'
sheet1[count_row,9] = course.is_end ? "已结束" : "正在进行"
sheet1[count_row,10] = school
sheet1[count_row,11] = teacher_name
sheet1[count_row,12] = format_time(course.updatetime)
sheet1[count_row,13] = format_time(course.created_at)
count_row += 1
end
book.write xls_report
@ -4013,6 +4284,48 @@ end
return sheet.rows
end
def shixun_feedback_xls shixun_ids, beginTime, endTime
xls_report = StringIO.new
book = Spreadsheet::Workbook.new
sheet1 = book.create_worksheet :name => "实训反馈"
blue = Spreadsheet::Format.new :color => :blue, :weight => :bold, :size => 10
sheet1.row(0).default_format = blue
count_row = 1
shixuns = Shixun.where(:id => shixun_ids).includes(discusses: [:user])
sheet1.row(0).concat(["序号", "实训ID", "实训名称", "实训作者", "作者单位", "评论数", "评论内容", "关卡", "评论者", "评论者职业",
"评论者单位", "评论时间", "社区导师是否已回复"])
shixuns.each_with_index do |shixun, i|
discusses = shixun.discusses.where("user_id != ?", 1)
if beginTime.present?
discusses = discusses.where("created_at >= '#{beginTime}'")
end
if endTime.present?
discusses = discusses.where("created_at <= '#{endTime}'")
end
sheet1[count_row, 0] = i + 1
sheet1[count_row, 1] = shixun.identifier
sheet1[count_row, 2] = shixun.name
sheet1[count_row, 3] = shixun.owner.show_real_name
sheet1[count_row, 4] = shixun.owner.school_name
sheet1[count_row, 5] = discusses.count
discusses.each_with_index do |discuss, j|
user = discuss.user
content = discuss.content.gsub(/<img.*\/>/, "【图片评论】").gsub(/!\[\].+\)/, "【图片评论】")
sheet1[count_row, 6] = strip_html content
sheet1[count_row, 7] = "#{discuss.position}"
sheet1[count_row, 8] = user.show_real_name
sheet1[count_row, 9] = user.identity
sheet1[count_row, 10] = user.school_name
sheet1[count_row, 11] = format_time discuss.created_at
sheet1[count_row, 12] = discuss.children.pluck(:user_id).include?(1) ? "" : ""
count_row += 1
end
#count_row += 1
end
book.write xls_report
xls_report.string
end
def competition_member_xls members, competition
xls_report = StringIO.new
book = Spreadsheet::Workbook.new
@ -4098,7 +4411,7 @@ end
book = Spreadsheet::Workbook.new
sheet1 = book.create_worksheet :name => "已发布实训课程"
count_row = 2
sheet1.row(1).concat(["", "地址", "实训课程名称","章节名称", "实训组成", "关卡数", "状态", "课程等级", "更新时间", "发布时间", ])
sheet1.row(1).concat(["", "地址", "实训课程名称","章节名称", "实训组成", "关卡数", "状态", "实训发布时间", "课程等级", "更新时间", "发布时间", ])
Rails.logger.warn("##########subjects:#{subjects.count}")
subjects.each do |subject|
sheet1[count_row,1] = "paths/"+subject.id.to_s
@ -4111,30 +4424,46 @@ end
sheet1[count_row,4] = "#{s_index + 1}-#{index + 1} #{shixun.name}"
sheet1[count_row,5] = shixun.challenges.count
sheet1[count_row,6] = shixun.shixun_status
sheet1[count_row,7] = shixun.publish_time
if s_index == 0 && index == 0
sheet1[count_row,7] = subject.subject_level_system.try(:name) || "--"
sheet1[count_row,8] = format_time subject.updated_at
sheet1[count_row,9] = format_time subject.publish_time
sheet1[count_row,8] = subject.subject_level_system.try(:name) || "--"
sheet1[count_row,9] = format_time subject.updated_at
sheet1[count_row,10] = format_time subject.publish_time
end
count_row += 1
end
else
if s_index == 0
sheet1[count_row,7] = subject.subject_level_system.try(:name) || "--"
sheet1[count_row,8] = format_time subject.updated_at
sheet1[count_row,9] = format_time subject.publish_time
sheet1[count_row,8] = subject.subject_level_system.try(:name) || "--"
sheet1[count_row,9] = format_time subject.updated_at
sheet1[count_row,10] = format_time subject.publish_time
end
count_row += 1
end
end
else
sheet1[count_row,7] = subject.subject_level_system.try(:name) || "--"
sheet1[count_row,8] = format_time subject.updated_at
sheet1[count_row,9] = format_time subject.publish_time
sheet1[count_row,8] = subject.subject_level_system.try(:name) || "--"
sheet1[count_row,9] = format_time subject.updated_at
sheet1[count_row,10] = format_time subject.publish_time
count_row += 1
end
end
book.write xls_report
xls_report.string
end
def member_json_data mmebers
mmebers.map do |member|
real_name = member.show_real_name
identity = member.identity
school_name = member.school_name
user_phone = member.phone || ""
member.attributes.dup.except("login", "hashed_password", "salt", "status", "mail", "experience", "grade",
"authentication", "professional_certification").merge({real_name: real_name,
identity: identity,
school_name: school_name,
user_phone: user_phone})
end
end
end

@ -141,6 +141,10 @@ class MyController < ApplicationController
# Edit user's account
def account
@user = params[:user_id].nil? ? User.current : User.find(params[:user_id])
ue = @user.user_extensions
if @user.lastname.blank? || ue.try(:identity).nil? || (ue.try(:identity) == 1 && ue.try(:student_id).blank?) || (ue.try(:identity) != 1 && ue.try(:technical_title).blank?) || ue.try(:gender).blank? || ue.try(:school_id).blank?
redirect_to user_info_path
@ -152,7 +156,8 @@ class MyController < ApplicationController
applied_message = AppliedMessage.where(:id => params[:applied_message_id]).first
applied_message.update_attribute(:viewed, true)
end
# @user = User.current
# 认证
@trail_authentication = ApplyAction.where(:user_id => User.current.id, :container_type => "TrialAuthorization").order("created_at desc").first
if @trail_authentication && (@trail_authentication.status == 1 || @trail_authentication.status == 2) && !@trail_authentication.noticed

@ -1,10 +1,10 @@
# encoding: utf-8
class MyshixunsController < ApplicationController
layout 'base_myshixun'
skip_before_filter :verify_authenticity_token, :only => [:training_task_status, :close_webssh]
before_filter :require_login, :except => [:training_task_status, :close_webssh]
skip_before_filter :verify_authenticity_token, :only => [:training_task_status, :close_webssh, :code_runinng_message]
before_filter :require_login, :except => [:training_task_status, :close_webssh, :code_runinng_message]
before_filter :check_authentication, :except => [:training_task_status, :close_webssh, :mul_test_home, :mul_test_user,
:mul_test_myshixun, :mul_test_shixun, :mul_test_start]
:mul_test_myshixun, :mul_test_shixun, :mul_test_start, :code_runinng_message]
before_filter :find_myshixun, :only => [:show, :myshixun_reset, :open_webssh, :sync_reset_time, :destroy, :search_file_list, :vnc]
DCODES = %W(2 3 4 5 6 7 8 9 a b c f e f g h i j k l m n o p q r s t u v w x y z)
@ -435,8 +435,39 @@ class MyshixunsController < ApplicationController
end
# 代码运行中的信息接口
def code_runinng_message
begin
logger.info("######################params: #{params}")
jsonTestDetails = JSON.parse(params[:jsonTestDetails])
game_id = jsonTestDetails['buildID']
message = jsonTestDetails['textMsg']
logger.info("##################code_runinng_message:#{jsonTestDetails}")
logger.info("##################buildID: #{game_id}")
logger.info("##################textMsg: #{message}")
if game_id.present? && message.present?
game = Game.find game_id
msg = game.run_code_message
# 只有评测中的game才会创建和更新代码评测中的信息
logger.info("##################game: #{game.status}")
logger.info("##################retry_status: #{game.retry_status}")
if game.status == 1 || game.status == 2
if msg.blank?
RunCodeMessage.create!(:game_id => game_id, :status => 1, :message => message)
else
msg.update_attributes(:status => (msg.status + 1), :message => message)
end
end
render :json => {:data => "success"}
end
rescue Exception => e
render :json => {:data => "failed, exception_message: #{e}"}
end
end
# taskId 即返回的game id
# 返回结果params [:stauts] 0 表示成功,其它则失败
# 返回结果params [:stauts] 0 表示运行结果成功,其它则失败
# compile_success 1 表示成功; 0表示编译失败; -1 表示创建pod失败 -2 表示克隆代码失败
# msg 错误信息
# output 为测试用户编译输出结果
# myshixun:status 1为完成实训
@ -444,7 +475,7 @@ class MyshixunsController < ApplicationController
# resubmit 1表示已通关后重新评测0表示非重新评测
# retry_status 0初始值1重新评测失败2重新评测成功
# tpiRepoPath 中间层图片的workspace路径
# params[:jsonTestDetails] = '{"buildID":"19284","compileSuccess":"1",
# params[:jsonTestDetails] = '{"buildID":"19284","compileSuccess":"1","createPodStatus": "1", "downloadStatus": "1",
# "msg":[{"caseId":"1","expectedOutput":"MSAyIDMNCg","input":"MiAzIDE","output":"MSAyIDMNCg","passed":"1"},
# {"caseId":"2","expectedOutput":"LTMgMSA2DQo","input":"LTMgNiAx","output":"LTMgMSA2DQo","passed":"1"},
# {"caseId":"3","expectedOutput":"LTcgLTUgLTMNCg","input":"LTcgLTMgLTU","output":"LTcgLTUgLTMNCg","passed":"1"}],
@ -462,11 +493,24 @@ class MyshixunsController < ApplicationController
return_back_time = format("%.3f", ( t1.to_f - brige_end_time.to_f)).to_f
status = jsonTestDetails['status']
game_id = jsonTestDetails['buildID']
sec_key = jsonTestDetails['sec_key']
logger.info("training_task_status start#1**#{game_id}**** #{Time.now.strftime("%Y-%m-%d %H:%M:%S.%L")}")
resubmit = jsonTestDetails['resubmit']
outPut = tran_base64_decode64(jsonTestDetails['outPut'])
jenkins_testsets = jsonTestDetails['msg']
compile_success = jsonTestDetails['compileSuccess']
compile_success = jsonTestDetails['compileSuccess']
# # 创建pod的状态 0 失败 1 成功
# create_pod_status = jsonTestDetails['createPodStatus']
# # 克隆代码的装填 0 失败 1 成功
# clone_code_status = jsonTestDetails['downloadStatus']
# # 1表示编译成功0 表示运行异常; -1 表示克隆代码失败; -2 表示创建pod失败
# compile_success = if clone_code_status == "0"
# -1
# elsif create_pod_status == "0"
# -2
# else
# jsonTestDetails['compileSuccess']
# end
# message = Base64.decode64(params[:msg]) unless params[:msg].blank?
logger.info(outPut)
game = Game.find(game_id)
@ -492,7 +536,8 @@ class MyshixunsController < ApplicationController
end
logger.info("#############status: #{status}")
logger.info("#############resubmit: #{resubmit}")
record = EvaluateRecord.where(:game_id => game_id).first
logger.info("sec_key is#############resubmit: #{sec_key}")
record = EvaluateRecord.where(:identifier => sec_key).first
logger.info("training_task_status start#3**#{game_id}**** #{Time.now.strftime("%Y-%m-%d %H:%M:%S.%L")}")
# status0表示评测成功
@ -510,7 +555,7 @@ class MyshixunsController < ApplicationController
challenge.path.split("").each do |path|
game_passed_code(game.id, path, myshixun.try(:gpid), 1)
end
if !game.answer_open && (challenge.shixun.try(:status) > 1) # 如果没有查看答案,则获得该关卡得分
if game.answer_open == 0 && (challenge.shixun.try(:status) > 1) # 如果没有查看答案,则获得该关卡得分
reward_grade(game.user, game.id, 'Game', challenge.score)
reward_experience(game.user, game.id, 'Game', challenge.score)
game.update_attributes!(:final_score => challenge.score)
@ -540,7 +585,7 @@ class MyshixunsController < ApplicationController
logger.info("training_task_status start#4**#{game_id}**** #{Time.now.strftime("%Y-%m-%d %H:%M:%S.%L")}")
render :json => {:data => "success"}
rescue Exception => e
render :json => {:data => "failed"}
render :json => {:data => "failed, errer_message:#{e}"}
logger.error("training_task_status error: #{e}")
raise ActiveRecord::Rollback
end

@ -0,0 +1,233 @@
#encoding: utf-8
class OauthController < ApplicationController
include ApplicationHelper
before_filter :user_setup
before_filter :require_login, only: [:authorize]
skip_before_filter :verify_authenticity_token, only: [:token]
def index
render 'oauth/index', layout: false
end
# 客户端申请认证的URI包含以下参数
#
# response_type表示授权类型必选项此处的值固定为”code”
# client_id表示客户端的ID必选项
# redirect_uri表示重定向URI可选项
# scope表示申请的权限范围可选项
# state表示客户端的当前状态可以指定任意值最好是随机字符串认证服务器会原封不动地返回这个值可防止CSRF攻击
#
# 这个页显示授权页如果授权成功返回redirect_uri+code
#
#
# 服务器回应客户端的URI包含以下参数
#
# code表示授权码必选项。该码的有效期应该很短通常设为10分钟客户端只能使用该码一次 否则会被授权服务器拒绝。该码与客户端ID和重定向URI是一一对应关系。
# state如果客户端的请求中包含这个参数认证服务器的回应也必须一模一样包含这个参数。
def authorize
begin
#参数检查
raise "response_type只能为code" unless params["response_type"] == "code"
raise "client_id为必传项" unless params["client_id"].present?
raise "redirect_uri为必传项" unless params["redirect_uri"].present?
config = OauthConfig.where(client_id: params["client_id"], redirect_uri: params["redirect_uri"]).first
raise "client_id或redirect_uri不正确" unless config
@data = params
if params[:gen_code]
## 检查通过生成code
oauth = Oauth.create!(client_id: config.client_id,
client_secret: config.client_secret,
redirect_uri: config.redirect_uri,
user_id: User.current.id
)
code = oauth.gen_code
redirect_to params["redirect_uri"] + "?code=#{code}&state=#{params[:state]}"
else
render 'oauth/authorize', :layout => 'forge'
end
rescue => e
logger.error e
render :text => e.message
end
end
def test_callback
# 申请 token
#
client_id = "88d893c5a345313e7b8c6fcf23d3d024ee08d5e41ce120c3448b6eea77d8de30"
client_secret = "e9240cc5fc913741db5aea93f2986a8ea0631bb67f7c00e41e491b95d9619e64"
redirect_uri = "http://localhost:3000/oauth/cb"
url = "http://127.0.0.1:3000/oauth/token?grant_type=authorization_code&code=#{params['code']}&redirect_uri=#{redirect_uri}&client_id=#{client_id}&client_secret=#{client_secret}"
render text: url
end
# 客户端向认证服务器申请令牌的HTTP请求包含以下参数
#
# grant_type表示使用的授权模式必选项此处的值固定为”authorization_code”。
# code表示上一步获得的授权码必选项。
# redirect_uri表示重定向URI必选项且必须与A步骤中的该参数值保持一致。
# client_id表示客户端ID必选项。
# client_secret: 表示客户端密钥,必选项。
#
#
# 认证服务器核对了授权码和”重定向URI”确认无误后向客户端发送访问令牌access token和更新令牌refresh token
#
# 认证服务器发送的HTTP回复包含以下内容
#
# access_token表示访问令牌必选项。
# token_type表示令牌类型该值大小写不敏感必选项可以是bearer类型或mac类型。
# expires_in表示过期时间单位为秒。如果省略该参数必须其他方式设置过期时间。
# refresh_token表示更新令牌用来获取下一次的访问令牌可选项。
# scope表示权限范围如果与客户端申请的范围一致此项可省略。
def token
begin
res = {}
if params[:grant_type] == 'authorization_code'
raise "code必传" unless params["code"]
raise "client_id必传" unless params["client_id"]
raise "client_secret必传" unless params["client_secret"]
raise "code错误或已超时" unless Oauth.code_valid?(params["code"])
oauth = Oauth.auth_code(params["code"], params["client_id"], params["client_secret"])
raise "认证不通过" unless oauth
## 生成 token
#
oauth.gen_token
oauth.reload
res = {
access_token: oauth.access_token,
token_type: 'bearer',
expires_in: oauth.token_expires_in,
refresh_token: oauth.refresh_token
}
end
render json: res.to_json
rescue => e
logger.error e
render text: e.message
end
end
def get_userinfo
user = Oauth.auth(params["access_token"])
user_info = {}
if user
user_info = {
token: user.id,
login: user.login,
avatar_url: "https://openi.org.cn/images/" + url_to_avatar(user),
name: user.show_name,
email: user.mail,
allow: (user.login == "guange"||user.phone=='15607313899') ? 1 : 0
}
end
render json: user_info.to_json
end
####--Start-- 获取Openi的授权码access_token以及用户信息。为在openi登录的用户创建相关的educoder用户 ####
IDENTITY_SITE = Redmine::Configuration['openi_domain']
ROOT_URL = Redmine::Configuration['educoder_domain']
DEFAULT_PASSWORD = 'a12345678'.freeze
TOKEN_CALL_BACK = '/oauth/get_token_callback'.freeze
USER_INFO = '/oauth/userinfo'.freeze
def get_code
# 从OpenI发过来的回调中获取授权码
code = params[:code]
# 利用授权码从OpenI这里获取access_token
client = get_client(IDENTITY_SITE)
redirect_uri = "#{ROOT_URL}#{TOKEN_CALL_BACK}"
access_token_hash = client.auth_code.get_token(code, redirect_uri: redirect_uri).to_hash
# 利用access_token获取OpenI的用户信息
access_token = access_token_hash[:access_token]
get_info_url = "#{IDENTITY_SITE}#{USER_INFO}?access_token=#{access_token}"
response = HTTParty.get(get_info_url)
body_json = JSON.parse response.body
openi_user_id = body_json['token']
avatar_url = body_json['avatar_url']
login = body_json['login']
name = body_json['name']
email = body_json['email']
# 根据获取的用户信息来查询数据库如已经存在对应的Educoder用户则直接访问用户要访问的实训页面否则为其创建用户后再访问实训页面
openi = Openi.find_by_login(login)
unless openi
ActiveRecord::Base.transaction do
# 如果Educoder中已存在与该OpenI用户的邮箱相同的用户则会直接跳转到登录educoder的登录页面
existing_user = User.find_by_mail(email)
break if existing_user.present? && email.present?
user = User.new(lastname: name, mail: email, mail_notification: email)
user.login = generate_login('m')
user.password = DEFAULT_PASSWORD
user.certification = 1
user.save!
UserExtensions.create!(user_id: user.id, school_id: School.first.id, identity: 4, gender: 0)
openi = Openi.create!(user_id: user.id, openi_user_id: openi_user_id, avatar_url: avatar_url, login: login, name: name, email: email)
openi.user = user
openi.save!
end
end
self.logged_user = openi.user if openi.present? && openi.user.present?
original_url = params[:original_url]
if User.current.logged?
redirect_to original_url
else
redirect_to signin_path
end
end
def get_token_callback
end
####--End-- 获取Openi的授权码access_token以及用户信息。为在openi登录的用户创建相关的educoder用户 ####
private
# 为新创建的用户随机生成以m为前缀的用户名m表示该用户是用邮箱注册
def generate_login(login_pre)
us = UsersService.new
us.generate_user_login(login_pre)
end
def require_login
require "base64"
if !User.current.logged?
redirect_to '/login?back_url64=' + Base64.urlsafe_encode64(request.original_url)
end
end
include Trustie::Http
end

@ -0,0 +1,29 @@
class PartnersController < ApplicationController
layout 'base_management'
def index
@menu_type = 6
@sub_type = 3
@partners = Partner.includes(:school)
end
def new
end
def edit
end
def create
end
def destroy
end
private
end

@ -9,6 +9,7 @@ class PollController < ApplicationController
before_filter :require_login, :only => [:student_poll_list, :show]
include PollHelper
include ApplicationHelper
def index
if @course.is_public == 0 && !(User.current.member_of_course?(@course)||User.current.admin?)
render_403
@ -18,13 +19,13 @@ class PollController < ApplicationController
if @is_teacher
polls = @course.polls.order("IF(ISNULL(publish_time),0,1), publish_time DESC, created_at DESC")
elsif User.current.member_of_course?(@course)
elsif User.current.member_of_course?(@course) # 课堂成员显示为发布的和已发布的
member = @course.members.where(:user_id => User.current.id).first
if member.try(:course_group_id).to_i == 0
polls = @course.polls.where("publish_time <= '#{Time.now}' and unified_setting = 1").order("IF(ISNULL(publish_time),0,1),publish_time DESC, created_at DESC")
else
else # 已分班的成员
not_poll_ids = @course.poll_group_settings.where("course_group_id = #{member.try(:course_group_id)} and (publish_time > '#{Time.now}' or publish_time is null)")
not_poll_ids = not_poll_ids.blank? ? "(-1)" : "(" + not_poll_ids.map(&:poll_id).join(",") + ")"
not_poll_ids = not_poll_ids.blank? ? "(-1)" : "(" + not_poll_ids.map(&:poll_id).join(",") + ")" # 已分班,但是成员不再
polls = @course.polls.where("publish_time <= '#{Time.now}' and id not in #{not_poll_ids}").order("IF(ISNULL(publish_time),0,1),publish_time DESC, created_at DESC")
end
else
@ -414,7 +415,6 @@ class PollController < ApplicationController
def update_poll_question
@poll_question = PollQuestion.find params[:poll_question]
@poll = @poll_question.poll
@poll_question.is_necessary = params[:is_necessary] == "1" ? 1 : 0
@poll_question.question_title = params[:question_title].nil? || params[:question_title].empty? ? l(:label_enter_single_title) : params[:question_title]
@poll_question.max_choices = params[:max_choices].to_i || 0
@poll_question.min_choices = params[:min_choices].to_i || 0

@ -2,13 +2,17 @@
# REDO: 创建版本库权限控制
class ShixunsController < ApplicationController
layout 'base_shixun'
before_filter :require_login, :except => [:ghook, :download_file]
before_filter :check_authentication, :except => [:ghook, :download_file]
before_filter :require_login, :except => [:ghook, :download_file, :show, :index]
before_filter :check_authentication, :except => [:ghook, :download_file, :show, :index, :operation]
before_filter :find_shixun, :except => [ :index, :new, :create, :index, :search, :shixun_courses, :new_disscuss, :shixun_migrate, :qrcode, :download_file, :departments, :get_mirror_script, :send_message_to_administrator]
skip_before_filter :verify_authenticity_token, :only => [:ghook, :download_file]
before_filter :view_allow, :only => [:show, :collaborators, :propaedeutics, :shixun_discuss, :ranking_list]
before_filter :view_allow, :only => [:collaborators, :propaedeutics, :shixun_discuss, :ranking_list]
before_filter :require_manager, :only => [ :settings, :add_script, :publish, :collaborators_delete, :shixun_members_added, :add_collaborators, :update, :destroy]
before_filter :validation_email, :only => [:new]
before_filter :require_admin, :only => [:destroy]
# 移动云ToC模式权限控制
# before_filter :ecloud_auth, :except => [:show, :index]
include ApplicationHelper
include ShixunsHelper
@ -321,9 +325,15 @@ class ShixunsController < ApplicationController
@search_name = "#{sub.name} / #{tag.name}"
end
shixun_id = ShixunTagRepertoire.where(:tag_repertoire_id => tag).map(&:shixun_id)
@shixuns = Shixun.select([:id, :name, :user_id, :challenges_count, :visits, :status, :myshixuns_count, :trainee, :use_scope, :identifier, :image_text, :averge_star]).where(:id => shixun_id, :hidden => 0).includes(:challenges, :schools, :shixun_members, :users).order("status = 2 desc, publish_time asc")
@shixuns = Shixun.select([:id, :name, :user_id, :challenges_count, :visits, :status, :myshixuns_count,
:trainee, :use_scope, :identifier, :image_text, :averge_star])
.where(:id => shixun_id, :hidden => 0).where("status != -1")
.includes(:challenges, :schools, :shixun_members, :users).order("status = 2 desc, publish_time asc")
else
@shixuns = Shixun.select([:id, :name, :user_id, :challenges_count, :visits, :status, :myshixuns_count, :trainee, :use_scope, :identifier, :image_text, :averge_star]).where(:hidden => 0).includes(:challenges, :schools, :shixun_members, :users).order("status = 2 desc, publish_time asc")
@shixuns = Shixun.select([:id, :name, :user_id, :challenges_count, :visits, :status, :myshixuns_count,
:trainee, :use_scope, :identifier, :image_text, :averge_star])
.where("status != ? and hidden = ?", -1, 0).includes(:challenges, :schools, :shixun_members, :users)
.order("status = 2 desc, publish_time asc")
end
# # 依据tag和语言推荐实训如果tag不够则依据语言推荐语言不够则取系统的三个
# @recommend_shixuns = Shixun.find_by_sql("select challenge_id from challenge_tags where name like
@ -1112,8 +1122,8 @@ class ShixunsController < ApplicationController
g.delete_project(@shixun.gpid) if @shixun.try(:gpid).present?
apply_record = ApplyAction.where(:container_id => @shixun.id, :container_type => "ApplyShixun")
apply_record.delete_all if apply_record
HomeworkCommonsShixuns.where(:shixun_id => @shixun).delete_all # 关联删报错,后续解决
@shixun.destroy
#HomeworkCommonsShixuns.where(:shixun_id => @shixun).delete_all # 关联删报错,后续解决
@shixun.update_attribute(:status, -1)
respond_to do |format|
if params[:come_from] == "admin"
format.html{ redirect_to shixuns_managements_path }
@ -1160,11 +1170,16 @@ class ShixunsController < ApplicationController
end
def get_script_contents
mirrir_script = MirrorScript.find(params[:script_id])
script = mirrir_script.try(:script)
description = mirrir_script.try(:description)
script = modify_shixun_script @shixun, script
render :json => {contents: script, description: description}
if params[:script_id].to_i == -1
render :json => {contents: "", description: ""}
else
mirrir_script = MirrorScript.find(params[:script_id])
script = mirrir_script.try(:script)
description = mirrir_script.try(:description)
script = modify_shixun_script @shixun, script
render :json => {contents: script, description: description}
end
end
def get_common_script
@ -1207,7 +1222,7 @@ class ShixunsController < ApplicationController
# Find shixun of id params[:id]
def find_shixun
@shixun = Shixun.find_by_identifier(params[:id])
render_404 if @shixun.nil?
render_404 if @shixun.nil? || @shixun.status == -1
rescue ActiveRecord::RecordNotFound
render_404
end
@ -1354,4 +1369,8 @@ class ShixunsController < ApplicationController
def validation_email
render_403 if User.current.mail.blank?
end
def validate_shixun
end
end

@ -7,7 +7,7 @@ class StudentWorkController < ApplicationController
require "base64"
helper :attachments
helper :files
before_filter :find_homework, :only => [:new, :index, :create, :homework_discuss, :homework_setting, :student_work_absence_penalty, :absence_penalty_list, :evaluation_list, :program_test,:program_test_ex,
before_filter :find_homework, :only => [:new, :index, :sonar, :create, :homework_discuss, :homework_setting, :student_work_absence_penalty, :absence_penalty_list, :evaluation_list, :program_test,:program_test_ex,
:set_score_rule,:forbidden_anonymous_comment,:delete_work,:new_student_work_project,:student_work_project,:cancel_relate_project,
:search_course_students,:work_canrepeat,:change_project,:relate_myshixun,:shixun_work_export,:import_score,:code_review_results]
before_filter :find_work, :only => [:edit, :update, :show, :destroy, :add_score, :adjust_score, :add_ultimate_score, :praise_student_work, :retry_work, :revise_attachment, :hide_score_detail, :destroy_score,
@ -15,7 +15,7 @@ class StudentWorkController < ApplicationController
before_filter :member_of_course, :only => [:new, :create, :show, :add_score, :praise_student_work, :commit_summary, :view_summary]
before_filter :author_of_work, :only => [:edit, :update, :destroy]
before_filter :teacher_of_course, :only => [:student_work_absence_penalty, :absence_penalty_list, :evaluation_list, :set_score_rule, :forbidden_anonymous_comment, :adjust_score, :add_ultimate_score]
before_filter :require_login, :only => [:index, :show]
before_filter :require_login, :only => [:index, :sonar, :show]
if RUBY_PLATFORM =~ /linux/
require 'roo-xls'
@ -113,7 +113,7 @@ class StudentWorkController < ApplicationController
pass_consume_time += (game.cost_time / 60.0).to_f
end
all_time += (game.cost_time / 60.0).to_f
user_total_score += game.final_score.to_i < 0 ? 0 : game.challenge.score.to_i
user_total_score += game.status == 2 ? game.final_score.to_i < 0 ? 0 : game.challenge.score.to_i : 0
if myshixun.user_id == @work.user.id
@game_user_query << [game.id, game.outputs.first.try(:query_index).to_i]
end
@ -493,7 +493,7 @@ class StudentWorkController < ApplicationController
render :json => resultObj
end
def index
def _index
# REDO:分班信息提前查出来,然后循环中根据匹配去取
@is_teacher = User.current.logged? ? (User.current.allowed_to?(:as_teacher,@course) || User.current.admin?) : false
@ -508,7 +508,7 @@ class StudentWorkController < ApplicationController
end
@tab = params[:tab].nil? ? 1 : params[:tab].to_i
if User.current.member_of_course?(@homework.course) && params[:order].nil? && params[:sort].nil? && params[:name].nil? && params[:group].nil? && params[:page].nil?
if (User.current.member_of_course?(@homework.course) || User.current.admin?) && params[:order].nil? && params[:sort].nil? && params[:name].nil? && params[:group].nil? && params[:page].nil?
if !@course.is_end && @homework.homework_type == 4 && @homework.homework_detail_manual.comment_status > 0 && (@homework.end_time > Time.now || (@homework.end_time <= Time.now && @homework.allow_late))
update_shixun_work_status @homework
end
@ -586,9 +586,9 @@ class StudentWorkController < ApplicationController
if @stundet_works.size != 0
if @order == "student_id"
@stundet_works = @stundet_works.includes(:user => {:user_extensions => []}, :project => {}, :student_works_scores => {}).order("user_extensions.student_id #{@b_sort}")
@stundet_works = @stundet_works.includes(:user => {:user_extensions => []}).order("user_extensions.student_id #{@b_sort}")
else
@stundet_works = @stundet_works.includes(:user => {:user_extensions => []}, :project => {}, :student_works_scores => {}).order("#{@order} #{@b_sort}")
@stundet_works = @stundet_works.order("#{@order} #{@b_sort}")
end
end
@ -608,7 +608,23 @@ class StudentWorkController < ApplicationController
@page = (params['page'] || 1).to_i
@student_work_pages = Paginator.new @student_work_count, @limit, @page
@offset ||= @student_work_pages.offset
end
def index
_index
@stundet_works = paginateHelper @stundet_works, @limit
if @stundet_works.size != 0
@stundet_works = if @homework.homework_type == 1
@stundet_works.includes(:student_works_scores, [user: :user_extensions])
elsif @homework.homework_type == 3
@stundet_works.includes(:student_works_scores, [project: :project_score], [user: :user_extensions])
elsif @homework.homework_type == 4
@stundet_works.includes(:student_works_scores, [myshixun: :games], [user: :user_extensions])
end
@members = @course.members.where(user_id: @stundet_works.pluck(:user_id)).select([:user_id, :course_group_id])
end
respond_to do |format|
format.js
format.html { render :layout => 'base_edu'}
@ -620,6 +636,35 @@ class StudentWorkController < ApplicationController
end
end
def sonar
_index
logger.debug "@stundet_works #{@stundet_works}"
person_list = @stundet_works.map do |work|
o = {
name: "#{work.user.show_real_name}",
uid: "#{work.user.user_extensions.student_id}",
downloadUrl: ''
}
attachment = work.attachments.first
if attachment
o[:downloadUrl] = "https://#{Setting.host_name}/"+download_named_attachment_path(attachment.id, attachment.filename)
end
o
end
respond_to do |format|
format.json {
render json: {
homeworkId: @homework.id,
personList: person_list
}
}
end
end
# 查重详情页面的调分
def adjust_review_score
if params[:score] && params[:challenge_id]
@ -1677,7 +1722,8 @@ class StudentWorkController < ApplicationController
def student_work_project
project = Project.where(:id => params[:projectName].to_i).first
if project.present?
@work = @homework.student_works.where("user_id = #{User.current.id} and work_status = 0").first
@work = @homework.student_works.where("user_id = #{User.current.id} and work_status = 0").first ||
StudentWork.create(homework_common_id: @homework.id, user_id: User.current.id)
if @work
@work.update_column('project_id', params[:projectName].to_i)
end
@ -1841,6 +1887,7 @@ class StudentWorkController < ApplicationController
end
end
private
def hsd_committed_work?(user, homework)

@ -1,9 +1,12 @@
# encoding: utf-8
class SubjectsController < ApplicationController
layout 'base_subject'
before_filter :require_login, :except => [:show]
before_filter :check_authentication, :except => [:show]
# 如要添加或修改before_filter时请将handle_openi_request这个before_filter放至第一位
before_filter :handle_openi_request, if: -> { user_login_and_from_openi? }, only: [:show]
before_filter :require_login, :except => [:show, :index]
before_filter :check_authentication, :except => [:show, :index]
before_filter :find_subject, :except => [:index, :new, :create, :create_subject, :new_subject, :append_to_stage, :send_to_course]
before_filter :require_admin, :only => [:destroy]
include ApplicationHelper
include SubjectsHelper
@ -242,14 +245,56 @@ class SubjectsController < ApplicationController
memberships = params[:membership][:user_ids]
memberships.each do |member|
user = User.find(member)
SubjectMember.create!(:user_id => member, :subject_id => @subject.id, :role => 2)
SubjectMember.create!(:user_id => member, :subject_id => @subject.id, :role => 2,
:position => @subject.subject_members.size + 1)
end
end
end
def delete_member
member = @subject.subject_members.where(:user_id => params[:mem_id]).first
member.destroy if member
if User.current.admin?
ActiveRecord::Base.transaction do
member = @subject.subject_members.where(:id => params[:mem_id]).first
if member.present? && member.role != 1
@subject.subject_members.where("position > #{member.position}").update_all("position = position - 1")
member.destroy
end
end
else
render_403
end
end
def up_member_position
if User.current.member_of_subject?(@subject)
ActiveRecord::Base.transaction do
member = @subject.subject_members.where(:id => params[:mem_id]).first
raise "不能再上移了" if member.position == 1
up_member = @subject.subject_members.where(:position => member.position - 1).first
up_member.update_attribute(:position, member.position)
member.update_attribute(:position, member.position - 1)
end
else
render_403
end
end
def down_member_position
if User.current.member_of_subject?(@subject)
ActiveRecord::Base.transaction do
begin
member = @subject.subject_members.where(:id => params[:mem_id]).first
raise "不能再下移了" if member.position == @subject.subject_members.count
down_member = @subject.subject_members.where(:position => member.position + 1).first
down_member.update_attribute(:position, member.position)
member.update_attribute(:position, member.position + 1)
rescue Exception => e
raise ActiveRecord::Rollback
end
end
else
render_403
end
end
def statistics

@ -54,11 +54,12 @@ class UsersController < ApplicationController
accept_api_auth :index, :show, :create, :update, :destroy, :tag_save, :tag_saveEx
#william
before_filter :require_login, :only => [:tag_save, :tag_saveEx]
before_filter :require_login, :only => [:tag_save, :tag_saveEx, :search_user_course, :search_user_project]
#before_filter :refresh_changests, :only =>[:user_activities,:user_courses,:user_projects,:user_newfeedback]
#visitor
before_filter :recorded_visitor, :only => [:show, :user_fanslist, :user_watchlist, :user_visitorlist]
before_filter :require_admin, :only => [:destroy]
helper :sort
helper :attachments
@ -274,7 +275,7 @@ class UsersController < ApplicationController
# 私信
def private_messages
if User.current == @user || User.current.admin?
if User.current == @user || User.current.admin? || User.current.business?
@onclick_time = User.current.onclick_time.onclick_time
User.current.onclick_time.update_attribute(:onclick_time, Time.now)
@messages = PrivateMessage.find_by_sql("SELECT ui.* FROM (SELECT * FROM private_messages WHERE STATUS != 2 AND user_id = #{@user.id} ORDER BY id DESC) ui GROUP BY ui.target_id ORDER BY ui.send_time DESC")
@ -315,7 +316,7 @@ class UsersController < ApplicationController
end
def message_detail
if User.current == @user || User.current.admin?
if User.current == @user || User.current.admin? || User.current.business?
@target_user = User.where(:id => params[:user_id]).includes(:user_extensions).first
if @target_user.present?
@message_list = @user.private_messages.where(:target_id => params[:user_id], :status => [0, 1]).order("send_time asc")
@ -939,7 +940,7 @@ class UsersController < ApplicationController
@limit = 16
if 1 == @index
# @shixuns_result = Shixun.where(:status => [2,3]).where("name like ?", "%#{@search}%").reorder("created_at desc")
@shixuns_result = Shixun.where("name like ? and hidden=0", "%#{@search}%").reorder("myshixuns_count desc")
@shixuns_result = Shixun.where("name like ? and hidden=0 and status != -1", "%#{@search}%").reorder("myshixuns_count desc")
@shixuns_result_count = @shixuns_result.count
@shixun_pages = Paginator.new @shixuns_result_count, @limit, params['page'] || 1
@offset ||= @shixun_pages.offset
@ -2559,6 +2560,21 @@ class UsersController < ApplicationController
end
end
@objects_count = @objects.size
# 用户访问自己主页的"我管理的"列表,且是第一页才显示新建入口
page = params[:page] ? params[:page].to_i : 1
# 学生身份没有课堂的新建入口
if @user.user_extensions.try(:identity) == 1
@new_icon = @user == User.current && ['a_shixun', 'a_project', 'a_path'].include?(@type) && page == 1
else
@new_icon = @user == User.current && ['a_course', 'a_shixun', 'a_project', 'a_path'].include?(@type) && page == 1
end
# 用户进自己主页的全部列表时有个新建入口,加一个"new"view层的第一页需要shift这样翻页就没问题啦
@objects = @objects.to_a
@objects.unshift("new") if @new_icon
@objects = paginateHelper @objects, 16
respond_to do |format|
@ -2592,6 +2608,7 @@ class UsersController < ApplicationController
def user_info
end
# 连续签到六天则每天累加10个金币
@ -3265,6 +3282,9 @@ class UsersController < ApplicationController
end
def edit
unless User.current.admin?
render_403
end
@auth_sources = AuthSource.all
@membership ||= Member.new
end
@ -3281,6 +3301,9 @@ class UsersController < ApplicationController
end
def update
unless User.current.admin?
render_403
end
@user.admin = params[:user][:admin] if params[:user][:admin]
@user.login = params[:user][:login] if params[:user][:login]
if params[:user][:password].present? && (@user.auth_source_id.nil? || params[:user][:auth_source_id].blank?)

@ -28,6 +28,183 @@ class WelcomeController < ApplicationController
skip_before_filter :check_authentication, :only => [:index]
require 'simple_xlsx_reader'
DCODES = %W(2 3 4 5 6 7 8 9 a b c f e f g h i j k l m n o p q r s t u v w x y z)
def local_init
LocalShixun.delete_all
LocalMirrorRepository.delete_all
LocalShixunTagRepertoire.delete_all
LocalChallenge.delete_all
LocalTestSet.delete_all
LocalChallengeTag.delete_all
render :json => {status: 0, message: "success"}
end
def shixun_to_local
identifiers = params[:identifiers].split(",")
shixuns = Shixun.where(identifier: identifiers)
# 不重复导入
ActiveRecord::Base.transaction do
begin
shixuns.each do |shixun|
if LocalShixun.where(shixun_id: shixun.id).blank?
local_shixun = LocalShixun.create!(name: shixun.name, description: shixun.description, user_id: User.current.id, status: 0,
trainee: shixun.trainee, webssh: shixun.webssh, multi_webssh: shixun.multi_webssh,
can_copy: shixun.can_copy, identifier: generate_identifier, shixun_id: shixun.id,
use_scope: shixun.use_scope, visits: 1, evaluate_script: shixun.evaluate_script,
local_giturl: shixun.git_url)
# 同步镜像
if shixun.mirror_repositories.present?
shixun.mirror_repositories.each do |mirror|
# 本地版的mirror id和线上的可能不一样所以按名字取然后再存
# local_mirror = MirrorRepository.where(type_name: mirror.type_name).first.try(:id)
LocalMirrorRepository.create!(:local_shixun_id => local_shixun.id, :mirror_repository_id => mirror.id, type_name: mirror.type_name)
end
end
# 同步技术标签
shixun.shixun_tag_repertoires.each do |str|
LocalShixunTagRepertoire.create!(:tag_repertoire_id => str.tag_repertoire_id, :local_shixun_id => local_shixun.id)
end
# 不需要同步版本库,版本库应该是从本地导入到线上的时候由线上版本创建的
# 同步复制关卡
if shixun.challenges.present?
shixun.challenges.each do |challenge|
new_challenge = LocalChallenge.new
new_challenge.attributes = challenge.attributes.dup.except("id","shixun_id","user_id", "test_set_score")
new_challenge.local_shixun_id = local_shixun.id
new_challenge.save!
# 评测题,选择题暂时不考虑
# 同步测试集
if challenge.test_sets.present?
challenge.test_sets.each do |test_set|
new_test_set = LocalTestSet.new
new_test_set.attributes = test_set.attributes.dup.except("id","challenge_id")
new_test_set.local_challenge_id = new_challenge.id
new_test_set.save!
end
end
# 同步关卡标签
challenge_tags = ChallengeTag.where("challenge_id =? and challenge_choose_id is null", challenge.id)
if challenge_tags.present?
challenge_tags.each do |challenge_tag|
LocalChallengeTag.create!(:local_challenge_id => new_challenge.id, :name => challenge_tag.try(:name))
end
end
end
end
end
end
render :json => {status: 0, message: "success"}
rescue Exception => e
logger.error("shixun_local_in ##{e.message}")
render :json => {status: -1, message: "error#{e.message}"}
raise ActiveRecord::Rollback
end
end
end
def local_to_shixun
ActiveRecord::Base.transaction do
shixun_list = []
LocalShixun.find_each do |local_shixun|
identifier = generate_identifier
shixun = Shixun.create!(name: local_shixun.name, description: local_shixun.description, user_id: User.current.id,
trainee: local_shixun.trainee, webssh: local_shixun.webssh, multi_webssh: local_shixun.multi_webssh,
can_copy: local_shixun.can_copy, identifier: identifier, reset_time: Time.now,
modify_time: Time.now, use_scope: local_shixun.use_scope, visits: 1, evaluate_script: local_shixun.evaluate_script)
m = ShixunMember.new(:user_id => User.current.id, :role => 1)
shixun.shixun_members << m
# 同步镜像
local_mirrors = LocalMirrorRepository.where(local_shixun_id: local_shixun.id)
if local_mirrors.present?
local_mirrors.each do |local_mirror|
local_mirror_new = MirrorRepository.where(type_name: local_mirror.try(:type_name)).first
ShixunMirrorRepository.create!(:shixun_id => shixun.id, :mirror_repository_id => local_mirror_new.id)
end
end
# 同步技术标签
local_shixun_tags = LocalShixunTagRepertoire.where(local_shixun_id: local_shixun.id)
if local_shixun_tags.present?
local_shixun_tags.each do |str|
ShixunTagRepertoire.create!(:tag_repertoire_id => str.tag_repertoire_id, :shixun_id => shixun.id)
end
end
# 创建版本库
repository = Repository.new
repository.shixun = shixun
repository.type = 'Repository::Gitlab'
repository.identifier = shixun.identifier.downcase
repository.project_id = -1
repository.save!
s = Trustie::Gitlab::Sync.new
s.create_shixun(shixun, repository)
raise "版本库创建失败" if shixun.gpid.blank? # 若和gitlab没同步成功则抛出异常
g = Gitlab.client
shixun.update_column(:git_url, g.project(shixun.gpid).path_with_namespace)
local_git_path = local_shixun.local_giturl.split('/').last if local_shixun.local_giturl.present?
new_giturl = "http://educoder:xinhu1ji2qu3@"+g.project(shixun.gpid).http_url_to_repo.split('//').last
# 如果有目录才执行
if system("cd tmp/repositories/#{local_git_path}")
system("cd tmp/repositories/#{local_git_path};git remote remove origin;git remote add origin #{new_giturl};
git add .;git commit -m '..';git push origin master")
end
# http://Hjqreturn:xinhu1ji2qu3@bdgit.educoder.net/Hjqreturn/pgfqe6ch8.git (fetch)
# 同步关卡信息
local_challenges = LocalChallenge.where(local_shixun_id: local_shixun.id)
if local_challenges.present?
local_challenges.each do |local_challenge|
new_challenge = Challenge.new
new_challenge.attributes = local_challenge.attributes.dup.except("id","local_shixun_id","user_id", "test_set_score")
new_challenge.user_id = User.current.id
new_challenge.shixun_id = shixun.id
new_challenge.save!
# 同步测试集
local_test_sets = LocalTestSet.where(local_challenge_id: local_challenge.id)
if local_test_sets.present?
local_test_sets.each do |local_test_set|
new_test_set = TestSet.new
new_test_set.attributes = local_test_set.attributes.dup.except("id","challenge_id")
new_test_set.challenge_id = new_challenge.id
new_test_set.save!
end
end
# 同步关卡标签
local_challenge_tags = LocalChallengeTag.where(local_challenge_id: local_challenge.id)
if local_challenge_tags.present?
local_challenge_tags.each do |local_challenge_tag|
ChallengeTag.create!(:challenge_id => new_challenge.id, :name => local_challenge_tag.try(:name))
end
end
end
end
shixun_list << shixun.identifier
end
render :json => {status: 0, message: "success", identifier: shixun_list}
end
end
# 生成表示码
def generate_identifier
code = DCODES.sample(8).join
return generate_identifier if Shixun.where(identifier: code).present?
code
end
def index
images = PortalImage.where(status: true).order("position asc")

File diff suppressed because it is too large Load Diff

@ -0,0 +1,2 @@
module CooperatesHelper
end

@ -0,0 +1,2 @@
module EcloudHelper
end

@ -0,0 +1,2 @@
module OauthHelper
end

@ -20,11 +20,11 @@
module PollHelper
def un_commit_num poll
course = poll.course
member = course.members.where(:user_id => User.current.id).first
poll_users = poll.poll_users
student_count = course.student.count
member = course.members.where(:user_id => User.current.id).first ## 当前用户是否为课堂成员
poll_users = poll.poll_users # 问卷的全部用户,包含已回答的/为回答,但是浏览的
student_count = course.student.count # 课堂的学生数
if member.present? && member.teacher_course_groups.count > 0
group_students = course.members.where(:course_group_id => member.teacher_course_groups.pluck(:course_group_id)).map(&:user_id)
group_students = course.members.where(:course_group_id => member.teacher_course_groups.pluck(:course_group_id)).map(&:user_id) ## 统计当前用户所在班级的全部学生
student_count = group_students.size
poll_users = poll_users.where(:user_id => group_students)
end

@ -5,7 +5,7 @@ module ShixunsHelper
def myshixun_exp myshixun
score = 0
myshixun.games.each do |game|
score += game.final_score.to_i < 0 ? 0 : game.challenge.score.to_i
score += game.status == 2 ? game.final_score.to_i < 0 ? 0 : game.challenge.score.to_i : 0
end
score
end

@ -3,67 +3,6 @@ include UserScoreHelper
module StudentWorkHelper
def update_shixun_work_status homework
shixun = homework.homework_commons_shixuns.shixun
student_works = homework.student_works.where(:work_status => 0)
homework_challenge_settings = homework.homework_challenge_settings
challeng_ids = homework_challenge_settings.map(&:challenge_id)
# 取已发布的作品
if homework.unified_setting
student_works = student_works
else
setting = homework.homework_group_settings.where("publish_time < '#{Time.now}'")
if setting.blank?
student_works = student_works.where("0=1")
else
users = homework.course.members.where(:course_group_id => setting.map(&:course_group_id))
student_works = student_works.where(:user_id => users.map(&:user_id))
end
end
# 已发布作品且状态为未提交的作品 如果有开启过实训则更新状态
myshixuns = Myshixun.where(:shixun_id => shixun.id, :user_id => student_works.map(&:user_id))
myshixuns.each do |myshixun|
work = student_works.where(:user_id => myshixun.user_id).first
member = Member.find_by_sql("select course_group_id from members where course_id = #{homework.course_id} and user_id = #{work.user_id}").first
setting_time = homework_group_setting homework, member.try(:course_group_id)
games = myshixun.games.where(:challenge_id => challeng_ids)
myshixun_endtime = games.select{|game| game.status == 2}.size == games.size ? games.map(&:end_time).max : nil
compelete_status = 0
if myshixun_endtime.present? && myshixun_endtime < setting_time.end_time
if myshixun_endtime < setting_time.publish_time
compelete_status = 2
else
compelete_status = 1
end
end
if setting_time.end_time > Time.now
work.update_attributes(:work_status => 1, :late_penalty => 0, :commit_time => myshixun.updated_at, :update_time => myshixun.updated_at, :myshixun_id => myshixun.id, :compelete_status => compelete_status)
else
work.update_attributes(:work_status => ((myshixun.is_complete? && (myshixun.done_time < setting_time.end_time)) ? 1 : 2), :late_penalty => (myshixun.is_complete? && (myshixun.done_time < setting_time.end_time) ? 0 : homework.late_penalty), :commit_time => myshixun.updated_at, :update_time => myshixun.updated_at, :myshixun_id => myshixun.id, :compelete_status => compelete_status)
end
set_shixun_final_score work, homework.homework_detail_manual.answer_open_evaluation, homework_challenge_settings
end
# 更新所有学生的效率分
update_student_eff_score HomeworkCommon.where(:id => homework.id).first
=begin
student_works.each do |work|
if work.work_status == 0
myshixun = Myshixun.where(:shixun_id => shixun.id, :user_id => work.user_id).first
if myshixun
member = Member.find_by_sql("select course_group_id from members where course_id = #{homework.course_id} and user_id = #{User.current.id}").first
setting_time = homework_group_setting homework, member.try(:course_group_id)
if setting_time.end_time > Time.now
work.update_attributes(:work_status => 1, :late_penalty => 0, :commit_time => myshixun.updated_at, :update_time => myshixun.updated_at, :myshixun_id => myshixun.id)
else
work.update_attributes(:work_status => ((myshixun.is_complete? && (myshixun.done_time < setting_time.end_time)) ? 1 : 2), :late_penalty => (myshixun.is_complete? && (myshixun.done_time < setting_time.end_time) ? 0 : homework.late_penalty), :commit_time => myshixun.updated_at, :update_time => myshixun.updated_at, :myshixun_id => myshixun.id)
end
end
end
set_shixun_final_score work, homework.homework_detail_manual.answer_open_evaluation, homework_challenge_settings
end
=end
end
#获取当前用户的项目列表
def user_projects_option
projects = User.current.projects.visible

@ -6,28 +6,36 @@ module SubjectsHelper
end
# 实训路径详情列表,右侧状态显示栏
def shixun_show_in_subject subject_status, shixun_status
content = if subject_status < 2
case shixun_status
when 0, 1
'<span class="fr color-grey-c">暂未公开</span>'
when 2
'<span class="fr color-grey-9">已发布</span>'
when 3
'<span class="fr color-grey-9">已关闭</span>'
end
else
if shixun_status != 2
case shixun_status
when 0, 1
'<span class="fr color-grey-c">暂未公开</span>'
when 3
'<span class="fr color-grey-9">已关闭</span>'
end
else
""
end
end
def shixun_show_in_subject subject_status, shixun_status, shixun_hidden
content = if shixun_hidden
'<span class="fr color-grey-c">暂未公开</span>'
else
if subject_status < 2
case shixun_status
when 0, 1
'<span class="fr color-grey-c">暂未公开</span>'
when 2
'<span class="fr color-grey-9">已发布</span>'
when 3
'<span class="fr color-grey-9">已关闭</span>'
else
""
end
else
if shixun_status != 2
case shixun_status
when 0, 1
'<span class="fr color-grey-c">暂未公开</span>'
when 3
'<span class="fr color-grey-9">已关闭</span>'
else
""
end
else
""
end
end
end
return content.html_safe
end
@ -35,10 +43,10 @@ module SubjectsHelper
def start_shixun_in_subject subject, shixun, myshixun
is_modify = ShixunModify.where(:myshixun_id => myshixun.try(:id), :shixun_id => shixun.try(:id), :status => 1).first
content_before = ''
content = if shixun.status == 2 || User.current.manager_of_shixun?(shixun)
content = if (shixun.status == 2 && !shixun.hidden) || User.current.manager_of_shixun?(shixun)
content_before = "<a href=\"#{shixun_path(shixun)}\" class=\"mr30 color-blue_4C shixun_detail pointer fl none\" target=\"_blank\">查看详情</a>"
if User.current.try(:mail).blank?
%Q{<a class="btn_auto user_bluebg_btn fl none" onclick="sure_box_redirect_without_newtab_btn('#{security_settings_path}', '开启实训,请先绑定邮箱','绑定邮箱');" id = "shixun_operation">开始实战</a>}
%Q{<a class="btn_auto user_bluebg_btn fl none" onclick="sure_box_redirect_without_newtab_btn('#{my_account_path}', '开启实训,请先绑定邮箱','绑定邮箱');" id = "shixun_operation">开始实战</a>}
elsif shixun.challenges_count > 0
if is_modify.blank?
%Q{#{link_to '开始实战', shixun_exec_shixun_path(shixun, :is_subject => subject.id), :class => "btn_auto user_bluebg_btn fl none", :id => "shixun_operation", :target => "_blank"}}

@ -0,0 +1,45 @@
module CustomSortable
extend ActiveSupport::Concern
included do |base|
base.instance_variable_set("@_sort_options", {})
base.instance_variable_set("@_sort_columns", [])
base.instance_variable_set("@_sort_directions", %w(asc desc))
end
def custom_sort(relations, sort_by, sort_direction)
sort_by ||= self.class.sort_options[:default_by]
sort_direction ||= self.class.sort_options[:default_direction]
return relations unless self.class.check_sort_parameter_validate(sort_by.to_s, sort_direction.to_s)
order_method = self.class.sort_options[:reorder] ? :reorder : :order
relations.send(order_method, "#{sort_by} #{sort_direction}")
end
def multiple_custom_sort(relations, opts)
opts.each do |sort_by, sort_direction|
relations = custom_sort(relations, sort_by, sort_direction)
end
relations
end
module ClassMethods
def sort_columns(*columns)
opts = columns.extract_options!
@_sort_options[:default_by] = opts[:default_by].to_s
@_sort_options[:default_direction] = opts[:default_direction].to_s
@_sort_options[:reorder] = opts[:reorder]
@_sort_columns = columns.map(&:to_s)
end
def check_sort_parameter_validate(sort_by, sort_direction)
(sort_by.blank? || @_sort_columns.include?(sort_by)) && @_sort_directions.include?(sort_direction)
end
def sort_options
@_sort_options
end
end
end

@ -1,7 +1,7 @@
# status0 审核中 1 同意 2 拒绝 3 撤销
class ApplyAction < ActiveRecord::Base
default_scope :order => 'updated_at desc'
attr_accessible :container_id, :container_type, :dealer_id, :reason, :user_id, :status, :apply_reason, :noticed, :ip_addr
attr_accessible :container_id, :container_type, :dealer_id, :reason, :user_id, :status, :apply_reason, :noticed, :ip_addr, :reject_description
belongs_to :user
has_many :tidings, :as => :container, :dependent => :destroy
after_create :send_tiding

@ -24,6 +24,14 @@ class Challenge < ActiveRecord::Base
scope :choose_type, lambda{where(st: 1)}
scope :practice_type, lambda{where(st: 0)}
def shixun_done_new
self.games.select{|game| game.status == 2 }.size
end
def shixun_running_new
self.games.select{|game| game.status != 2 }.size
end
def game_difficulty
str = "简单"
case self.difficulty

@ -56,6 +56,8 @@ class Course < ActiveRecord::Base
has_many :course_homework_categories, :dependent => :destroy, :order => "CONVERT(name USING gbk) COLLATE gbk_chinese_ci ASC"
has_many :homework_commons, :dependent => :destroy
has_many :shixun_homework_commons, class_name: 'HomeworkCommon', conditions: 'homework_type = 4'
has_many :other_homework_commons, class_name: 'HomeworkCommon', conditions: 'homework_type IN (1, 3)'
has_many :homework_group_settings, :dependent => :destroy
has_many :student_works, :through => :homework_commons, :dependent => :destroy
@ -498,6 +500,15 @@ class Course < ActiveRecord::Base
end
end
# 课堂实训作业的评测次数
def evaluate_count
course_user_ids = self.members.map(&:user_id)
shixun_ids = self.homework_commons.joins(:homework_commons_shixuns).where(homework_type: 4).pluck(:shixun_id)
return 0 if shixun_ids.blank?
Game.joins(:challenge).where(challenges: {shixun_id: shixun_ids}, games: {user_id: course_user_ids}).sum(:evaluate_count)
end
#课程动态公共表记录
def act_as_course_activity
self.course_acts << CourseActivity.new(:user_id => self.tea_id,:course_id => self.id)

@ -0,0 +1,7 @@
class Customer < ActiveRecord::Base
default_scope :order => 'customers.created_at desc'
has_many :partners, :through => :partner_customers
has_many :partner_customers, :dependent => :destroy
belongs_to :school
has_many :users
end

@ -4,7 +4,7 @@ class Department < ActiveRecord::Base
# apply_add_departments 不能关联删除 tidings表有关联
has_many :apply_add_departments
has_many :tidings, as: :container, dependent: :destroy
attr_accessible :name, :school_id, :is_auth, :identifier, :is_delete
attr_accessible :name, :school_id, :is_auth, :identifier, :is_delete, :host_count
scope :is_active, lambda{where(:is_delete => false)}
scope :is_delete, lambda{where(:is_delete => true)}

@ -9,4 +9,7 @@ class EcGraduationSubitem < ActiveRecord::Base
# 课程目标配置
has_many :ec_course_targets, :through => :ec_graduation_subitem_course_targets
has_many :ec_graduation_subitem_course_targets, :dependent => :destroy
has_many :ec_require_sub_vs_standards
has_many :ec_graduation_standards, through: :ec_require_sub_vs_standards
end

@ -1,3 +1,6 @@
class EcRequireSubVsStandard < ActiveRecord::Base
attr_accessible :ec_graduation_standard_id, :ec_graduation_subitem_id, :status
belongs_to :ec_graduation_standard
belongs_to :ec_graduation_subitem
end

@ -1,3 +1,5 @@
class EcRequirementVsObjective < ActiveRecord::Base
attr_accessible :ec_graduation_requirement_id, :ec_training_objective_id, :status
belongs_to :ec_graduation_requirement
belongs_to :ec_training_subitem
end

@ -1,4 +1,5 @@
class EcTrainingSubitem < ActiveRecord::Base
belongs_to :ec_training_objective
has_many :ec_requirement_vs_objectives, foreign_key: :ec_training_objective_id
end

@ -16,4 +16,8 @@ class EcYear < ActiveRecord::Base
# 课堂配置
has_many :ec_courses, :dependent => :destroy
acts_as_attachable
def prev_year
ec_major_school.ec_years.find_by_year(year - 1)
end
end

@ -0,0 +1,11 @@
#encoding=utf-8
class Ecloud < ActiveRecord::Base
attr_accessible :applyno, :begintime, :bossorderid, :custcode, :custid, :custname, :custtype, :ecordercode, :endtime,
:mobile, :opttype, :productcode, :registersource, :string, :trial, :useralias, :userid, :username, :email,
:effecttime, :operatime
has_many :ecloud_services, :dependent => :destroy # 业务列表
has_many :ecloud_productparas, :dependent => :destroy # 开通参数列表
has_one :ecloud_user
end

@ -0,0 +1,3 @@
class EcloudLog < ActiveRecord::Base
end

@ -0,0 +1,4 @@
class EcloudProductpara < ActiveRecord::Base
attr_accessible :key, :value, :ecloud_id
belongs_to :ecloud
end

@ -0,0 +1,6 @@
# 操作代码 0新增业务1注销业务2修改业务
class EcloudService < ActiveRecord::Base
attr_accessible :begintime, :code, :endtime, :opttype, :ecloud_id, :packagecode, :bossorderid
belongs_to :ecloud
has_many :ecloud_serviece_serviceparas
end

@ -0,0 +1,5 @@
# ket值license表示人数对应企业版duration表示月数对应个人版
class EcloudServieceServicepara < ActiveRecord::Base
attr_accessible :key, :value, :ecloud_service_id
belongs_to :ecloud_service
end

@ -0,0 +1,3 @@
class EcloudUser < ActiveRecord::Base
has_many :ecloud_user_paras
end

@ -0,0 +1,3 @@
class EcloudUserPara < ActiveRecord::Base
belongs_to :ecloud_user
end

@ -0,0 +1,4 @@
class EcloudUser < ActiveRecord::Base
# opttype: # user['opttype']: 操作类型0开通1变更3: 取消授权4暂停5恢复
attr_accessible :begintime, :email, :endtime, :mobile, :opttype, :paras, :useralias, :userid, :username, :custid
end

@ -13,6 +13,7 @@ class Game < ActiveRecord::Base
has_many :challenge_samples
has_many :game_codes, :dependent => :destroy
has_many :evaluate_records, :dependent => :destroy
has_one :run_code_message, :dependent => :destroy
include ApplicationHelper
scope :min, lambda { select([:id, :status, :myshixun_id, :user_id, :final_score, :challenge_id, :identifier,

@ -24,21 +24,21 @@ class HomeworkCommon < ActiveRecord::Base
has_many :homework_review_results, :dependent => :destroy # 学生的查重情况
belongs_to :course_homework_category
has_many :student_work_projects, :dependent => :destroy
has_many :homework_tests, :dependent => :destroy
has_many :homework_samples, :dependent => :destroy
has_many :student_works, :dependent => :destroy, :conditions => "student_works.is_test=0 and student_works.is_delete != 1"
has_many :student_work_projects
# has_many :homework_tests, :dependent => :destroy
# has_many :homework_samples, :dependent => :destroy
has_many :student_works, :conditions => "student_works.is_test=0 and student_works.is_delete != 1"
has_many :student_works_evaluation_distributions, :through => :student_works #一个作业的分配的匿评列表
has_many :journals_for_messages, :as => :jour, :dependent => :destroy
has_many :apply_homeworks, :dependent => :destroy
has_many :apply_homeworks
has_many :praise_tread, as: :praise_tread_object, dependent: :destroy
has_one :praise_tread_cache, as: :object, dependent: :destroy
has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy #用户活动
# has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy #用户活动
has_and_belongs_to_many :shixuns
# 课程动态
has_many :course_acts, :class_name => 'CourseActivity',:as =>:course_act ,:dependent => :destroy
# 课程消息
has_many :course_messages, :class_name =>'CourseMessage', :as => :course_message, :dependent => :destroy
# has_many :course_messages, :class_name =>'CourseMessage', :as => :course_message, :dependent => :destroy
has_many :tidings, as: :container, dependent: :destroy
acts_as_attachable
acts_as_event :title => Proc.new {|o| "#{l(:label_course_homework)} ##{o.id}: #{o.name}" },
@ -48,7 +48,7 @@ class HomeworkCommon < ActiveRecord::Base
# after_create :act_as_activity
after_update :update_activity
after_save :act_as_course_activity
after_destroy :delete_kindeditor_assets
# after_destroy :delete_kindeditor_assets
before_destroy :update_homework_bank_quotes
#删除时更新题库中的引用数
@ -63,33 +63,21 @@ class HomeworkCommon < ActiveRecord::Base
#作业类型
def homework_type_ch
type = self.homework_type
case type
when 1
type = "普通"
when 2
type = "编程"
when 3
type = "分组"
when 4
type = "实训"
case homework_type
when 1 then '普通'
when 2 then '编程'
when 3 then '分组'
when 4 then '实训'
end
type
end
def homework_type_module
type = self.homework_type
case type
when 1
type = "common_homework"
when 2
type = "code_homework"
when 3
type = "group_homework"
when 4
type = "shixun_homework"
case homework_type
when 1 then 'common_homework'
when 2 then 'code_homework'
when 3 then 'group_homework'
when 4 then 'shixun_homework'
end
type
end
def act_as_activity
@ -162,7 +150,7 @@ class HomeworkCommon < ActiveRecord::Base
# 作业的实训
def shixun
Shixun.find(self.homework_commons_shixuns.try(:shixun_id))
homework_commons_shixuns.shixun
end
# 作业实训过关的数目
@ -188,9 +176,9 @@ class HomeworkCommon < ActiveRecord::Base
# end
end
def is_program_homework?
self.homework_type == 2 && self.homework_detail_programing
end
# def is_program_homework?
# self.homework_type == 2 && self.homework_detail_programing
# end
def is_group_homework?
self.homework_type == 3 && self.homework_detail_group
@ -225,6 +213,6 @@ class HomeworkCommon < ActiveRecord::Base
end
end
delegate :language_name, :language, :to => :homework_detail_programing
# delegate :language_name, :language, :to => :homework_detail_programing
end

@ -0,0 +1,3 @@
class LocalChallenge < ActiveRecord::Base
end

@ -0,0 +1,3 @@
class LocalChallengeTag < ActiveRecord::Base
end

@ -0,0 +1,3 @@
class LocalMirrorRepository < ActiveRecord::Base
end

@ -0,0 +1,3 @@
class LocalShixun < ActiveRecord::Base
end

@ -0,0 +1,2 @@
class LocalShixunTagRepertoire < ActiveRecord::Base
end

@ -0,0 +1,3 @@
class LocalTestSet < ActiveRecord::Base
end

@ -53,6 +53,7 @@ class Message < ActiveRecord::Base
has_many :tidings, :as => :container , :dependent => :destroy
belongs_to :reply, :class_name => 'Message', :foreign_key => 'reply_id'
has_one :message_detail, :dependent => :destroy
#转发表
has_many :forwards, :as => :from, :dependent => :destroy
@ -117,6 +118,10 @@ class Message < ActiveRecord::Base
self.content
end
# def content
# self.try(:content)
# end
def topic?
parent_id.nil?
end

@ -64,7 +64,7 @@ class Myshixun < ActiveRecord::Base
time = 0
self.games.each do |game|
if game.status == 2
time += (game.end_time.to_i - game.open_time.to_i) > 0 ? (game.end_time.to_i - game.open_time.to_i) : 0
time += game.cost_time.to_i
end
end
time

@ -0,0 +1,53 @@
require 'base64'
class Oauth < ActiveRecord::Base
attr_accessible :client_id, :client_secret, :redirect_uri, :access_token,
:refresh_token, :token_created_at,:token_expires_in, :user_id
belongs_to :user
def gen_code
code = Base64.urlsafe_encode64 Digest::MD5.hexdigest "#{Time.now}-#{Random.new_seed}"
update_column(:code, code)
code
end
def gen_token
access_token = Digest::MD5.hexdigest "#{Time.now}-#{Random.new_seed}"
refresh_token = Digest::MD5.hexdigest "#{Random.new_seed}-#{Time.now}-#{Random.new_seed}"
self.update_attributes(access_token: access_token,
refresh_token: refresh_token,
token_created_at: Time.now.to_i,
token_expires_in: Time.now.to_i + 24*60*60,
)
end
def self.code_valid?(code)
# 1. 是否存在
oauth = Oauth.where(code: code).order("ID desc").first
return false unless oauth
# 2. 是否超过10分钟
return false if Time.now.to_i - oauth.created_at.to_i > 10*60
# 3. 是否有使用过
return false if oauth.access_token.present?
return true
end
def self.auth_code(code, client_id, client_secret)
Oauth.where(code: code, client_id: client_id, client_secret: client_secret).order('id desc').first
end
def self.auth(access_token)
oauth = self.find_by_access_token(access_token)
return nil unless oauth
oauth.user
end
end

@ -0,0 +1,3 @@
class OauthConfig < ActiveRecord::Base
attr_accessible :client_id, :client_secret, :redirect_uri, :scope
end

@ -121,13 +121,6 @@ class OpenSourceProject < ActiveRecord::Base
ApplyProjectMaster.delete_all "apply_type = '#{self.class}' AND apply_id = #{self.id} AND user_id = #{user.id}"
end
def admin?(user)
if user.admin? or ApplyProjectMaster.find(:all, :conditions => ["user_id = ? and apply_type = 'OpenSourceProject' and apply_id = ? and status = ?", user.id, self.id, 2]).present?
return true
else
return false
end
end
def reset_counters!
self.class.reset_counters!(id)

@ -0,0 +1,8 @@
class Openi < ActiveRecord::Base
attr_accessible :allow, :avatar_url, :email, :login, :name, :openi_user_id, :user_id
belongs_to :user
def self.find_by_login(login)
Openi.where(login: login).first
end
end

@ -1,7 +1,7 @@
class Output < ActiveRecord::Base
# attr_accessible :title, :body
# actual_output 编程题:实际输出, 选择题: 用户提交的答案(如: 014 对应用户选择为A B E
# compile_success 1 表示程序未报错,有正常输出, 0.表示程序抛异常了,报错!
# compile_success 1 表示程序未报错,有正常输出, 0.表示程序抛异常了,报错! -1 表示克隆代码失败; -2 表示创建pod失败
default_scope :order => 'query_index desc'
belongs_to :game
#belongs_to :challenge_choose

@ -0,0 +1,9 @@
class Partner < ActiveRecord::Base
# attr_accessible :name, :active
attr_accessor :active
belongs_to :school
has_many :customers, :through => :partner_customers
has_many :partner_customers, :dependent => :destroy
has_many :users
end

@ -0,0 +1,5 @@
class PartnerCustomer < ActiveRecord::Base
# attr_accessible :title, :body
belongs_to :partner
belongs_to :customer
end

@ -0,0 +1,5 @@
class RunCodeMessage < ActiveRecord::Base
# attr_accessible :title, :body
belongs_to :game
end

@ -3,8 +3,10 @@
class School < ActiveRecord::Base
attr_accessible :name, :province, :pinyin, :city, :address, :logo_link,
:auto_users_trial, :shool_code, :authorization_time,
:identifier, :is_online, :video_desc, :video_name,:course_link, :course_name
:identifier, :is_online, :video_desc, :video_name,:course_link,
:course_name, :partner_id, :customer_id
has_many :courses
has_many :active_courses, class_name: 'Course', conditions: 'is_end = false'
has_many :departments, :dependent => :destroy
has_many :shixun_schools, :dependent => :destroy
has_many :shixuns, :through => :shixun_schools
@ -14,10 +16,20 @@ class School < ActiveRecord::Base
has_many :ec_majors, :through => :ec_major_schools
has_many :ec_major_schools, :dependent => :destroy
has_one :ec_template_major, conditions: 'template_major = 1', class_name: 'EcMajorSchool'
has_many :partners, :dependent => :destroy
has_many :customers, :dependent => :destroy
# banner图片信息
has_many :school_images, :dependent => :destroy
# 报表信息
has_many :school_daily_reports
has_many :teacher_extensions, conditions: "identity = #{User::TEACHER}", class_name: 'UserExtensions'
has_many :student_extensions, conditions: "identity = #{User::STUDENT}", class_name: 'UserExtensions'
# 视频附件
acts_as_attachable
@ -26,4 +38,46 @@ class School < ActiveRecord::Base
def to_s
self.name.to_s
end
def teacher_count
User.find_by_sql("SELECT COUNT(users.`id`) AS teacher_count FROM users LEFT JOIN user_extensions ON
users.id=user_extensions.user_id WHERE user_extensions.`school_id` = #{self.id} AND
user_extensions.`identity` = 0").first.try(:teacher_count)
end
def student_count
User.find_by_sql("SELECT COUNT(users.`id`) AS student_count FROM users LEFT JOIN user_extensions ON
users.id=user_extensions.user_id WHERE user_extensions.`school_id` = #{self.id} AND
user_extensions.`identity` = 1").first.try(:student_count)
end
def course_count
Course.find_by_sql("SELECT COUNT(courses.`id`) AS course_count FROM courses LEFT JOIN user_extensions ON
courses.tea_id=user_extensions.user_id WHERE user_extensions.`school_id` = #{self.id} AND
courses.id != 1309").first.try(:course_count)
end
def shixun_count
Shixun.find_by_sql("select count(s.id) as shixun_count from users u right join shixuns s on u.id=s.user_id and
s.status in (2, 3) inner join user_extensions ue on u.id=ue.user_id and
ue.school_id=#{self.id}").first.try(:shixun_count)
end
def shixun_report_count
StudentWork.find_by_sql("SELECT count(*) as sw_count FROM `student_works` where user_id in
(SELECT users.id FROM users RIGHT JOIN user_extensions ON users.id=user_extensions.user_id
WHERE user_extensions.`school_id`=#{self.id}) and work_status between 1 and 2 and
myshixun_id !=0").first.try(:sw_count)
end
def statistic_url
dep = departments.where("identifier is not null").first
url = dep.present? && !dep.identifier.blank? ? "/colleges/#{dep.identifier}/statistics" : "/colleges/#{self.id}/statistics"
end
def course_act_time
CourseActivity.find_by_sql("SELECT max(ca.updated_at) as max_update FROM course_activities ca left join courses on ca.course_id =
courses.id LEFT JOIN user_extensions ON courses.tea_id=user_extensions.user_id WHERE
user_extensions.`school_id` = #{self.id}").first.try(:max_update)
end
end

@ -0,0 +1,3 @@
class SchoolDailyReport < ActiveRecord::Base
belongs_to :school
end

@ -28,6 +28,7 @@ class Shixun < ActiveRecord::Base
:propaedeutics, :trainee, :major_id, :homepage_show, :webssh, :hidden, :fork_from, :can_copy, :modify_time, :reset_time, :git_url, :use_scope,
:vnc, :evaluate_script, :image_text, :exec_time, :test_set_permission, :hide_code, :excute_time, :forbid_copy
belongs_to :creator, foreign_key: :user_id, class_name: 'User'
has_many :users, :through => :shixun_members
has_many :shixun_members, :dependent => :destroy
has_one :repository, :dependent => :destroy
@ -54,26 +55,33 @@ class Shixun < ActiveRecord::Base
scope :visible, lambda{where(status: [2,3])}
scope :min, lambda { select([:id, :name, :gpid, :modify_time, :reset_time, :language, :propaedeutics, :status, :identifier, :test_set_permission, :hide_code, :forbid_copy,
:webssh, :user_id, :code_hidden, :task_pass, :exec_time, :multi_webssh]) }
scope :min, lambda { select([:id, :name, :gpid, :modify_time, :reset_time, :language, :propaedeutics, :status, :identifier,
:test_set_permission, :hide_code, :forbid_copy, :hidden, :webssh, :user_id, :code_hidden,
:task_pass, :exec_time, :multi_webssh]) }
scope :published, lambda{where(status: 2)}
scope :field_for_recommend, lambda{ select([:id, :name, :identifier, :myshixuns_count]) }
include ApplicationHelper
has_many :tidings, :as => :container, :dependent => :destroy
scope :visible, -> { where(status: -1) }
#scope :visible, -> { where(status: -1) }
after_create :send_tiding
def should_compile?
self.mirror_repositories.published_main_mirror.first.try(:should_compile)
end
# 可供使用的实训
def operable?
logger.info("####")
self.status != -1 && !self.hidden
end
def is_published?
self.status > 1 ? true : false
end
def fork_identifier
self.fork_from.nil? ? "--" : Shixun.find(self.fork_from).try(:identifier)
self.fork_from.nil? ? "--" : Shixun.where(id: self.fork_from).first.try(:identifier)
end
def get_fork

@ -1,4 +1,4 @@
class ShixunTagRepertoire < ActiveRecord::Base
class ShixunTagRepertoire < ActiveRecord::Base
# attr_accessible :title, :body
belongs_to :shixun
belongs_to :tag_repertoire

@ -13,9 +13,9 @@ class StudentWork < ActiveRecord::Base
has_many :student_works_scores, :dependent => :destroy
has_many :challenge_work_scores, :dependent => :destroy
belongs_to :project
has_many :student_work_tests, order: 'id desc'
# has_many :student_work_tests, order: 'id desc'
# course's message
has_many :course_messages, :class_name =>'CourseMessage', :as => :course_message, :dependent => :destroy
# has_many :course_messages, :class_name =>'CourseMessage', :as => :course_message, :dependent => :destroy
has_many :attachments, :dependent => :destroy
has_many :tidings, as: :container, dependent: :destroy
belongs_to :myshixun
@ -24,7 +24,7 @@ class StudentWork < ActiveRecord::Base
scope :all_commit, lambda{where("work_status != 0")}
before_destroy :delete_praise
before_save :set_program_score, :set_src
before_save :set_program_score
after_save :update_avg_sum_score
# after_create :act_as_message
@ -34,25 +34,26 @@ class StudentWork < ActiveRecord::Base
PraiseTread.where("praise_tread_object_id = #{self.id} AND praise_tread_object_type = 'StudentWork'").destroy_all
end
def last_test
student_work_tests.order('id desc').first
end
# def last_test
# student_work_tests.order('id desc').first
# end
private
def set_program_score
if self.homework_common.is_program_homework? #编程作业,学生提交作品后计算系统得分
#根据最后一次测试计算得分
unless last_test
self.system_score = 0
else
self.system_score = last_test.test_score self.homework_common.homework_tests.size
end
end
# if self.homework_common.is_program_homework? #编程作业,学生提交作品后计算系统得分
# #根据最后一次测试计算得分
# unless last_test
# self.system_score = 0
# else
# self.system_score = last_test.test_score self.homework_common.homework_tests.size
# end
# end
set_final_score self.homework_common,self
end
def set_src
self.description = last_test.src if last_test
end
# def set_src
# self.description = last_test.src if last_test
# end
#成绩计算
def set_final_score homework,student_work
@ -217,8 +218,8 @@ class StudentWork < ActiveRecord::Base
# status == 0 : delay
def act_as_message
if self.work_status != 0 && self.created_at > self.homework_common.end_time
self.course_messages << CourseMessage.new(:user_id => self.user_id, :course_id => self.homework_common.course_id, :viewed => false, :status => false)
end
# if self.work_status != 0 && self.created_at > self.homework_common.end_time
# self.course_messages << CourseMessage.new(:user_id => self.user_id, :course_id => self.homework_common.course_id, :viewed => false, :status => false)
# end
end
end

@ -2,7 +2,7 @@ class Subject < ActiveRecord::Base
#status :0 编辑中 1 审核中 2 发布
# belongs_to :user
has_many :users, :through => :subject_members
has_many :subject_members, :dependent => :destroy, :order => "subject_members.id ASC"
has_many :subject_members, :dependent => :destroy, :order => "subject_members.position asc"
has_many :career_stages, :through => :career_stage_subjects
has_many :career_stage_subjects, :dependent => :destroy

@ -113,7 +113,7 @@ class Tiding < ActiveRecord::Base
shixun_name = Subject.find(self.parent_container_id).name
self.tiding_type == "System" ? ("你提交的实训课程发布申请:" + shixun_name + ",审核" + (self.status == 1 ? '已通过':('未通过' + "&nbsp;&nbsp;&nbsp;&nbsp;" + '原因:' + container.try(:reason).to_s))) : ("申请发布实训课程:"+ shixun_name)
when "TrialAuthorization"
self.tiding_type == "System" ? ("你提交的试用授权申请:审核" + (self.status == 1 ? '已通过':('未通过' + "&nbsp;&nbsp;&nbsp;&nbsp;" + '原因:' + container.try(:reason).to_s))) : ("提交了试用授权申请")
self.tiding_type == "System" ? ("你提交的试用授权申请:审核" + (self.status == 1 ? '已通过':('未通过' + "&nbsp;&nbsp;&nbsp;&nbsp;" + '原因:' + container.try(:reason).to_s + '' + container.try(:reject_description).to_s))) : ("提交了试用授权申请")
end
when "Course", "Shixun","Subject"
name = self.container_type == "Course" ? "课堂" : (self.container_type == "Shixun" ? "实训" :"实训课程")

@ -160,6 +160,7 @@ class User < Principal
## added by xianbo for delete
# has_many :biding_projects, :dependent => :destroy
belongs_to :softapplication, :foreign_key => 'id', :dependent => :destroy
belongs_to :partner
##ended by xianbo
#####fq
@ -245,6 +246,8 @@ class User < Principal
has_many :ec_major_schools, :through => :ec_major_school_users
has_many :ec_major_school_users, :dependent => :destroy
has_many :ec_course_users
#####
scope :logged, lambda { where("#{User.table_name}.status <> #{STATUS_ANONYMOUS}") }
@ -344,6 +347,21 @@ class User < Principal
end
end
}
# 工程认证的学校
def ec_school
school_id = self.ec_school_users.pluck(:school_id).first ||
self.ec_major_schools.pluck(:school_id).first ||
(self.ec_course_users.first && self.ec_course_users.first.try(:ec_course).try(:ec_year).try(:ec_major_school).try(:school_id))
end
# 工程认证的权限
def ec_school_auth school_id
# self.ec_school_users.where(:school_id => school_id).count > 0 ||
# self.ec_major_schools.where(:school_id => school_id).count > 0 ||
#
end
def challenge_tags
games = self.games.where(:id => self.experiences.map(&:container_id), :status => 2)
challenge_tags = ChallengeTag.where(:challenge_id => games.map(&:challenge_id)).where("name != ''")
@ -1675,6 +1693,42 @@ class User < Principal
end
end
def self.create_with_ecoder!(info)
user = User.find_by_phone(info["mobile"])
# 如果手机号存在,则直接绑定用户
# 因为手机号可以取回密码,所以可以视为同一用户
unless user
user = User.new
user.admin = false
user.login = "ecoder_" + info["mobile"]
user.phone = info["mobile"]
unless User.find_by_mail(info["email"])
user.mail = info["email"]
end
user.nickname = info["username"]
user.activate
user.last_login_on = Time.now
user.ecoder_user_id = info["userid"]
user.save!(:validate => false)
UserStatus.create!(:user_id => user.id, :changsets_count => 0, :watchers_count => 0)
ue = user.user_extensions ||= UserExtensions.new
ue.user_id = user.id
ue.save!
end
user
end
end
class AnonymousUser < User

@ -0,0 +1,306 @@
class CopyEcYearService
attr_reader :major_school, :to_year
def initialize(major_school, year)
@major_school = major_school
@to_year = major_school.ec_years.new(year: year)
end
def call
if from_year.blank?
to_year.save!
return to_year
end
# 专业第一次创建届别时复制示例专业2017届
ActiveRecord::Base.transaction do
copy_ec_year!
copy_graduation_requirement!
copy_training_objective!
new_major_school? ? copy_template_ec_course! : copy_ec_courses!
end
to_year
end
private
def new_major_school?
@_new_major ||= major_school.ec_years.count.zero?
end
def from_year
@_from_year ||= new_major_school? ? template_major_year : to_year.prev_year
end
def template_major_year
EcYear.joins(:ec_major_school).where(ec_major_schools: { template_major: true }).find_by_year('2017')
end
def copy_ec_year!
to_year.calculation_value = from_year.calculation_value
to_year.save!
end
def copy_graduation_requirement!
requirements = from_year.ec_graduation_requirements.includes(ec_graduation_subitems: :ec_require_sub_vs_standards)
requirements.each do |requirement|
to_requirement = to_year.ec_graduation_requirements.new
to_requirement.attributes = requirement.attributes.except('id', 'ec_year_id', 'created_at', 'updated_at')
to_requirement.save!
# 记录对应关系,创建支撑时使用
graduation_requirement_map[requirement.id] = to_requirement.id
copy_graduation_subitems(requirement, to_requirement)
end
end
def copy_graduation_subitems(requirement, to_requirement)
requirement.ec_graduation_subitems.each do |item|
to_item = to_requirement.ec_graduation_subitems.new
to_item.attributes = item.attributes.except('id', 'ec_graduation_requirement_id', 'created_at', 'updated_at')
to_item.save!
# 记录对应关系,创建支撑时使用
graduation_subitem_map[item.id] = to_item.id
copy_requirement_standard_supports!(item, to_item)
end
end
def copy_requirement_standard_supports!(graduation_subitem, to_graduation_subitem)
graduation_subitem.ec_require_sub_vs_standards.each do |support|
to_support = to_graduation_subitem.ec_require_sub_vs_standards.new
to_support.attributes = support.attributes.except('id', 'ec_graduation_subitem_id', 'created_at', 'updated_at')
to_support.save!
end
end
def copy_training_objective!
training_objective = from_year.ec_training_objective
return if training_objective.blank?
attributes = training_objective.attributes.except('id', 'ec_year_id', 'created_at', 'updated_at')
to_training_objective = to_year.create_ec_training_objective!(attributes)
copy_training_subitems!(training_objective, to_training_objective)
end
def copy_training_subitems!(training_objective, to_training_objective)
training_subitems = training_objective.ec_training_subitems.includes(:ec_requirement_vs_objectives)
training_subitems.each do |item|
to_item = to_training_objective.ec_training_subitems.new
to_item.attributes = item.attributes.except('id', 'ec_training_objective_id', 'created_at', 'updated_at')
to_item.save!
copy_requirement_vs_objectives!(item, to_item)
end
end
def copy_requirement_vs_objectives!(training_item, to_training_item)
training_item.ec_requirement_vs_objectives.each do |support|
to_support = to_training_item.ec_requirement_vs_objectives.new(status: support.status)
to_support.ec_graduation_requirement_id = graduation_requirement_map[support.ec_graduation_requirement_id]
to_support.save!
end
end
def copy_template_ec_course!
course = from_year.ec_courses.includes(
:ec_score_levels,
ec_course_evaluations: :ec_course_evaluation_subitems,
ec_course_targets: :ec_graduation_subitem_course_targets,
ec_course_achievement_methods: :ec_achievement_evaluation_relates,
ec_course_supports: :ec_graduation_subitem_courses
).find_by_name('数据库原理')
to_course = to_year.ec_courses.new
to_course.attributes = course.attributes.except('id', 'ec_year_id', 'created_at', 'updated_at')
to_course.save!
course_map[course.id] = to_course.id
copy_course_evaluations!(course, to_course)
copy_course_targets!(course, to_course)
copy_course_achievement_methods!(course, to_course)
copy_ec_course_supports!(course, to_course)
copy_score_levels!(course, to_course)
# 复制示例时需要复制学生和成绩数据
copy_year_students!
end
def copy_ec_courses!
courses = from_year.ec_courses.includes(
:ec_score_levels,
ec_course_evaluations: :ec_course_evaluation_subitems,
ec_course_targets: :ec_graduation_subitem_course_targets,
ec_course_achievement_methods: :ec_achievement_evaluation_relates,
ec_course_supports: :ec_graduation_subitem_courses
)
courses.each do |course|
to_course = to_year.ec_courses.new
to_course.attributes = course.attributes.except('id', 'ec_year_id', 'created_at', 'updated_at')
to_course.save!
course_map[course.id] = to_course.id
copy_course_evaluations!(course, to_course)
copy_course_targets!(course, to_course)
copy_course_achievement_methods!(course, to_course)
copy_ec_course_supports!(course, to_course)
copy_score_levels!(course, to_course)
end
end
def copy_course_evaluations!(course, to_course)
course.ec_course_evaluations.each do |evaluation|
to_evaluation = to_course.ec_course_evaluations.new
to_evaluation.attributes = evaluation.attributes.except('id', 'ec_course_id', 'created_at', 'updated_at')
to_evaluation.save!
course_evaluation_map[evaluation.id] = to_evaluation.id
copy_course_evaluation_subitems!(evaluation, to_evaluation)
end
end
def copy_course_evaluation_subitems!(evaluation, to_evaluation)
evaluation.ec_course_evaluation_subitems.each do |item|
to_item = to_evaluation.ec_course_evaluation_subitems.new
to_item.attributes = item.attributes.except('id', 'ec_course_evaluation_id', 'created_at', 'updated_at')
to_item.save!
course_evaluation_subitem_map[item.id] = to_item.id
end
end
def copy_course_targets!(course, to_course)
course.ec_course_targets.each do |target|
to_target = to_course.ec_course_targets.new
to_target.attributes = target.attributes.except('id', 'ec_course_id', 'created_at', 'updated_at')
to_target.save!
course_target_map[target.id] = to_target.id
copy_graduation_subitem_course_targets!(target, to_target)
end
end
def copy_graduation_subitem_course_targets!(target, to_target)
target.ec_graduation_subitem_course_targets.each do |support|
to_support = to_target.ec_graduation_subitem_course_targets.new
to_support.attributes = support.attributes.except('id', 'ec_course_target_id', 'ec_graduation_subitem_id', 'created_at', 'updated_at')
to_support.ec_graduation_subitem_id = graduation_subitem_map[support.ec_graduation_subitem_id]
to_support.save!
end
end
def copy_course_achievement_methods!(course, to_course)
course.ec_course_achievement_methods.each do |from|
to = to_course.ec_course_achievement_methods.new
to.attributes = from.attributes.except('id', 'ec_course_id', 'ec_course_target_id', 'ec_course_evaluation_id',
'ec_course_evaluation_subitem_id', 'created_at', 'updated_at')
to.ec_course_target_id = course_target_map[from.ec_course_target_id]
to.ec_course_evaluation_id = course_evaluation_map[from.ec_course_evaluation_id]
to.ec_course_evaluation_subitem_id = course_evaluation_subitem_map[from.ec_course_evaluation_subitem_id]
to.save!
copy_achievement_evaluation_relates!(from, to)
end
end
def copy_achievement_evaluation_relates!(method, to_method)
method.ec_achievement_evaluation_relates.each do |relate|
to_relate = to_method.ec_achievement_evaluation_relates.new
to_relate.attributes = relate.attributes.except('id', 'ec_course_achievement_method_id', 'ec_course_target_id',
'ec_course_evaluation_subitem_id', 'created_at', 'updated_at')
to_relate.ec_course_target_id = course_target_map[relate.ec_course_target_id]
to_relate.ec_course_evaluation_subitem_id = course_target_map[relate.ec_course_evaluation_subitem_id]
to_relate.save!
end
end
def copy_ec_course_supports!(course, to_course)
course.ec_course_supports.each do |support|
to_support = to_course.ec_course_supports.new
to_support.attributes = support.attributes.except('id', 'ec_course_id', 'created_at', 'updated_at')
to_support.save!
copy_graduation_subitem_courses!(support, to_support)
end
end
def copy_graduation_subitem_courses!(course_support, to_course_support)
course_support.ec_graduation_subitem_courses.each do |item|
to_item = to_course_support.ec_graduation_subitem_courses.new
to_item.attributes = item.attributes.except('id', 'ec_course_support_id', 'ec_graduation_subitem_id',
'created_at', 'updated_at')
to_item.ec_graduation_subitem_id = graduation_subitem_map[item.ec_graduation_subitem_id]
to_item.save!
end
end
def copy_score_levels!(course, to_course)
course.ec_score_levels.each do |level|
to_level = to_course.ec_score_levels.new
to_level.attributes = level.attributes.except('id', 'ec_course_id', 'created_at', 'updated_at')
to_level.save!
end
end
def copy_year_students!
students = from_year.ec_year_students.includes(:ec_student_achievements)
students.each do |student|
to_student = to_year.ec_year_students.new
to_student.attributes = student.attributes.except('id', 'ec_year_id', 'created_at', 'updated')
to_student.save!
copy_student_achievements!(student, to_student)
end
end
def copy_student_achievements!(student, to_student)
student.ec_student_achievements.each do |achievement|
to_achievement = to_student.ec_student_achievements.new
to_achievement.attributes = achievement.attributes.except('id', 'ec_year_student_id', 'ec_course_evaluation_id',
'ec_course_evaluation_subitem_id', 'created_at', 'updated_at')
to_achievement.ec_course_evaluation_id = course_evaluation_map[achievement.ec_course_evaluation_id]
to_achievement.ec_course_evaluation_subitem_id = course_evaluation_subitem_map[achievement.ec_course_evaluation_subitem_id]
to_achievement.save!
end
end
def graduation_requirement_map
@_graduation_requirement_map ||= {}
end
def graduation_subitem_map
@_graduation_subitem_map ||= {}
end
def course_map
@_course_map ||= {}
end
def course_evaluation_map
@_course_evaluation_map ||= {}
end
def course_evaluation_subitem_map
@_course_evaluation_subitem_map ||= {}
end
def course_target_map
@_course_target_map ||= {}
end
end

@ -1,6 +1,7 @@
class EcloudService
def list
return {status: 0, message: "test"}
def list params
return {status: 0, message: "test", code: params[:code], params: params}
end
end

@ -17,7 +17,8 @@ class GamesService
myshixun = Myshixun.min.find(game.myshixun_id)
shixun = Shixun.min.find(myshixun.shixun_id)
unless (myshixun.user_id == current_user.id || current_user.admin? || current_user.id == shixun.try(:user_id) || current_user.is_certification_teacher)
unless ((myshixun.user_id == current_user.id || current_user.business? || current_user.id == shixun.try(:user_id) ||
current_user.is_certification_teacher) && (shixun.operable?)) || current_user.admin?
return{:status => 403}
end
game_challenge = Challenge.min.find(game.challenge_id)
@ -43,7 +44,7 @@ class GamesService
# 高性能取上一关、下一关
prev_game = Game.prev_identifier(shixun.id, game.myshixun_id, game_challenge.position)
next_game = if current_user.is_certification_teacher || shixun_manager(shixun, current_user) || game.status == 2
next_game = if current_user.is_certification_teacher || shixun_manager(shixun, current_user) || game.status || shixun.task_pass
Game.next_game(shixun.id, game.myshixun_id, game_challenge.position).try(:identifier)
end
@ -65,7 +66,7 @@ class GamesService
# power判断用户是否有权限查看隐藏测试集(TPM管理员平台认证的老师花费金币查看者) -1 表示不能解锁 0 表示需要付费解锁 1表示可以看
# myshixun_manager
myshixun_manager = shixun_manager(shixun, current_user) || (current_user.is_certification_teacher && shixun.test_set_permission)
myshixun_manager = shixun_manager(shixun, current_user) || (current_user.is_certification_teacher)
power = (myshixun_manager || game.test_sets_view ) ? 1 : (shixun.test_set_permission ? 0 : -1)
# 选择题和编程题公共部分
@ -88,15 +89,29 @@ class GamesService
# tpm_script_modified = (shixun.reset_time > myshixun.reset_time ? true : false) # 新结构脚本是实时传送的,所以不会影响
# 区分评测过未评测过,未评测过按需求取数据
if max_query_index > 0
qurey_test_sets = TestSet.find_by_sql("SELECT o.actual_output, o.out_put, o.result, o.test_set_position, o.query_index,t.is_public,t.input, t.output, g.id as game_id, c.id as challenge_id FROM outputs o,games g ,challenges c,test_sets t where
g.id=#{game.id} and o.query_index=#{max_query_index} and g.id = o.game_id and c.id= g.challenge_id and t.challenge_id = c.id and t.position =o.test_set_position order by o.query_index
")
else
qurey_test_sets = TestSet.find_by_sql("SELECT t.is_public,t.input, t.output,t.position FROM games g ,challenges c,test_sets t where
g.id=#{game.id} and c.id= g.challenge_id and t.challenge_id = c.id
")
end
sql =
if max_query_index > 0
"SELECT
b.code, b.actual_output, b.out_put, b.result, b.compile_success, a.is_public, a.input, a.output
FROM
(SELECT position, input, output, challenge_id, is_public FROM test_sets where challenge_id=#{game_challenge.id}) a
LEFT JOIN
(SELECT
result, test_set_position, g.challenge_id, o.actual_output, o.out_put, o.compile_success, o.code
FROM
outputs o left join games g on g.id=o.game_id
WHERE
game_id=#{game.id} and query_index = #{max_query_index}
) b
ON
b.challenge_id = a.challenge_id and b.test_set_position = a.position"
else
# 这个地方如果加字段的话一定注意test_set_static_data方法因为这个地方的字段数在下面有判断
"SELECT t.is_public, t.input, t.output, t.position
FROM games g ,challenges c,test_sets t
WHERE g.id=#{game.id} and c.id= g.challenge_id and t.challenge_id = c.id"
end
qurey_test_sets = TestSet.find_by_sql(sql)
# 测试集统计及处理
unless qurey_test_sets.blank?
@ -134,10 +149,15 @@ class GamesService
test_result = []
unless test_sets.blank?
test_sets.each do |test_set|
# 第一次刷新或者没有评测的的时候test_set只需取四个字段所以取了count
actual_output = test_set.attributes.count > 4 ? test_set.try(:actual_output) : nil
result = test_set.attributes.count > 4 ? test_set.try(:result) : nil
compile_success = test_set.attributes.count > 4 ? test_set.try(:compile_success) : nil
status = test_set.attributes.count > 4 ? test_set.try(:code) : nil
#actual_output = Base64.encode64(actual_output)
compile_success = (actual_output.blank? || actual_output.downcase.match(/error/).present?) ? 0 : 1
actual_output = (compile_success.to_s == "0" && status.to_s == "-1" ? "编译失败,请在测试结果中查看具体的错误信息" : actual_output)
public_result = {:is_public => (test_set.is_public ? 1 : 0), :result => result,
:actual_output => actual_output, :compile_success => compile_success}
# 测试集公开的话才返回input结果
@ -233,7 +253,7 @@ class GamesService
is_teacher = (current_user.user_extensions.identity == 0)
is_certification_teacher = current_user.is_certification_teacher
# 这几种情况可以直接查看答案的:实训未发布;当前用户为实训管理员;已经查看过答案;平台认证的老师;
if (@shixun.status < 2 || shixun_manager(@shixun, current_user) || @game.answer_open || is_certification_teacher)
if (@shixun.status < 2 || shixun_manager(@shixun, current_user) || @game.answer_open == 1 || is_certification_teacher)
Rails.logger.info("answer#{params[:identifier]}#### user is #{current_user.id}, status is #{@shixun.status}, manager is #{shixun_manager(@shixun, current_user)}, open #{@game.answer_open}, cer #{is_certification_teacher}")
if challenge.st == 0
result = challenge.try(:answer)
@ -258,7 +278,7 @@ class GamesService
challenge_score = challenge.try(:score)
final_score = @game.final_score
if current_user.grade.to_i - challenge_score > 0
unless @game.answer_open # 如果这是第一次查看答案
if @game.answer_open == 0 # 如果这是第一次查看答案
if challenge.st == 0
final_score = final_score - challenge_score
# 积分消耗情况记录
@ -298,7 +318,7 @@ class GamesService
max_query_index = game.query_index - 1
# 区分评测过未评测过,未评测过按需求取数据
if max_query_index > 0
qurey_test_sets = TestSet.find_by_sql("SELECT o.actual_output, o.out_put, o.result, o.test_set_position, o.query_index,t.is_public,t.input, t.output, g.id as game_id, c.id as challenge_id FROM outputs o,games g ,challenges c,test_sets t where
qurey_test_sets = TestSet.find_by_sql("SELECT o.code, o.actual_output, o.out_put, o.result, o.compile_success, o.test_set_position, o.query_index,t.is_public,t.input, t.output, g.id as game_id, c.id as challenge_id FROM outputs o,games g ,challenges c,test_sets t where
g.id=#{game.id} and o.query_index=#{max_query_index} and g.id = o.game_id and c.id= g.challenge_id and t.challenge_id = c.id and t.position =o.test_set_position order by o.query_index
")
else
@ -327,10 +347,13 @@ class GamesService
rev = params[:rev] ? params[:rev] : "master"
content_modified = 0
ActiveRecord::Base.transaction do
# params[:evaluate] 实训评测时更新必须给的参数,需要依据该参数做性能统计,其它类型的更新可以跳过
# 自动保存的时候evaluate为0点评测的时候为1
if params[:evaluate] == 1
record = EvaluateRecord.create!(:user_id => current_user.id, :shixun_id => @myshixun.shixun.id, :game_id => @game.id)
sec_key = generates_identifier(EvaluateRecord, 10)
record = EvaluateRecord.create!(:user_id => current_user.id, :shixun_id => @myshixun.shixun.id,
:game_id => @game.id, :identifier => sec_key)
Rails.logger.warn("##game is is #{@game.id}, record id is #{record.id}, time is**** #{Time.now.strftime("%Y-%m-%d %H:%M:%S.%L")}")
# @myshixun.student_works.update_all(:update_time => Time.now) if !@myshixun.student_works.blank?
student_work_time = format("%.3f", (Time.now.to_f - record.created_at.to_f)).to_f
@ -365,7 +388,7 @@ class GamesService
if content != last_content && code_file.blank?
raise("update file failed")
else
return {:success => "success", :resubmit => resubmit ,:content_modified => content_modified}
return {:success => "success", :resubmit => resubmit ,:content_modified => content_modified, sec_key: record.try(:identifier)}
end
end
rescue Exception => e
@ -485,7 +508,9 @@ class GamesService
# 更新评测次数
game.update_column(:evaluate_count, (game.evaluate_count.to_i + 1))
# 清空代码评测信息
msg = game.run_code_message
msg.update_attributes(:status => 0, :message => nil) if msg.present?
# 更新时间是为了TPM端显示的更新退出实训及访问实训的时候会更新
myshixun.update_column(:updated_at, Time.now)
@ -524,7 +549,7 @@ class GamesService
:testCases => "#{testCases}", :resubmit => "#{resubmit}", :times => params[:first].to_i, :podType => shixun.webssh,
:containers => "#{Base64.urlsafe_encode64(container_limit(shixun.mirror_repositories))}", :tpmScript => "#{tpmScript}",
:timeLimit => "#{shixun.exec_time}", :content_modified => content_modified, :persistenceName => shixun.identifier,
:isPublished => (shixun.status < 2 ? 0 : 1)}
:isPublished => (shixun.status < 2 ? 0 : 1), :sec_key => params[:sec_key]}
# 评测有文件输出的需要特殊传字段 path表示文件存储的位置
params['file'] = Base64.urlsafe_encode64({:path => "#{game_challenge.picture_path}"}.to_json) if game_challenge.picture_path.present?
@ -547,7 +572,8 @@ class GamesService
# ----单测模式end
return {:result => "success", :resubmit => resubmit, :ableToCreate => res['ableToCreate'], :waitNum => res['waitNum'],
:waitingTime => res['waitingTime'], :position => game_challenge.position, :port => res['port'], :had_done => game.had_done }
:waitingTime => res['waitingTime'], :position => game_challenge.position, :port => res['port'],
:had_done => game.had_done}
rescue Exception => e
Rails.logger.error("评测出错,详情:" + e.message)
return {:result => 'fail', :contents =>"实训云平台繁忙繁忙等级502请稍后刷新并重试", :position => game_challenge.position, :had_done => game.had_done}
@ -697,7 +723,7 @@ class GamesService
if had_passed && !game.had_passed?
game.update_attributes(:status => 2, :end_time => Time.now)
# TPM实训已发布并且没有查看答案
if shixun.is_published? && !game.answer_open
if shixun.is_published? && game.answer_open == 0
# 查看答案的时候处理final_scor和扣分记录
experience = score
reward_grade(myshixun.owner, game.id, 'Game', score)
@ -780,7 +806,10 @@ class GamesService
# 如果没有超时并且正在评测中
# 判断评测中的状态有两种1、如果之前没有通关的只需判断status为1即可如果通过关则判断game的resubmit_identifier是否更新
if (params[:time_out] == "false") && ((params[:resubmit].blank? && game.status==1) || (params[:resubmit].present? && (params[:resubmit] != resubmit_identifier)))
return
# 代码评测的信息
running_code_status = game.run_code_message.try(:status)
running_code_message = game.run_code_message.try(:message)
return {:running_code_status => running_code_status, :running_code_message => running_code_message}
end
Rails.logger.info("##### resubmit_identifier is #{resubmit_identifier}")
@ -796,7 +825,7 @@ class GamesService
if game_status == 2 # 通关
if shixun.status > 1
score = game.final_score # 查看答案的时候有对最终获得金币进行处理
experience = game.answer_open ? 0 : game_challenge.score.to_i
experience = game.answer_open > 0 ? 0 : game_challenge.score.to_i
else
score = 0
experience = 0
@ -813,7 +842,8 @@ class GamesService
max_query_index = game.query_index - 1
# 区分评测过未评测过,未评测过按需求取数据
if max_query_index > 0
qurey_test_sets = TestSet.find_by_sql("SELECT o.actual_output,o.result, o.test_set_position, o.query_index,t.is_public,t.input, t.output, g.id as game_id, c.id as challenge_id FROM outputs o,games g ,challenges c,test_sets t where
qurey_test_sets = TestSet.find_by_sql("SELECT o.code, o.actual_output,o.result, o.compile_success, o.test_set_position,
o.query_index,t.is_public,t.input, t.output, g.id as game_id, c.id as challenge_id FROM outputs o,games g ,challenges c,test_sets t where
g.id=#{game.id} and o.query_index=#{max_query_index} and g.id = o.game_id and c.id= g.challenge_id and t.challenge_id = c.id and t.position =o.test_set_position order by o.query_index
")
else
@ -839,7 +869,7 @@ class GamesService
Rails.logger.warn("last_output is #{latest_output}")
# power判断用户是否有权限查看隐藏测试集(TPM管理员平台认证的老师花费金币查看者)
power = (shixun_manager(shixun, current_user) || (current_user.is_certification_teacher && shixun.test_set_permission)) ? 1 : (shixun.test_set_permission ? 0 : -1)
power = (shixun_manager(shixun, current_user) || (current_user.is_certification_teacher)) ? 1 : (shixun.test_set_permission ? 0 : -1)
# 测试集统计及处理
unless qurey_test_sets.blank?
check_power = (power == 1 || game.test_sets_view)
@ -852,7 +882,7 @@ class GamesService
mirror_name = shixun.mirror_name
# 轮询结束,更新评测耗时
e_record = EvaluateRecord.where(:game_id => game.id).first
e_record = EvaluateRecord.where(:identifier => params[:sec_key]).first
if game_status == 0 || game_status == 2
if e_record
front_js = format("%.3f", (Time.now.to_f - e_record.try(:updated_at).to_f)).to_f
@ -873,8 +903,10 @@ class GamesService
next_game = Game.next_game(shixun.id, game.myshixun_id, game_challenge.position).try(:identifier)
output_hash = {:test_sets => test_sets, :had_test_count => test_sets_count, :test_sets_count => test_sets_count, :had_passed_testsests_error_count => had_passed_testsests_error_count}
return {:grade => grade, :gold => score, :experience => experience, :status => game_status, :had_done => had_done, :position => game_challenge.position,
:port => port, :power => power, :record => record, :mirror_name => mirror_name, :picture => picture, :web_route => web_route, :latest_output => latest_output,
return {:grade => grade, :gold => score, :experience => experience, :status => game_status, :had_done => had_done,
:position => game_challenge.position, :port => port, :power => power, :record => record,
:mirror_name => mirror_name, :picture => picture, :web_route => web_route, :latest_output => latest_output,
:star => game.star, :next_game => next_game, :prev_game => prev_game}.merge(output_hash)
end
@ -930,7 +962,8 @@ class GamesService
end
#end
myshixun_job = Base64.urlsafe_encode64("myshixun_#{myshixun.id}")
StudentWork.where(:myshixun_id => myshixun.id).update_all(:myshixun_id => nil, :work_status => 0)
StudentWork.where(:myshixun_id => myshixun.id).update_all(:myshixun_id => 0, :work_status => 0, :work_score => nil, :final_score => nil,
:cost_time => 0, :update_time => nil, :compelete_status => 0, :commit_time => nil)
# myshixun.destroy
myshixun.delete
# 主从复制出现脏读的情况
@ -1007,6 +1040,15 @@ class GamesService
end
private
DCODES = %W(2 3 4 5 6 7 8 9 a b c f e f g h i j k l m n o p q r s t u v w x y z)
# 随机生成字符
def generates_identifier(container, num)
code = DCODES.sample(num).join
while container.exists?(identifier: code) do
code = DCODES.sample(num).join
end
code
end
def format_answer_list games
user_info = []

@ -0,0 +1,68 @@
class Management::SchoolDataContrastService
ParameterError = Class.new(StandardError)
PAGE_SIZE = 20
CONTRAST_COLUMN_LIST = %w(
teacher_increase_count student_increase_count course_increase_count
shixun_increase_count active_user_count
).freeze
attr_reader :params, :sort_direction, :contrast_column
def initialize(params)
@params = params
@sort_direction = params[:sort_direction].to_s
@contrast_column = params[:contrast_column].to_s
end
def call
validate_parameter!
reports = School.joins(:school_daily_reports).select(select_columns)
keyword = params[:keyword].try(:to_s).try(:strip)
if keyword.present?
reports = reports.where("schools.name LIKE :keyword OR schools.id LIKE :keyword", keyword: "%#{keyword}%")
end
count = reports.count('distinct(schools.id)')
sql = query_report_sql(reports.group('schools.id').to_sql)
reports = SchoolDailyReport.find_by_sql(sql)
[count, reports]
end
private
def validate_parameter!
if %i[begin_date end_date other_begin_date other_end_date].any? { |key| params[key].blank? }
raise ParameterError
end
unless %w(desc asc).include?(sort_direction)
raise ParameterError
end
unless CONTRAST_COLUMN_LIST.include?(contrast_column)
raise ParameterError
end
end
def format_date(date)
Time.zone.parse(date).strftime("%Y-%m-%d")
end
def offset
(params[:page].to_i.zero? ? 0 : params[:page].to_i - 1) * PAGE_SIZE
end
def select_columns
"schools.id school_id, schools.name school_name,"\
"(SUM(IF(date BETWEEN '#{format_date(params[:begin_date])}' AND '#{format_date(params[:end_date])}', #{contrast_column}, 0))) total,"\
"(SUM(IF(date BETWEEN '#{format_date(params[:other_begin_date])}' AND '#{format_date(params[:other_end_date])}', #{contrast_column}, 0))) other_total"\
end
def query_report_sql(from_sql)
"SELECT reports.*, (other_total - total) increase, (IF(other_total - total = 0, 0.0, round((other_total - total) / IF(total = 0, 1, total), 5))) percentage "\
"FROM (#{from_sql}) reports ORDER BY percentage #{sort_direction} LIMIT #{PAGE_SIZE} OFFSET #{offset}"
end
end

@ -0,0 +1,88 @@
class Management::SchoolDataGrowService
include CustomSortable
PAGE_SIZE = 20
attr_reader :params
sort_columns :teacher_increase_count, :student_increase_count,
:course_increase_count, :shixun_increase_count, :active_user_count,
default_by: :teacher_increase_count, default_direction: :desc
def initialize(params)
@params = params
end
def call
reports = query_reports.group('schools.id')
count = reports.count.count
reports = reports.select(
'schools.id school_id, schools.name school_name,'\
'SUM(teacher_increase_count) teacher_increase_count,'\
'SUM(student_increase_count) student_increase_count,'\
'SUM(course_increase_count) course_increase_count,'\
'SUM(shixun_increase_count) shixun_increase_count,'\
'SUM(active_user_count) active_user_count'
)
reports = custom_sort(reports, params[:sort_by], params[:sort_direction])
reports = reports.order('school_id asc').limit(PAGE_SIZE).offset(offset)
[count, reports]
end
def grow_summary
@_grow_summary ||= begin
query_reports.select(
'SUM(teacher_increase_count) teacher_increase_count,'\
'SUM(student_increase_count) student_increase_count,'\
'SUM(course_increase_count) course_increase_count,'\
'SUM(shixun_increase_count) shixun_increase_count,'\
'SUM(active_user_count) active_user_count'
).first
end
end
private
def query_reports
date = query_date
date_condition = if date.is_a?(Range)
"sdr.date BETWEEN '#{date.min.strftime('%Y-%m-%d')}' AND '#{date.max.strftime('%Y-%m-%d')}'"
else
"sdr.date = '#{date.strftime('%Y-%m-%d')}'"
end
reports = School.joins("LEFT JOIN school_daily_reports sdr ON sdr.school_id = schools.id AND #{date_condition}")
keyword = params[:keyword].try(:to_s).try(:strip)
if keyword.present?
reports = reports.where("schools.name LIKE :keyword OR schools.id LIKE :keyword", keyword: "%#{keyword}%")
end
reports
end
def query_date
if params[:grow_begin_date].present?
begin_time = Time.zone.parse(params[:grow_begin_date])
end_date = if params[:grow_end_date].present?
Time.zone.parse(params[:grow_end_date])
end
end_date.blank? || end_date == begin_time ? begin_time : begin_time..end_date
else
yesterday
end
end
def yesterday
# 每日凌晨5点为节点, 25日凌晨4点、3点、2点等等未到更新数据时间点看到的数据是23日-24日的统计数据
(Time.zone.now - 5.hours).beginning_of_day - 1.days
end
def offset
(params[:page].to_i.zero? ? 0 : params[:page].to_i - 1) * PAGE_SIZE
end
end

@ -0,0 +1,100 @@
class Management::SchoolReportService
include CustomSortable
attr_reader :params
sort_columns :student_count, :teacher_count, :homework_count, :other_homework_count,
:course_count, :active_course_count, :nearly_course_time,
default_by: :teacher_count, default_direction: :desc
def initialize(params)
@params = params
end
def call
schools = School.group('schools.id')
keyword = params[:keyword].try(:to_s).try(:strip)
if keyword.present?
schools = schools.where("schools.name LIKE :keyword OR schools.id LIKE :keyword", keyword: "%#{keyword}%")
end
count = schools.count.count
# 根据排序字段进行查询
schools = query_by_sort_column(schools, params[:sort_by])
schools = custom_sort(schools, params[:sort_by], params[:sort_direction])
schools = schools.limit(page_size).offset(offset)
# 查询并组装其它数据
schools = package_other_data(schools)
[count, schools]
end
def package_other_data(schools)
ids = schools.map(&:id)
student_map = UserExtensions.where(school_id: ids, identity: User::STUDENT).group(:school_id).count
teacher_map = UserExtensions.where(school_id: ids, identity: User::TEACHER).group(:school_id).count
homeworks = HomeworkCommon.joins(:course)
shixun_homework_map = homeworks.where(homework_type: 4, courses: { school_id: ids }).group('school_id').count
other_homework_map = homeworks.where(homework_type: [1, 3], courses: { school_id: ids }).group('school_id').count
courses = Course.where(is_delete: 0, school_id: ids).group('school_id')
course_map = courses.count
nearly_course_time_map = courses.joins(:course_activities).maximum('course_activities.updated_at')
active_course_map = courses.where(is_end: false).count
schools.map do |school|
{
id: school.id,
name: school.name,
teacher_count: teacher_map[school.id],
student_count: student_map[school.id],
homework_count: shixun_homework_map[school.id],
other_homework_count: other_homework_map[school.id],
course_count: course_map[school.id],
nearly_course_time: nearly_course_time_map[school.id],
active_course_count: active_course_map[school.id],
}
end
end
private
def query_by_sort_column(schools, sort_by_column)
base_query_column = 'schools.id, schools.name'
case sort_by_column.to_s
when 'teacher_count' then
schools.joins(:teacher_extensions).select("#{base_query_column}, COUNT(*) teacher_count")
when 'student_count' then
schools.joins(:student_extensions).select("#{base_query_column}, COUNT(*) student_count")
when 'homework_count' then
schools.joins(courses: :shixun_homework_commons).select("#{base_query_column}, COUNT(*) homework_count")
when 'other_homework_count' then
schools.joins(courses: :other_homework_commons).select("#{base_query_column}, COUNT(*) other_homework_count")
when 'course_count' then
schools.joins('LEFT JOIN courses cs ON cs.school_id = schools.id AND cs.is_delete = 0')
.select("#{base_query_column}, COUNT(*) course_count")
when 'nearly_course_time' then
schools.joins('LEFT JOIN courses cs ON cs.school_id = schools.id AND cs.is_delete = 0')
.joins('LEFT JOIN course_activities acs ON acs.course_id = cs.id')
.select("#{base_query_column}, MAX(acs.updated_at) nearly_course_time")
when 'active_course_count' then
schools.joins('LEFT JOIN courses cs ON cs.school_id = schools.id AND cs.is_delete = 0 AND cs.is_end = false')
.select("#{base_query_column}, COUNT(*) active_course_count")
else
schools.joins(:teacher_extensions).select("#{base_query_column}, COUNT(*) teacher_count")
end
end
def page_size
params[:per_page] || 20
end
def offset
(params[:page].to_i.zero? ? 0 : params[:page].to_i - 1) * page_size
end
end

@ -125,9 +125,21 @@ class ShixunsService
praise_count = d.praise_tread.where(:praise_or_tread => 1).count
user_praise= d.praise_tread.select{|pt| pt.user_id == current_user.id}.length > 0 ? true : false
# 实训TPM的管理员可以看到隐藏的评论
parents = {:id => d.id, :content => d.content, :time => time_from_now(d.created_at), :position => d.position, :user_id => d.user.try(:id), :reward => d.reward,
:image_url => url_to_avatar(d.user), :username => d.username, :user_login => d.user.try(:login), :shixun_id => dis.id, :hidden => d.hidden,
:manager => current_user.manager_of_shixun?(dis, current_user), :praise_count => praise_count, :user_praise => user_praise, :admin => current_user.admin?}
manager = current_user.manager_of_shixun?(dis, current_user)
game_url =
if manager
position = d.position.nil? ? 1 : d.position
game_identifier = Game.find_by_sql("SELECT g.identifier FROM games g JOIN challenges c on g.challenge_id = c.id
WHERE c.shixun_id = #{dis.id} AND c.position = #{position} AND g.user_id = #{d.user_id}").first.try(:identifier)
"/tasks/#{game_identifier}"
else
""
end
parents = {:id => d.id, :content => d.content, :time => time_from_now(d.created_at), :position => d.position,
:user_id => d.user.try(:id), :reward => d.reward, :image_url => url_to_avatar(d.user),
:username => d.username, :user_login => d.user.try(:login), :shixun_id => dis.id, :hidden => d.hidden,
:manager => manager, :praise_count => praise_count, game_url: game_url,
:user_praise => user_praise, :admin => current_user.admin?}
# 现在没有二级回复所以查询的时候直接从root_id取
children = Discuss.where(:root_id => d.id).includes(:user).reorder("created_at asc")

@ -60,9 +60,11 @@ module ZipService
bid_homework_path << file_name
digests << Trustie::Utils.digest(file_name)
end
# file_name = "#{Time.now.strftime("%Y%m%d%H:%M:%S").to_s}-#{exercise.course_id}-#{exercise.exercise_name}-#{exercise_user.user.user_extensions.student_id}-#{exercise_user.user.show_name}" + ".pdf"
out_file_name = "#{Time.now.strftime("%Y%m%d%H%M%S").to_s}-#{exercise.course_id}-#{exercise.exercise_name}.zip"
out_file_name.gsub!(" ", "-")
out_file_name.gsub!("/", "_")
out_file = find_or_pack(exercise.id, exercise.user_id, digests.sort){
zipping("#{Time.now.strftime("%Y%m%d%H%M%S").to_s}-#{exercise.course_id}-#{exercise.exercise_name}.zip",
zipping(out_file_name,
bid_homework_path, OUTPUT_FOLDER)
}
[{files:[out_file.file_path], count: 1, index: 1,
@ -89,8 +91,11 @@ module ZipService
digests << Trustie::Utils.digest(file_name)
end
end
out_file_name = "#{Time.now.strftime("%Y%m%d%H%M%S").to_s}-#{homework_common.course_id}-#{homework_common.name}.zip"
out_file_name.gsub!(" ", "-")
out_file_name.gsub!("/", "_")
out_file = find_or_pack(homework_common.id, homework_common.user_id, digests.sort){
zipping("#{Time.now.strftime("%Y%m%d%H%M%S").to_s}-#{homework_common.course_id}-#{homework_common.name}.zip",
zipping(out_file_name,
bid_homework_path, OUTPUT_FOLDER)
}
[{files:[out_file.file_path], count: 1, index: 1,
@ -188,6 +193,7 @@ module ZipService
# file_name = "#{exercise.course_id}-#{exercise.exercise_name}-#{exercise_user.user.user_extensions.student_id}-#{exercise_user.user.show_real_name}" + ".pdf"
# file_name = "#{Time.now.strftime("%Y%m%d%H%M%S").to_s}-#{exercise.course_id}-#{exercise.id}-#{exercise_user.user.user_extensions.student_id}" + ".pdf"
file_name.gsub!(" ", "-")
file_name.gsub!("/", "_")
kit.to_file("#{OUTPUT_FOLDER}/#{file_name}")
out_file = "#{OUTPUT_FOLDER}/#{file_name}"
out_file
@ -200,6 +206,7 @@ module ZipService
# file_name = "#{homework.course_id}-#{homework.name}-#{student_work.user.user_extensions.student_id}-#{student_work.user.show_real_name}" + ".pdf"
# file_name = "#{Time.now.strftime("%Y%m%d%H%M%S").to_s}-#{homework.course_id}-#{homework.id}-#{student_work.user.user_extensions.student_id}" + ".pdf"
file_name.gsub!(" ", "-")
file_name.gsub!("/", "_")
kit.to_file("#{OUTPUT_FOLDER}/#{file_name}")
out_file = "#{OUTPUT_FOLDER}/#{file_name}"
out_file

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save