-- 1.5.1
USE `stmms_ft`;
ALTER TABLE eb_marker ADD COLUMN `finish_count_na` int(11)     DEFAULT NULL COMMENT '完成数量不含仲裁';
ALTER TABLE eb_marker ADD COLUMN `valid_count_na`  int(11)     DEFAULT NULL COMMENT '有效数量不含仲裁';
ALTER TABLE eb_marker ADD COLUMN `avg_score_na`    double      DEFAULT NULL COMMENT '平均分不含仲裁';
ALTER TABLE eb_marker ADD COLUMN `avg_speed_na`    double      DEFAULT NULL COMMENT '平均时长不含仲裁';
ALTER TABLE eb_marker ADD COLUMN `stdev_score_na`  double      DEFAULT NULL COMMENT '标准差不含仲裁';


delete from b_privilege t where t.code in ('exam_report_subject','exam_report_subject_range');
delete from b_role_privilege t where t.privilege_code in ('exam_report_subject','exam_report_subject_range');
delete from b_role_privilege t where t.privilege_code in ('exam_mark-group-add','exam_mark-group-edit','exam_mark-group-reset_edit','exam_mark-group-delete');

INSERT INTO `b_privilege` ( `code`, `name`, `parent_code`, `privilege_type`, `privilege_uri`, `seq`,`level`,`icon`,`i18n`)
VALUES ('exam_report_subject', '科目分析', 'root_code', 'MENU', '/admin/basic/role/info/sub/page', 110,1,'icon-asterisk','index.report.subject');
INSERT INTO `b_privilege` ( `code`, `name`, `parent_code`, `privilege_type`, `privilege_uri`, `seq`,`level`)
VALUES ('exam_report_subject-total', '总量分析', 'exam_report_subject', 'PAGE', '/admin/exam/reportSubject', 10,2);
INSERT INTO `b_privilege` ( `code`, `name`, `parent_code`, `privilege_type`, `privilege_uri`, `seq`,`level`)
VALUES ('exam_report_subject-range', '分段统计', 'exam_report_subject', 'PAGE', '/admin/exam/reportSubjectRange', 20,2);
INSERT INTO `b_privilege` ( `code`, `name`, `parent_code`, `privilege_type`, `privilege_uri`, `seq`,`level`)
VALUES ('exam_report_subject-college', '学院分析', 'exam_report_subject', 'PAGE', '/admin/exam/reportSubjectCollege', 30,2);
INSERT INTO `b_privilege` ( `code`, `name`, `parent_code`, `privilege_type`, `privilege_uri`, `seq`,`level`)
VALUES ('exam_report_subject-teacher', '任课老师分析', 'exam_report_subject', 'PAGE', '/admin/exam/reportSubjectTeacher', 40,2);
INSERT INTO `b_privilege` ( `code`, `name`, `parent_code`, `privilege_type`, `privilege_uri`, `seq`,`level`)
VALUES ('exam_report_subject-class', '班级分析', 'exam_report_subject', 'PAGE', '/admin/exam/reportSubjectClass', 50,2);
INSERT INTO `b_privilege` ( `code`, `name`, `parent_code`, `privilege_type`, `privilege_uri`, `seq`,`level`)
VALUES ('exam_report_subject-objective_question', '客观题分析', 'exam_report_subject', 'PAGE', '/admin/exam/reportSubjectQuestion', 60,2);
INSERT INTO `b_privilege` ( `code`, `name`, `parent_code`, `privilege_type`, `privilege_uri`, `seq`,`level`)
VALUES ('exam_report_subject-subjective_question', '主观题分析', 'exam_report_subject', 'PAGE', '/admin/exam/reportSubjectQuestion', 70,2);
INSERT INTO `b_privilege` ( `code`, `name`, `parent_code`, `privilege_type`, `privilege_uri`, `seq`,`level`)
VALUES ('exam_report_subject-group', '大题分析', 'exam_report_subject', 'PAGE', '/admin/exam/reportSubjectGroup', 80,2);

INSERT INTO b_role_privilege (`school_id`, `role_code`, `privilege_code`,`enable`)
SELECT s.id,'SCHOOL_ADMIN',p.`code`,1 from b_privilege p join b_school s   
where p.`code` in('exam_report_subject','exam_report_subject-total','exam_report_subject-range','exam_report_subject-college',
'exam_report_subject-teacher','exam_report_subject-class'
,'exam_report_subject-objective_question','exam_report_subject-subjective_question','exam_report_subject-group');

INSERT INTO b_role_privilege (`school_id`, `role_code`, `privilege_code`,`enable`)
SELECT s.id,'SUBJECT_HEADER',p.`code`,1 from b_privilege p join b_school s   
where p.`code` in('exam_report_subject','exam_report_subject-total','exam_report_subject-range','exam_report_subject-college',
'exam_report_subject-teacher','exam_report_subject-class'
,'exam_report_subject-objective_question','exam_report_subject-subjective_question','exam_report_subject-group');

INSERT INTO b_role_privilege (`school_id`, `role_code`, `privilege_code`,`enable`)
SELECT s.id,'COLLEGE_ADMIN',p.`code`,1 from b_privilege p join b_school s   
where p.`code` in('exam_report_subject','exam_report_subject-total','exam_report_subject-range','exam_report_subject-college',
'exam_report_subject-teacher','exam_report_subject-class'
,'exam_report_subject-objective_question','exam_report_subject-subjective_question','exam_report_subject-group');

INSERT INTO b_role_privilege (`school_id`, `role_code`, `privilege_code`,`enable`)
SELECT s.id,'SCHOOL_VIEWER',p.`code`,1 from b_privilege p join b_school s   
where p.`code` in('exam_report_subject','exam_report_subject-total');

INSERT INTO b_role_privilege (`school_id`, `role_code`, `privilege_code`,`enable`)
SELECT s.id,'SCHOOL_ADMIN',p.`code`,1 from b_privilege p join b_school s   
where p.`code` in('exam_mark-group-add','exam_mark-group-edit','exam_mark-group-reset_edit','exam_mark-group-delete');

INSERT INTO b_role_privilege (`school_id`, `role_code`, `privilege_code`,`enable`)
SELECT s.id,'SUBJECT_HEADER',p.`code`,0 from b_privilege p join b_school s   
where p.`code` in('exam_mark-group-add','exam_mark-group-edit','exam_mark-group-reset_edit','exam_mark-group-delete');

INSERT INTO b_role_privilege (`school_id`, `role_code`, `privilege_code`,`enable`)
SELECT s.id,'COLLEGE_ADMIN',p.`code`,0 from b_privilege p join b_school s   
where p.`code` in('exam_mark-group-add','exam_mark-group-edit','exam_mark-group-reset_edit','exam_mark-group-delete');