コード例 #1
0
# for i in datalist:
#     student = Student_T(studentID=i[0], department_id='CSE', program_id='BSc')
#     student.save()

# Enrollment

for i in datalist:
    courseID = courseNameAll
    sectionNo = i[2]
    section_id = Section_T.objects.raw('''
        SELECT *
        FROM mainapp_section_t
        WHERE course_id = '{}' AND sectionNo = {};
    '''.format(courseID, sectionNo))
    enrollment = Enrollment_T(student_id=i[0],
                              section_id=section_id[0].id,
                              semester=semesterNo,
                              year=yearNo)
    enrollment.save()

# PLO

# plo1 = PLO_T(ploNo='PLO01', details='Knowledge', program_id='BSc')
# plo2 = PLO_T(ploNo='PLO02', details='Requirement Analysis', program_id='BSc')
# plo3 = PLO_T(ploNo='PLO03', details='Problem Analysis', program_id='BSc')
# plo4 = PLO_T(ploNo='PLO04', details='Design', program_id='BSc')
# plo5 = PLO_T(ploNo='PLO05', details='Problem Solving', program_id='BSc')
# plo6 = PLO_T(ploNo='PLO06', details='Implementation', program_id='BSc')
# plo7 = PLO_T(ploNo='PLO07', details='Experiment and Analysis', program_id='BSc')
# plo8 = PLO_T(ploNo='PLO08', details='Community Engagement and Engineering', program_id='BSc')
# plo9 = PLO_T(ploNo='PLO09', details='Teamwork', program_id='BSc')
# plo10 = PLO_T(ploNo='PLO10', details='Communication', program_id='BSc')
コード例 #2
0
for i in datalist:
    student = Student_T(studentID=i[0], department_id='CSE', program_id='BSc')
    student.save()

# Enrollment

for i in datalist:
    courseID = 'CSE303'
    sectionNo = i[2]
    section_id = Section_T.objects.raw('''
        SELECT *
        FROM mainapp_section_t
        WHERE course_id = '{}' AND sectionNo = {};
    '''.format(courseID, sectionNo))
    enrollment = Enrollment_T(student_id=i[0],
                              section_id=section_id[0].id,
                              semester='Summer',
                              year='2019')
    enrollment.save()

# PLO

plo1 = PLO_T(ploNo='PLO01', details='Knowledge', program_id='BSc')
plo2 = PLO_T(ploNo='PLO02', details='Requirement Analysis', program_id='BSc')
plo3 = PLO_T(ploNo='PLO03', details='Problem Analysis', program_id='BSc')
plo4 = PLO_T(ploNo='PLO04', details='Design', program_id='BSc')
plo5 = PLO_T(ploNo='PLO05', details='Problem Solving', program_id='BSc')
plo6 = PLO_T(ploNo='PLO06', details='Implementation', program_id='BSc')
plo7 = PLO_T(ploNo='PLO07',
             details='Experiment and Analysis',
             program_id='BSc')
plo8 = PLO_T(ploNo='PLO08',
コード例 #3
0
ファイル: views.py プロジェクト: saditahmid/spm
def evaluation(request):
    if request.method == 'POST':
        course_id = request.POST.get('course-id')
        section = request.POST.get('section')
        semester = request.POST.get('semester')
        year = request.POST.get('year')
        
        student_id = request.POST.getlist('student_id')
        coMarks = []
        for i in range(len(student_id)):
            coMarks.append(request.POST.getlist(f'coMarks{i}'))
        
        section_id = None
        try:
            section_id = Section_T.objects.raw('''
                SELECT *
                FROM mainapp_section_t
                WHERE course_id = '{}' AND sectionNo = {};
            '''.format(course_id, section))
            section_id = section_id[0].id
        except:
            section_id = None
        assessment_list = []
        coLength = 0
        try:
            coLength = len(coMarks[0]) + 1
        except:
            coLength = 0
        for j in range(1, coLength):
            assessment_id = None
            try:
                assessment_id = Assessment_T.objects.raw('''
                    SELECT *
                    FROM mainapp_assessment_t
                    WHERE section_id = {} AND co_id IN (
                        SELECT id
                        FROM mainapp_co_t
                        WHERE course_id = '{}' AND coNo = {}
                    )
                '''.format(section_id, course_id, j))
                assessment_list.append(assessment_id[0].assessmentNo)
            except:
                assessment_id = None
                assessment_list.append(assessment_id)
        
        for i in range(len(student_id)):
            enrollment_id = None
            try:
                enrollment_id = Enrollment_T.objects.raw('''
                    SELECT *
                    FROM mainapp_enrollment_t
                    WHERE student_id = '{}' AND section_id = {}
                '''.format(student_id[i], section_id))
                enrollment_id = enrollment_id[0].enrollmentID
            except:
                enrollment_id = None
                
            if enrollment_id is None:
                enrollment = Enrollment_T(student_id=student_id[i], section_id=section_id, semester=semester, year=year)
                enrollment.save()
                enrollment_id = enrollment.enrollmentID
            
            for j in range(len(assessment_list)):
                evaluation = Evaluation_T(enrollment_id=enrollment_id, assessment_id=assessment_list[j], obtainedMarks=coMarks[i][j])
                evaluation.save()
                
        return redirect('dataentry')