Exemplo n.º 1
0
        /// <summary>
        /// 获取学生任务报告的统计部分
        /// </summary>
        /// <param name="studentId"></param>
        /// <param name="taskId"></param>
        /// <returns></returns>
        public DtoStudentReport GetByStudentTask(int studentId, int taskId)
        {
            StudentPracticeBll studentPracticeBll = new StudentPracticeBll();
            var result = studentPracticeBll.StudentTaskRepository.IsHasTaskReport(studentId, taskId);

            if (!result)
            {
                throw new AbhsException(ErrorCodeEnum.NotStudyReport, AbhsErrorMsg.ConstNotStudyReport);
            }
            //获取学生答案
            Yw_StudentStudyTaskAnswerExt answer     = studentPracticeBll.StuStudyTaskAnsRepo.GetByStudentTask(studentId, taskId) as Yw_StudentStudyTaskAnswerExt;
            StudentAnswerCard            answerCard = answer.Yta_Answer_Obj;

            DtoStudentReport studentReport = new DtoStudentReport();

            if (answerCard != null)
            {
                studentReport.StudyDate    = answerCard.SubmitTime;
                studentReport.TotalScore   = Convert.ToInt32(Math.Round(answerCard.TotalStars * 1.0 / (answerCard.AnswerCollection.Count() * 5) * 5, MidpointRounding.AwayFromZero));
                studentReport.TotalStars   = answerCard.TotalStars;
                studentReport.StudyTime    = Convert.ToInt32(Math.Ceiling(answerCard.UseTime * 1.0 / 60));
                studentReport.ResultCoins  = answerCard.AnswerCollection.Select(s => s.ResultCoins).Sum();
                studentReport.TotalCoins   = answerCard.TotalCoins;
                studentReport.SubjectCount = answerCard.AnswerCollection.Count();

                double rates = Math.Round((double)(answerCard.AnswerCollection.Where(x => x.ResultStars == 5).Count()) / answerCard.AnswerCollection.Count(), 2) * 100;
                studentReport.ExcellentRates = rates;

                List <Yw_Knowledge> knowledges = new List <Yw_Knowledge>();
                var knowledgeShow = answerCard.AnswerCollection.Where(x => x.KnowledgeId != 0).GroupBy(s => s.KnowledgeId);

                studentReport.Knowledge = GetKnowledge(knowledgeShow);
            }
            return(studentReport);
        }
Exemplo n.º 2
0
        //获取任务报告课程信息部分
        public DtoStudentReportList GetStuTaskReportById(int taskId)
        {
            StudentPracticeBll studentPracticeBll = new StudentPracticeBll();
            var info = studentPracticeBll.StudentTaskRepository.GetStuTaskReportById(taskId);

            if (info.ReportType == (int)CourseReportEnum.练习报告)
            {
                info.PraticeCount = studentPracticeBll.StudentTaskRepository.GetPracticeReportCount(info.StudentId, info.CourseId, taskId);
            }
            return(info);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 查询学生全部报告
        /// </summary>
        /// <param name="paging"></param>
        /// <param name="studentId"></param>
        /// <returns></returns>
        public List <DtoStudentReportList> GetStudentReport(PagingObject paging, int studentId, int reportType)
        {
            List <DtoStudentReportList> reportList      = new List <DtoStudentReportList>();
            StudentStudyBll             studentStudyBll = new StudentStudyBll();

            if (reportType == 0)
            {
                reportList = studentStudyBll.StuLesProgressRepository.GetStudentReport(paging, studentId);
            }
            else if (reportType == (int)CourseReportEnum.练习报告 || reportType == (int)CourseReportEnum.任务报告)
            {
                StudentPracticeBll studentPracticeBll = new StudentPracticeBll();
                reportList = studentPracticeBll.StudentTaskRepository.GetStuTaskReport(paging, studentId, reportType);
            }
            else if (reportType == (int)CourseReportEnum.学习报告)
            {
                reportList = studentStudyBll.StuLesProgressRepository.GetStuCourseReport(paging, studentId);
            }
            return(reportList);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 获取任务报告或练习报告的题目部分
        /// </summary>
        /// <param name="studentId"></param>
        /// <param name="taskId"></param>
        /// <param name="pageIndex"></param>
        /// <returns></returns>
        public Tuple <List <StudentAnswerBase>, Dictionary <int, Yw_SubjectContent>, Dictionary <int, Yw_Subject>, int, int> GetReportSubject(int studentId, int taskId, int pageIndex)
        {
            StudentPracticeBll studentPracticeBll = new StudentPracticeBll();
            int pageSize = 10;
            //获取学生答案
            Yw_StudentStudyTaskAnswerExt        answer         = studentPracticeBll.StuStudyTaskAnsRepo.GetByStudentTask(studentId, taskId) as Yw_StudentStudyTaskAnswerExt;
            List <StudentAnswerBase>            answerCard     = new List <StudentAnswerBase>();
            Dictionary <int, Yw_SubjectContent> subjectContent = new Dictionary <int, Yw_SubjectContent>();
            Dictionary <int, Yw_Subject>        subjects       = new Dictionary <int, Yw_Subject>();

            answerCard = answer.Yta_Answer_Obj.AnswerCollection;
            var subjectIds = answerCard.Select(s => s.SubjectId).ToList();

            if ((pageIndex - 1) * pageSize < subjectIds.Count)
            {
                answerCard = answerCard.Skip((pageIndex - 1) * pageSize).Take(pageSize).ToList();
                var pageIds = subjectIds.Skip((pageIndex - 1) * pageSize).Take(pageSize).ToList();
                subjectContent = GetTaskSubject(pageIds).ToDictionary(x => x.Ysc_SubjectId, x => x);
                subjects       = GetSubjects(pageIds).ToDictionary(x => x.Ysj_Id, x => x);
            }
            Tuple <List <StudentAnswerBase>, Dictionary <int, Yw_SubjectContent>, Dictionary <int, Yw_Subject>, int, int> reportTuple = new Tuple <List <StudentAnswerBase>, Dictionary <int, Yw_SubjectContent>, Dictionary <int, Yw_Subject>, int, int>(answerCard, subjectContent, subjects, pageSize, subjectIds.Count);

            return(reportTuple);
        }
Exemplo n.º 5
0
        /// <summary>
        /// 任务报告和练习报告数量
        /// </summary>
        /// <param name="studentId"></param>
        /// <returns></returns>
        public List <Yw_StudentTask> StuTaskReportCount(int studentId)
        {
            StudentPracticeBll studentPracticeBll = new StudentPracticeBll();

            return(studentPracticeBll.StudentTaskRepository.StuTaskReportCount(studentId));
        }