def submission_record(memberIdIndex, sortCondition, pageNum):
    
    # Not Accept URL Check
    if sortCondition not in (LanguageResources().const.SubmissionDate[1],
                             LanguageResources().const.Memory[1],
                             LanguageResources().const.FileSize[1],
                             LanguageResources().const.Runtime[1]):
        return page_not_found()
    try:       
        # Get MemberId
        try:
            member = select_member(memberIdIndex).first()
        except Exception:
            member = []
            
                # 모든 제출 정보
        submissions = select_all_submissions(memberIdIndex).subquery()
         
        try:
                        # 차트 정보
            chartSubmissionRecords = select_member_chart_submissions(submissions).first()
        except Exception:
            #None Type Exception
            chartSubmissionRecords = []

        # Viiew Value Text
        chartSubmissionDescriptions = [LanguageResources().const.SolvedProblems,
                                       LanguageResources().const.Count,
                                       LanguageResources().const.Solved,
                                       LanguageResources().const.WrongAnswer,
                                       LanguageResources().const.TimeOver,
                                       LanguageResources().const.MemoryOverflow,
                                       LanguageResources().const.CompileError,
                                       LanguageResources().const.RuntimeError]
        
        try:                           
                        # 모든 제출 정보
            count = select_count(submissions.c.memberId).first().\
                                                         count  
            # Sorted
            submissionRecords = get_page_record(submissions_sorted(submissions,
                                                                   sortCondition = sortCondition,
                                                                   DESC = True),
                                                pageNum = pageNum).all()
        except Exception:
            count = 0
            submissionRecords = []

        return render_template(HTMLResources().const.SUBMISSION_RECORD_HTML,
                               memberIdIndex = memberIdIndex,
                               sortCondition = sortCondition,
                               member = member,
                               submissionRecords = submissionRecords,
                               chartSubmissionDescriptions = chartSubmissionDescriptions,
                               chartSubmissionRecords = chartSubmissionRecords,
                               pages = get_page_pointed(pageNum = pageNum,
                                                        count = count))
    except Exception as e:
        # Unknow Error
        return unknown_error(e)
Пример #2
0
def submission_record(memberId, sortCondition, pageNum):
    try:       
        # 모든 제출 정보
        submissions = select_all_submissions(lastSubmission = None,
                                             memberCourseProblemParameter = MemberCourseProblemParameter(memberId = memberId)).subquery()
        # List Count
        try:
            count = select_count(submissions.c.memberId).first().\
                                                         count  
        except Exception:
            count = 0
         
        try:
                        # 차트 정보
            chartSubmissionRecords = select_member_chart_submissions(submissions).first()
        except Exception:
            #None Type Exception
            chartSubmissionRecords = []
        # Viiew Value Text
        chartSubmissionDescriptions = ['Solved Problems',
                                       'Total Submissions',
                                       'Solved',
                                       'Wrong answer',
                                       'Timeover',
                                       'Compile error',
                                       'Runtime error',
                                       'Server error']
        
        try:                           
                        # 모든 제출 정보
            # Sorted
            submissionRecords = get_page_record(submissions_sorted(submissions,
                                                                   sortCondition = sortCondition),
                                                pageNum = pageNum).all()
        except Exception:
            #None Type Exception
            submissionRecords = []
            
        return render_template(HTMLResources().const.SUBMISSION_RECORD_HTML,
                               memberId = memberId,
                               sortCondition = sortCondition,
                               submissionRecords = submissionRecords,
                               chartSubmissionDescriptions = chartSubmissionDescriptions,
                               chartSubmissionRecords = chartSubmissionRecords,
                               pages = get_page_pointed(pageNum = pageNum,
                                                        count = count))
    except Exception:
        # Unknow Error
        return unknown_error()
Пример #3
0
def problem_record(status, problemIndex, sortCondition, error=None):
    # Not Accept URL Check
    if sortCondition not in (LanguageResources().const.SubmissionDate[1],
                             LanguageResources().const.Memory[1],
                             LanguageResources().const.FileSize[1],
                             LanguageResources().const.Runtime[1]):
        return page_not_found()

    try:
        memberId = None
        # Request Post
        if request.method == 'POST':
            # Search Event
            if 'memberId' in request.form:
                memberId = get_request_value(form=request.form,
                                             name='memberId')

        # Chart View Value Text
        chartSubmissionDescriptions = [
            LanguageResources().const.TriedPeople,
            LanguageResources().const.SolvedPeople,
            LanguageResources().const.Count,
            LanguageResources().const.Solved,
            LanguageResources().const.WrongAnswer,
            LanguageResources().const.TimeOver,
            LanguageResources().const.MemoryOverflow,
            LanguageResources().const.CompileError,
            LanguageResources().const.RuntimeError
        ]

        # last Submissions of Problem Info
        lastSubmission = select_last_submissions(
            problemIndex=problemIndex).subquery()
        submissions = select_all_submissions(
            problemIndex=problemIndex,
            lastSubmission=lastSubmission).subquery()
        try:
            # Submitted Members Count
            sumOfSubmissionPeopleCount = select_submissions_peoples_counts(
                submissions).subquery()
            # Solved Members Count
            sumOfSolvedPeopleCount = select_solved_peoples_counts(
                submissions).subquery()
            # Problem Record
            problemSubmittedRecords = select_submitted_records_of_problem(
                problemIndex=problemIndex).subquery()
            # Chart SubmissionRecords
            chartSubmissionRecords = select_problem_chart_submissions(
                sumOfSubmissionPeopleCount, sumOfSolvedPeopleCount,
                problemSubmittedRecords).first()
        except Exception:
            chartSubmissionRecords = []

        # Problem Information (LimitedTime, LimitedMemory
        try:
            problemInformation = select_problem(
                problemIndex=problemIndex).first()
        except Exception:
            problemInformation = []

        # Problem Solved Users
        try:
            # Problem Solved Member
            problemSolvedMemberRecords = submissions_sorted(
                select_solved_submissions(submissions).subquery(),
                sortCondition=sortCondition).all()
        except Exception:
            problemSolvedMemberRecords = []

        # Search Failed Problem
        if status != ENUMResources().const.SOLVED\
           and status != ENUMResources().const.JUDGING\
           and status != ENUMResources().const.SERVER_ERROR:
            try:
                # last Submissions of Problem Info
                lastSubmission = select_last_submissions(
                    memberIdIndex=session[
                        SessionResources().const.MEMBER_ID_INDEX],
                    problemIndex=problemIndex).subquery()
                submissions = select_all_submissions(
                    memberIdIndex=session[
                        SessionResources().const.MEMBER_ID_INDEX],
                    problemIndex=problemIndex,
                    lastSubmission=lastSubmission).subquery()
                # Current Failed Problem
                failedProblem = select_failed_problems(submissions).first()
            except Exception:
                failedProblem = []
        else:
            failedProblem = []

        return render_template(
            HTMLResources().const.PROBLEM_RECORD_HTML,
            memberId=memberId,
            status=status,
            problemSolvedMemberRecords=problemSolvedMemberRecords,
            problemInformation=problemInformation,
            chartSubmissionDescriptions=chartSubmissionDescriptions,
            chartSubmissionRecords=chartSubmissionRecords,
            failedProblem=failedProblem,
            error=error)
    except Exception as e:
        return unknown_error(e)
Пример #4
0
def problem_record(courseId, problemId, sortCondition = OtherResources().const.RUN_TIME):
    """
    navbar - class - Record of problem
    """
    try:
        # Chart View Value Text
        chartSubmissionDescriptions = ['Tried People',
                                       'Solved People',
                                       'Submission Count',
                                       'Solved',
                                       'Wrong Answer',
                                       'Time Over',
                                       'Compile Error',
                                       'Runtime Error']
        
        # last Submissions Info
        submissions = select_all_submissions(lastSubmission = select_last_submissions(memberCourseProblemParameter = MemberCourseProblemParameter(memberId = None,
                                                                                                                                                  courseId = courseId,
                                                                                                                                                  problemId = problemId)).subquery(),
                                            memberCourseProblemParameter = MemberCourseProblemParameter(memberId = None,
                                                                                                        courseId = courseId,
                                                                                                        problemId = problemId)).subquery()
        try:
            # Submitted Members Count
            sumOfSubmissionPeopleCount = select_submissions_peoples_counts(submissions).subquery()
            # Solved Members Count
            sumOfSolvedPeopleCount = select_solved_peoples_counts(submissions).subquery()
            # Problem Rrecord
            problemSubmittedRecords = select_submitted_records_of_problem(memberCourseProblemParameter = MemberCourseProblemParameter(memberId = None,
                                                                                                                                      courseId = courseId,
                                                                                                                                      problemId = problemId)).subquery()
            # Chart SubmissionRecords
            chartSubmissionRecords = select_problem_chart_submissions(sumOfSubmissionPeopleCount,
                                                                      sumOfSolvedPeopleCount,
                                                                      problemSubmittedRecords).first()
        except:
            print 'SubmittedRecordsOfProblems table is empty'
            chartSubmissionRecords = []
            
        # Problem Information (LimitedTime, LimitedMemory
        try:
            problemInformationRecords = select_problem_informations(memberCourseProblemParameter = MemberCourseProblemParameter(memberId = None,
                                                                                                                                courseId = None,
                                                                                                                                problemId = problemId)).first()
        except Exception:
            problemInformationRecords = []
        # Problem Solved Users
        try:
            # Problem Solved Member
            problemSolvedMemberRecords = submissions_sorted(select_solved_submissions(submissions).subquery(),
                                                            sortCondition = sortCondition).all()
                
        except Exception:
            problemSolvedMemberRecords = []
        
        return render_template(HTMLResources().const.PROBLEM_RECORD_HTML,
                               SETResources = SETResources,
                               SessionResources = SessionResources,
                               LanguageResources = LanguageResources,
                               courseId = courseId,
                               problemSolvedMemberRecords = problemSolvedMemberRecords,
                               problemInformationRecords = problemInformationRecords,
                               chartSubmissionDescriptions = chartSubmissionDescriptions,
                               chartSubmissionRecords = chartSubmissionRecords)
    except Exception:
        return unknown_error()
Пример #5
0
def submission_record(memberIdIndex, sortCondition, pageNum):

    # Not Accept URL Check
    if sortCondition not in (LanguageResources().const.SubmissionDate[1],
                             LanguageResources().const.Memory[1],
                             LanguageResources().const.FileSize[1],
                             LanguageResources().const.Runtime[1]):
        return page_not_found()
    try:
        # Get MemberId
        try:
            member = select_member(memberIdIndex).first()
        except Exception:
            member = []

            # 모든 제출 정보
        submissions = select_all_submissions(memberIdIndex).subquery()

        try:
            # 차트 정보
            chartSubmissionRecords = select_member_chart_submissions(
                submissions).first()
        except Exception:
            #None Type Exception
            chartSubmissionRecords = []

        # Viiew Value Text
        chartSubmissionDescriptions = [
            LanguageResources().const.SolvedProblems,
            LanguageResources().const.Count,
            LanguageResources().const.Solved,
            LanguageResources().const.WrongAnswer,
            LanguageResources().const.TimeOver,
            LanguageResources().const.MemoryOverflow,
            LanguageResources().const.CompileError,
            LanguageResources().const.RuntimeError
        ]

        try:
            # 모든 제출 정보
            count = select_count(submissions.c.memberId).first().\
                                                         count
            # Sorted
            submissionRecords = get_page_record(submissions_sorted(
                submissions, sortCondition=sortCondition, DESC=True),
                                                pageNum=pageNum).all()
        except Exception:
            count = 0
            submissionRecords = []

        return render_template(
            HTMLResources().const.SUBMISSION_RECORD_HTML,
            memberIdIndex=memberIdIndex,
            sortCondition=sortCondition,
            member=member,
            submissionRecords=submissionRecords,
            chartSubmissionDescriptions=chartSubmissionDescriptions,
            chartSubmissionRecords=chartSubmissionRecords,
            pages=get_page_pointed(pageNum=pageNum, count=count))
    except Exception as e:
        # Unknow Error
        return unknown_error(e)
def problem_record(status, problemIndex, sortCondition, error = None):
    # Not Accept URL Check
    if sortCondition not in (LanguageResources().const.SubmissionDate[1],
                             LanguageResources().const.Memory[1],
                             LanguageResources().const.FileSize[1],
                             LanguageResources().const.Runtime[1]):
        return page_not_found()
    
    try:
        memberId = None
        # Request Post
        if request.method == 'POST':
            # Search Event
            if 'memberId' in request.form:
                memberId = get_request_value(form = request.form,
                                             name = 'memberId')
                        

        # Chart View Value Text
        chartSubmissionDescriptions = [LanguageResources().const.TriedPeople,
                                       LanguageResources().const.SolvedPeople,
                                       LanguageResources().const.Count,
                                       LanguageResources().const.Solved,
                                       LanguageResources().const.WrongAnswer,
                                       LanguageResources().const.TimeOver,
                                       LanguageResources().const.MemoryOverflow,
                                       LanguageResources().const.CompileError,
                                       LanguageResources().const.RuntimeError]
        
        # last Submissions of Problem Info
        lastSubmission = select_last_submissions(problemIndex = problemIndex).subquery()
        submissions = select_all_submissions(problemIndex = problemIndex,
                                             lastSubmission = lastSubmission).subquery()
        try:
            # Submitted Members Count
            sumOfSubmissionPeopleCount = select_submissions_peoples_counts(submissions).subquery()
            # Solved Members Count
            sumOfSolvedPeopleCount = select_solved_peoples_counts(submissions).subquery()
            # Problem Record
            problemSubmittedRecords = select_submitted_records_of_problem(problemIndex = problemIndex).subquery()
            # Chart SubmissionRecords
            chartSubmissionRecords = select_problem_chart_submissions(sumOfSubmissionPeopleCount,
                                                                      sumOfSolvedPeopleCount,
                                                                      problemSubmittedRecords).first()
        except Exception:
            chartSubmissionRecords = []
       
        # Problem Information (LimitedTime, LimitedMemory
        try:
            problemInformation = select_problem(problemIndex = problemIndex).first()
        except Exception:
            problemInformation = []
            
        # Problem Solved Users
        try:
            # Problem Solved Member
            problemSolvedMemberRecords = submissions_sorted(select_solved_submissions(submissions).subquery(),
                                                            sortCondition = sortCondition).all()
        except Exception:
            problemSolvedMemberRecords = []
        
        # Search Failed Problem
        if status != ENUMResources().const.SOLVED\
           and status != ENUMResources().const.JUDGING\
           and status != ENUMResources().const.SERVER_ERROR:
            try:
                # last Submissions of Problem Info
                lastSubmission = select_last_submissions(memberIdIndex = session[SessionResources().const.MEMBER_ID_INDEX],
                                                         problemIndex = problemIndex).subquery()
                submissions = select_all_submissions(memberIdIndex = session[SessionResources().const.MEMBER_ID_INDEX],
                                                     problemIndex = problemIndex,
                                                     lastSubmission = lastSubmission).subquery()
                # Current Failed Problem
                failedProblem = select_failed_problems(submissions).first()
            except Exception:
                failedProblem = []
        else:
            failedProblem = []

        return render_template(HTMLResources().const.PROBLEM_RECORD_HTML,
                               memberId = memberId,
                               status =  status,
                               problemSolvedMemberRecords = problemSolvedMemberRecords,
                               problemInformation = problemInformation,
                               chartSubmissionDescriptions = chartSubmissionDescriptions,
                               chartSubmissionRecords = chartSubmissionRecords,
                               failedProblem = failedProblem,
                               error = error)
    except Exception as e:
        return unknown_error(e)