From 14ad35d2684cfd522b756c2d8318fac0483e8bf9 Mon Sep 17 00:00:00 2001 From: Aaron Lee Date: Wed, 29 Dec 2021 23:13:51 +0800 Subject: [PATCH] Added group class export namelist --- .gitignore | 4 +- export.py | 66 +++++++++++++++++++++ manage/__pycache__/admin.cpython-39.pyc | Bin 5406 -> 0 bytes manage/__pycache__/group.cpython-39.pyc | Bin 3418 -> 0 bytes manage/__pycache__/homeroom.cpython-39.pyc | Bin 4541 -> 0 bytes manage/__pycache__/manage.cpython-39.pyc | Bin 8567 -> 0 bytes manage/__pycache__/student.cpython-39.pyc | Bin 1620 -> 0 bytes manage/admin.py | 48 +++++++++++++++ templates/admin_export.html | 21 +++++++ 9 files changed, 138 insertions(+), 1 deletion(-) delete mode 100644 manage/__pycache__/admin.cpython-39.pyc delete mode 100644 manage/__pycache__/group.cpython-39.pyc delete mode 100644 manage/__pycache__/homeroom.cpython-39.pyc delete mode 100644 manage/__pycache__/manage.cpython-39.pyc delete mode 100644 manage/__pycache__/student.cpython-39.pyc diff --git a/.gitignore b/.gitignore index b400de5..440e80e 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,6 @@ test*.* __pycache__/* excel/* -venv/* \ No newline at end of file +venv/* +.idea/* +__pycache__/* \ No newline at end of file diff --git a/export.py b/export.py index df929e3..b818d14 100644 --- a/export.py +++ b/export.py @@ -214,6 +214,72 @@ def create_student_list(workbook, class_code): return workbook +def create_group_student_list(workbook, cclass, data): + class_code = [cclass['category'], cclass['class_id']] + ws = workbook.create_sheet(class_code[0] + '.' + class_code[1]) + ws.merge_cells('A1:H1') + ws['A1'] = '台北市私立復興實驗高級中學分組課學生名單' + ws['A1'].font = Font(name="DFKai-SB", size=15, bold=True) + ws['A1'].alignment = center + # loop over A:I + for i in range(0, 10): + ws[str(chr(ord('A') + i)) + '1'].border = border + ws.merge_cells('I1:L1') + ws['I1'] = class_code[0] + class_code[1] + ws['I1'].font = Font(name='Calibri', size=15, bold=True) + ws['I1'].alignment = center + ws['I1'].border = border + ws['J1'].border = border + ws['K1'].border = border + ws['L1'].border = border + ws.column_dimensions['A'].width = 6 + ws.column_dimensions['B'].width = 4 + ws.column_dimensions['C'].width = 11 + ws.column_dimensions['D'].width = 12 + ws.row_dimensions[1].height = 25 + ws.row_dimensions[2].height = 20 + + ws['A2'] = '班級' + ws['A2'].font = Font(name="Calibri", size=13, bold=True) + ws['A2'].alignment = center + ws['A2'].border = bold_bottom + ws['B2'] = '#' + ws['B2'].font = Font(name="Calibri", size=13, bold=True) + ws['B2'].alignment = center + ws['B2'].border = bold_bottom + ws['C2'] = '姓名' + ws['C2'].font = Font(name="DFKai-SB", size=13, bold=True) + ws['C2'].alignment = center + ws['C2'].border = bold_bottom + ws['D2'] = 'Name' + ws['D2'].font = Font(name="Calibri", size=13, bold=True) + ws['D2'].alignment = center + ws['D2'].border = bold_bottom + for i in range(4, 12): + ws[str(chr(ord('A') + i)) + '2'].border = bold_bottom + ws.column_dimensions[str(chr(ord('A') + i))].width = 5.8 + + cnt = 0 + for i in data: + ws['A' + str(3 + cnt)] = str(i[0]) + str(i[1]) + ws['A' + str(3 + cnt)].font = std_font + ws['A' + str(3 + cnt)].alignment = center + ws['B' + str(3 + cnt)] = i[2] + ws['B' + str(3 + cnt)].font = std_font + ws['B' + str(3 + cnt)].alignment = center + ws['C' + str(3 + cnt)] = i[3] + ws['C' + str(3 + cnt)].font = Font(name="DFKai-SB", size=14) + ws['C' + str(3 + cnt)].alignment = center + ws['D' + str(3 + cnt)] = i[4] + ws['D' + str(3 + cnt)].font = std_font + ws['D' + str(3 + cnt)].alignment = center + ws.row_dimensions[3 + cnt].height = 19 + for j in range(0, 12): + ws[str(chr(ord('A') + j)) + str(3 + cnt)].border = bold_bottom if (cnt + 1) % 5 == 0 else border + cnt += 1 + return workbook + + def create_teacher_periods(workbook, teacher_name, orig_username=''): ws = workbook.create_sheet(teacher_name) ws.merge_cells('A1:E1') diff --git a/manage/__pycache__/admin.cpython-39.pyc b/manage/__pycache__/admin.cpython-39.pyc deleted file mode 100644 index c8ad650842b1e7bef7f04f0dcc4287a2ebf23a2a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5406 zcmds5O>7&-6`on{l1qxDek@C(f48oKn5iP#iPJW%U?i55R*fyCCLPymgEhq&k+evz zG&^)`mMqXRhajj?HP{$GJG!f1u$f+x)pZZLy~ z+Qy2>&6^erF_T$EgN5%JEW+#$NSm&N^-7ePMXKjxY)H>X^n4ungZTtY>Umqw5AX1g zuu(l9)$?OJ{D;`Mo{#DI!#n&FY*Nn;>G`Q0{uDc+=i_?*=nnrec3jUV*oiDjpL`5j zk~CHHC1vGVwOo5LmZ|1z`6AEgAq>R23VmZCr_6VjvpHamRJkm9%rD@p-5(k?4s8ya z{})P#ByHl4Ny=!7Fk?L=j!1)r+B8dKs7)x5Xh3t_xJQN4Xuv4E71<^&!Ymg4fHcWG z7_&vC-6k!gX>3JdE!3p*pnCb>n#$1s;j zk($AhYmse(lFjdcyrFG4!!=TyHi?Yi`7ttu&Ny0{SA9jWQsP4l_pg%TAWKs?{X&e4vd}tCh0=*43uC36o8ESNR8`eR$ z5zsYUCap*_4Eo+|*-e{GfL4)P6s)yYhF&l;OW-+)E5SHLG{?PN4p`G1nscg`Gnm)w zsT7$d_vq#~wOx<&oFXbm+0kaCNZ7GYXfw)=vlDkMgw2wQ`}Nhj&xI@RY;X|*w?Bzw zDqhj6OA&@q0Wh%hGoWWd%R=){04aj~-kWIACfx!%Z&P75HBx?RY?>h7XhcA0*<&w1 zjsQ1+F6PU;kpBB+SxOtqm^rIx`2i70Sbg$J<|-V-&*byMt5rD9%yWNTdK;NHrQ|i1 zuN8P7re`+psMu_!?8|~z-MEkd8UKJr8YdC#ZhqD0H90d|@e28he*rpO&PH)@DZ6kb z=PWMemYsmlIa3sQ#;2V^CGY$0w8QceM#1r?om#y*?ZDY(-G_lEdD?mR%}ZAovd)s4> z=;!yRorgdB)x%%h|C&>e!pyYu`S1Sl=+h6KI-2#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^7zAn}%sOQimxvgzlpNb@FuG)Wwg@<`N4bbYmbD7! z71vqctr7abtTaJF9 zZoO5ey<&Ij*qceNLL{f^xK2w&HxKP_nO&SIdJY>H-|j`qfpEl^e7M3B+#2IX*k6kS#mLC?*T z3aIIIw=N<*U9us}LW6Oai6Gsfg$5i{p(6DPW!LFRcC{*W?lEE7^*VKk2=ICpTEy7o zt|J1ZQLA(C;?`u}1gfr0cxp-=dNwSpM;+Q}gI$n^SEzRyi*VVkQRcceF7OT;flVeq zZbi6%46wLd9F>ca&U2woOl=1&%0dT(xyWX=cbc+q5_ zJO7ZwSv_yt%yp`i&M#5E<+=6wMbCr8Y^Oj6KF+Vzcg6S#pXu^h;XlHFG!uugi6dGF zhhCUQXBPj<&=U9(>=2HDG9u2$rpw$SCiP(r~WjIh!zJ814nTJ zcF)0X6m&sTzX-bt(Cm8wy@g|bEM*(-+J?Zhv^)=%QOvFb_LY<=!o`MD@ZhDxMfi5L zLF=pnZ=6s*FJGVeJX0^60Q}$LQDvj*cw|@rKO%Ia=8{I0-jeS`F5mT#1z`Uh7P@{U diff --git a/manage/__pycache__/homeroom.cpython-39.pyc b/manage/__pycache__/homeroom.cpython-39.pyc deleted file mode 100644 index 27979771cda020144d43aa76b6fbc073089ad3c4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4541 zcmds4&2Jmm5#P7mFD^yu(~gz4!B(gv(Pb@I)<=@sfn}3vl`3)~%Kb3V5ES21qRkKa z?b3DF6%ar!P@qi_6lf1cQAj{928y0?Dhl*cpod<2dZz$|5%^yag0{bT%P(1u;X`}r z5<73+ym_;;k2AlSEvM72hU=Yw|E+AF(X@ZkWcV^LxrRIV1qjzTt7}`D&$#aE2m0-V zpSWZ21UGgVH$T$3#qEdM0lRG~xzm>?xvS)slBf7cS3k`&N^UFpXkR|Y$Ccbs@`=8D zl20jllAkGR*|SgJla^(YU69UhtKo}QtIaF@Cit$9cUsGGR_WIQ4940jcH+m>(kmHUh;_TYoU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!lkapNA@fzw=Vz0F)s3OM6{1wu*Dy>GN7G_g%mQT{^ z1tMRk)nxw!#WzSuEr)aml}54$QhyM}_Nd?tLBP~-{+9OI+o;OB7oihe0qIo}i@E*Z z7*!O^M%3@DPU8&K9OLZghDqZapF0@Eo7mr(JcSca6`XNs5tb={Sbr`+Ah-=A6${Nf z)}c+^Ug$*n0aM*wQUOK+eO^-ag$BAn;sF#dX@Cmi2`bzns34gG;D8lyNpMNUx!_#I zrNE^WHv(=%acOXA#bv-{075A~8aYuia-&o<5~ZU|WFnQvRLYNoBH^neaTkhozpy_V zjduMQi^fQgPXJ0j1vDVhk=kgrRTuhcMDRfR^o+@;ZAPQe#f}(Ckp5#hp^u2x#jN;#aXRh#X4eNM@8Gc#G0STI(pipJI15By-Z z@5XccW$K;@Y48BmNypfSnc6;R2BgV@8o%H9N#86b`!JC3cngW?dI1n2=LcXwo1PCI z16{F*WXPtU1sQPyFJWCQ6IlU~=ANiEL-8636lxG)h}S`~<3l~cNyr!qfosr|3H)P3 z7KmIXvPfi!$TE=?L2w|h5_t+iCi@7&gC2lvK`*!lG5`>Q47y#krUW4aKq1aDW)yf3 ztV}2{c{v7=HQ4B!I|U*Lm1<2iPP7^)z8!yxea~(+?ihzAumfL*hZbQ5S`BJ2n3_|A zp(~CWjD+HV8v91*phdwKqbloGWKsS`OqF%UQHJBPUNu#goBbl}sw_-(vygx}Zbub( z=V(fZJrsJwVfR0-q_dUTURjO9Z;%pk5T2@ACqr*2=BS_z%2gbFwooyr-dVlw8@<;Z z3d^TrX{;Yh-9Pxp*b}@0(hDRP!4rp$`pz+?RM?2Op|O#5WwP3CRziHv1u}WP-u6{; zNT*byFXK`vE{&$ZhqfYxuzM5hG0Ra3xwEzGB diff --git a/manage/__pycache__/manage.cpython-39.pyc b/manage/__pycache__/manage.cpython-39.pyc deleted file mode 100644 index 8c562c7a89c95f7f8af13beed3cdbd486fd1a73e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8567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__pycache__/student.cpython-39.pyc b/manage/__pycache__/student.cpython-39.pyc deleted file mode 100644 index a74af622c181e4fbadb7c5273b99f2a7a67580aa..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1620 zcmc&!%ZnpL7_aJ1`jMGL)b%kcYk|s6q}ledzCgvybVe7(ET*%lb7^|IYLYnp2vybU z4p|T~H(gKSK@fMr%N+FNK}7Jl|3h7681`S7i+7JCcXL2!ESX2(U|dj-QyXdg80-;$3k8l$t*3`;fKO` zk0)PzbMo^~$De+C^1~;0K0Dm8!@<>{vk|IV9%t;xQgu0&DO0tq zpn#B!SUE|_dA}$!-UQct1)%M!`;rk$_9IB>IFIHTQVwTy%vmB;le0a}#3+)*KFfhh zOo(xjtHx4Jca;TxMZuNLK4wWNnR51+Oh$2ldCHg{FtIO-iQkbDe8qXf{4CDnAzPC9;^dlYiBa*< zB3Y0t-BIEk05UA>U<;qC(81^7%L&L2R+i@eKhgh7Q2lS{KQ(3;BkBH&HsJ7>AZ}~W zVJgzO8 zXE+sv_ku`h?|(%pAk`Ca(reqw-7E7%LW>CHZloov!YU_lj2r=gh$kqlFu*E&MwkeX1h> diff --git a/manage/admin.py b/manage/admin.py index bbb41f5..b8340c8 100644 --- a/manage/admin.py +++ b/manage/admin.py @@ -124,6 +124,54 @@ def admin_export_student_list_all(): return send_file(excel_stream, attachment_filename='student_list_all.xlsx', as_attachment=True) +@admin.route('/manage/admin/export/group_student_list', methods=['POST']) +def admin_export_group_student_list(): + if check_login_status() or session['subuser_type'] != 'admin': + return redirect('/logout') + refresh_token() + cclass = { + 'category': request.form['category'], + 'class_id': request.form['class_id'], + } + db = refresh_db() + cursor = db.cursor() + cursor.execute("SELECT grade,class_,num,name,ename FROM students WHERE classes LIKE " + '\'%\"' + cclass[ + 'category'] + '\": \"' + cclass['class_id'] + '\"%\'' + " ORDER BY grade ASC,class_ ASC,num ASC") + students = cursor.fetchall() + workbook = Workbook() + workbook.remove_sheet(workbook.get_sheet_by_name('Sheet')) + workbook = create_group_student_list(workbook, cclass, students) + excel_stream = io.BytesIO() + workbook.save(excel_stream) + excel_stream.seek(0) + return send_file(excel_stream, attachment_filename='student_list_' + cclass['category'] + '_' + cclass[ + 'class_id'] + '.xlsx', as_attachment=True) + +@admin.route('/manage/admin/export/group_student_list_only_category', methods=['POST']) +def admin_export_group_student_list_only_category(): + if check_login_status() or session['subuser_type'] != 'admin': + return redirect('/logout') + refresh_token() + cclass = { + 'category': request.form['category'], + } + db = refresh_db() + cursor = db.cursor() + cursor.execute("SELECT subclass FROM gpclasses WHERE category=%s", (cclass['category'], )) + classes = cursor.fetchall() + workbook = Workbook() + workbook.remove_sheet(workbook.get_sheet_by_name('Sheet')) + for i in classes: + cclass['class_id'] = i[0] + cursor.execute("SELECT grade,class_,num,name,ename FROM students WHERE classes LIKE " + '\'%\"' + cclass[ + 'category'] + '\": \"' + cclass['class_id'] + '\"%\'' + " ORDER BY grade ASC,class_ ASC,num ASC") + students = cursor.fetchall() + workbook = create_group_student_list(workbook, cclass, students) + excel_stream = io.BytesIO() + workbook.save(excel_stream) + excel_stream.seek(0) + return send_file(excel_stream, attachment_filename='student_list_' + cclass['category'] + '.xlsx', as_attachment=True) + @admin.route('/manage/admin/export/teacher_period', methods=['POST']) def admin_export_teacher_period(): if check_login_status() or session['subuser_type'] != 'admin': diff --git a/templates/admin_export.html b/templates/admin_export.html index 1951af6..07c975e 100644 --- a/templates/admin_export.html +++ b/templates/admin_export.html @@ -78,6 +78,21 @@ +
+

分組課學生名單

+
+
+ + +
+
+ + +
+ + +
+
{% include 'footer.html' %} @@ -87,6 +102,12 @@ + \ No newline at end of file