Skip to content

Commit 0bd05c4

Browse files
authored
Merge pull request #17 from team-MoPlus/develop
Fix: pdf reponsibility modified
2 parents 0173dff + a36c6f3 commit 0bd05c4

2 files changed

Lines changed: 89 additions & 84 deletions

File tree

582 Bytes
Binary file not shown.

pdfmain.py

Lines changed: 89 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -98,172 +98,175 @@ def create_review_note(data: DetailResultApplication, file_name: str, buffer):
9898
text_y = 500
9999
if len(data.incorrectProblems) <= 10:
100100
for i, problem in enumerate(data.incorrectProblems):
101-
102101
if i%5 == 0 and i > 0:
103-
text_y -= 30
102+
text_y -= 27
104103

105104
c.setFillColor(black_color)
106-
c.setFont("Pretendard-Regular", 20)
105+
c.setFont("Pretendard-Regular", 16)
107106
p_num = f'{problem.problemNumber}번'
108107
c.drawString(25 + (i%5)*105, text_y, p_num)
109108

110-
p_num_width = c.stringWidth(p_num, "Pretendard-Regular", 24)
109+
p_num_width = c.stringWidth(p_num, "Pretendard-Regular", 20)
111110

112111
box_width = 40
113-
box_height = 20
114-
box_x = 24 + (i%5)*105 + p_num_width
112+
box_height = 16
113+
box_x = 23 + (i%5)*105 + p_num_width
115114
box_y = text_y - 3
116115

117116
# 텍스트 그리기
118-
c.setFont("Pretendard-Regular", 14) # 글꼴과 크기 설정
117+
c.setFont("Pretendard-Regular", 10) # 글꼴과 크기 설정
119118
c.setFillColor(orange_color)
120-
c.drawString(box_x + 6, box_y + 4, f'{int(problem.correctRate)}%') # 박스 안 텍스트 위치 조정
121-
rate_width = c.stringWidth(f'{int(problem.correctRate)}%', "Pretendard-Regular", 14)
119+
c.drawString(box_x + 5, box_y + 4, f'{int(problem.correctRate)}%') # 박스 안 텍스트 위치 조정
120+
rate_width = c.stringWidth(f'{int(problem.correctRate)}%', "Pretendard-Regular", 10)
122121

123122
# 박스 그리기 (배경)
124123
c.setLineWidth(1) # 테두리 두께 설정 (얇게)
125124
c.setStrokeColor(HexColor("#FFA500")) # 주황색 테두리
126-
c.roundRect(box_x, box_y, rate_width + 2, box_height, radius=4, stroke=1, fill=0)
125+
c.roundRect(box_x+1, box_y, rate_width + 7, box_height, radius=4, stroke=1, fill=0)
126+
else:
127+
for i, problem in enumerate(data.incorrectProblems):
128+
if i%5 == 0 and i > 0:
129+
text_y -= 20
130+
131+
c.setFillColor(black_color)
132+
c.setFont("Pretendard-Regular", 10)
133+
p_num = f'{problem.problemNumber}번'
134+
c.drawString(25 + (i%5)*105, text_y+10, p_num)
127135

136+
p_num_width = c.stringWidth(p_num, "Pretendard-Regular", 14)
137+
138+
box_width = 40
139+
box_height = 12
140+
box_x = 24 + (i%5)*105 + p_num_width
141+
box_y = text_y + 7
142+
143+
# 텍스트 그리기
144+
c.setFont("Pretendard-Regular", 8) # 글꼴과 크기 설정
145+
c.setFillColor(orange_color)
146+
c.drawString(box_x + 6, box_y + 4, f'{int(problem.correctRate)}%') # 박스 안 텍스트 위치 조정
147+
rate_width = c.stringWidth(f'{int(problem.correctRate)}%', "Pretendard-Regular", 8)
148+
149+
# 박스 그리기 (배경)
150+
c.setLineWidth(1) # 테두리 두께 설정 (얇게)
151+
c.setStrokeColor(HexColor("#FFA500")) # 주황색 테두리
152+
c.roundRect(box_x+2, box_y, rate_width + 8, box_height, radius=4, stroke=1, fill=0)
128153

129-
else:
130-
for i, problem in enumerate(data.incorrectProblems):
131-
if i%5 == 0 and i > 0:
132-
text_y -= 30
133-
134-
c.setFillColor(black_color)
135-
c.setFont("Pretendard-Regular", 20)
136-
p_num = f'{problem.problemNumber}번'
137-
c.drawString(25 + (i%5)*105, text_y, p_num)
138-
139-
p_num_width = c.stringWidth(p_num, "Pretendard-Regular", 24)
140-
141-
box_width = 40
142-
box_height = 20
143-
box_x = 24 + (i%5)*105 + p_num_width
144-
box_y = text_y - 3
145-
146-
# 박스 그리기 (배경)
147-
c.setLineWidth(1) # 테두리 두께 설정 (얇게)
148-
c.setStrokeColor(HexColor("#FFA500")) # 주황색 테두리
149-
c.roundRect(box_x, box_y, box_width, box_height, radius=4, stroke=1, fill=0)
150-
151-
# 텍스트 그리기
152-
c.setFont("Pretendard-Regular", 14) # 글꼴과 크기 설정
153-
c.setFillColor(orange_color)
154-
c.drawString(box_x + 6, box_y + 4, f'{int(problem.correctRate)}%') # 박스 안 텍스트 위치 조정
155154
# 점선 상자1
156-
draw_dashed_box(c, 30, 190, width - 60, 270)
155+
draw_dashed_box(c, 30, 175, width - 60, 255)
157156

158157
### 현재 등급에서 맞췄어야 하는 문제 ###
159158
# 세로선 그리기 (오렌지 색상)
160159
c.setDash([])
161-
draw_vertical_orange(c, 40, 445, 40, 420, orange_color) # 세로선 좌표
160+
draw_vertical_orange(c, 40, 425, 40, 400, orange_color) # 세로선 좌표
162161

163162
c.setFillColor(black_color)
164-
c.setFont("Pretendard-Bold", 20)
165-
c.drawString(48, 426, "현재 등급에서 맞췄어야 하는 문제") # 텍스트 위치 설정
163+
c.setFont("Pretendard-Bold", 18)
164+
c.drawString(48, 406, "현재 등급에서 맞췄어야 하는 문제") # 텍스트 위치 설정
166165
c.setFillColor(grey_color)
167-
text = c.beginText(53, 400)
168-
text.setFont("Pretendard-Regular", 14)
169-
text.setTextOrigin(53, 400)
166+
text = c.beginText(53, 380)
167+
text.setFont("Pretendard-Regular", 12)
168+
text.setTextOrigin(53, 380)
170169
text.textLine("현재 틀린 문제 중 현재 등급에서 다음 등급으로 넘어가기 위해서 반드시 공부하고")
171170
text.textLine("넘어가야하는 문제들이예요.")
172171
c.drawText(text)
173172

174173
if len(data.forCurrentRating) == 0:
175174
c.setFillColor(HexColor("#95E0BB"))
176-
c.setFont("Pretendard-Bold", 20)
177-
c.drawString(52, 348, "모두 맞았어요!")
175+
c.setFont("Pretendard-Bold", 18)
176+
c.drawString(52, 338, "모두 맞았어요!")
178177
else:
179-
text_y = 355
178+
text_y = 335
180179
for i, problem in enumerate(data.forCurrentRating):
181180

182181
if i%5 == 0 and i > 0:
183182
text_y -= 30
184183

185184
c.setFillColor(black_color)
186-
c.setFont("Pretendard-Regular", 18)
185+
c.setFont("Pretendard-Regular", 14)
187186
p_num = f'{problem.problemNumber}번'
188187
c.drawString(45 + (i%5)*105, text_y, p_num)
189188

190-
p_num_width = c.stringWidth(p_num, "Pretendard-Regular", 18)
189+
p_num_width = c.stringWidth(p_num, "Pretendard-Regular", 14)
191190

192191
box_width = 40
193192
box_height = 20
194193
box_x = 50 + (i%5)*105 + p_num_width
195194
box_y = text_y - 4
195+
rate_width = c.stringWidth(f'{int(problem.correctRate)}%', "Pretendard-Regular", 12)
196+
197+
# 텍스트 그리기
198+
c.setFont("Pretendard-Regular", 12) # 글꼴과 크기 설정
199+
c.setFillColor(orange_color)
200+
c.drawString(box_x + 4, box_y + 5, f'{int(problem.correctRate)}%') # 박스 안 텍스트 위치 조정
196201

197202
# 박스 그리기 (배경)
198203
c.setLineWidth(1) # 테두리 두께 설정 (얇게)
199204
c.setStrokeColor(HexColor("#FFA500")) # 주황색 테두리
200-
c.roundRect(box_x, box_y, box_width, box_height, radius=4, stroke=1, fill=0)
205+
c.roundRect(box_x, box_y, rate_width + 8, box_height, radius=4, stroke=1, fill=0)
201206

202-
# 텍스트 그리기
203-
c.setFont("Pretendard-Regular", 14) # 글꼴과 크기 설정
204-
c.setFillColor(orange_color)
205-
c.drawString(box_x + 6, box_y + 5, f'{int(problem.correctRate)}%') # 박스 안 텍스트 위치 조정
207+
206208

207209
### 다음 등급을 위해 맞춰야 하는 문제 ###
208210
# 세로선 그리기 (오렌지 색상)
209211
c.setDash([])
210-
draw_vertical_orange(c, 40, 311, 40, 286, orange_color) # 세로선 좌표
212+
draw_vertical_orange(c, 40, 291, 40, 266, orange_color) # 세로선 좌표
211213

212214
c.setFillColor(black_color)
213-
c.setFont("Pretendard-Bold", 20)
214-
c.drawString(48, 292, "다음 등급을 위해 맞춰야 하는 문제") # 텍스트 위치 설정
215+
c.setFont("Pretendard-Bold", 18)
216+
c.drawString(48, 272, "다음 등급을 위해 맞춰야 하는 문제") # 텍스트 위치 설정
215217

216218
c.setFillColor(grey_color)
217-
text = c.beginText(53, 266)
218-
text.setFont("Pretendard-Regular", 14)
219-
text.setTextOrigin(53, 266)
219+
text = c.beginText(53, 246)
220+
text.setFont("Pretendard-Regular", 12)
221+
text.setTextOrigin(53, 246)
220222
text.textLine("다음 등급에서 맞춰야하는 문제들이예요.")
221223
c.drawText(text)
222224

223225
if len(data.forNextRating) == 0:
224226
c.setFillColor(HexColor("#95E0BB"))
225-
c.setFont("Pretendard-Bold", 20)
226-
c.drawString(52, 230, "모두 맞았어요!")
227+
c.setFont("Pretendard-Bold", 18)
228+
c.drawString(52, 210, "모두 맞았어요!")
227229
else:
228-
text_y = 240
230+
text_y = 220
229231
for i, problem in enumerate(data.forNextRating):
230232

231233
if i%5 == 0 and i > 0:
232234
text_y -= 30
233235

234236
c.setFillColor(black_color)
235-
c.setFont("Pretendard-Regular", 18)
237+
c.setFont("Pretendard-Regular", 14)
236238
p_num = f'{problem.problemNumber}번'
237239
c.drawString(45 + (i%5)*105, text_y, p_num)
238240

239-
p_num_width = c.stringWidth(p_num, "Pretendard-Regular", 18)
241+
p_num_width = c.stringWidth(p_num, "Pretendard-Regular", 14)
240242

241243
box_width = 40
242244
box_height = 20
243245
box_x = 50 + (i%5)*105 + p_num_width
244246
box_y = text_y - 4
247+
rate_width = c.stringWidth(f'{int(problem.correctRate)}%', "Pretendard-Regular", 12)
248+
249+
# 텍스트 그리기
250+
c.setFont("Pretendard-Regular", 12) # 글꼴과 크기 설정
251+
c.setFillColor(orange_color)
252+
c.drawString(box_x + 4, box_y + 5, f'{int(problem.correctRate)}%') # 박스 안 텍스트 위치 조정
245253

246254
# 박스 그리기 (배경)
247255
c.setLineWidth(1) # 테두리 두께 설정 (얇게)
248256
c.setStrokeColor(HexColor("#FFA500")) # 주황색 테두리
249-
c.roundRect(box_x, box_y, box_width, box_height, radius=4, stroke=1, fill=0)
250-
251-
# 텍스트 그리기
252-
c.setFont("Pretendard-Regular", 14) # 글꼴과 크기 설정
253-
c.setFillColor(orange_color)
254-
c.drawString(box_x + 6, box_y + 5, f'{int(problem.correctRate)}%')
257+
c.roundRect(box_x, box_y, rate_width + 8, box_height, radius=4, stroke=1, fill=0)
255258

256259
# 점선 상자2
257-
draw_dashed_box(c, 30, 40, width - 60, 140)
260+
draw_dashed_box(c, 30, 30, width - 60, 140)
258261

259262
### 등급 다지기 ###
260263
# 세로선 그리기 (오렌지 색상)
261264
c.setDash([])
262-
draw_vertical_orange(c, 40, 166, 40, 141, orange_color) # 세로선 좌표
265+
draw_vertical_orange(c, 40, 161, 40, 136, orange_color) # 세로선 좌표
263266

264267
c.setFillColor(black_color)
265-
c.setFont("Pretendard-Bold", 20)
266-
c.drawString(48, 147, "등급 다지기") # 텍스트 위치 설정
268+
c.setFont("Pretendard-Bold", 18)
269+
c.drawString(48, 142, "등급 다지기") # 텍스트 위치 설정
267270

268271
c.setFillColor(grey_color)
269272
text = c.beginText(53, 119)
@@ -274,35 +277,37 @@ def create_review_note(data: DetailResultApplication, file_name: str, buffer):
274277

275278
if len(data.forBeforeRating) == 0:
276279
c.setFillColor(HexColor("#95E0BB"))
277-
c.setFont("Pretendard-Bold", 20)
280+
c.setFont("Pretendard-Bold", 18)
278281
c.drawString(52, 83, "모두 맞았어요!")
279282
else:
280-
text_y = 90
283+
text_y = 80
281284
for i, problem in enumerate(data.forBeforeRating):
282285
if i%5 == 0 and i > 0:
283286
text_y -= 30
284287

285288
c.setFillColor(black_color)
286-
c.setFont("Pretendard-Regular", 18)
289+
c.setFont("Pretendard-Regular", 14)
287290
p_num = f'{problem.problemNumber}번'
288291
c.drawString(45 + (i%5)*105, text_y, p_num)
289292

290-
p_num_width = c.stringWidth(p_num, "Pretendard-Regular", 18)
293+
p_num_width = c.stringWidth(p_num, "Pretendard-Regular", 14)
291294

292295
box_width = 40
293296
box_height = 20
294297
box_x = 50 + (i%5)*105 + p_num_width
295298
box_y = text_y - 4
296299

297-
# 박스 그리기 (배경)
298-
c.setLineWidth(1) # 테두리 두께 설정 (얇게)
299-
c.setStrokeColor(HexColor("#FFA500")) # 주황색 테두리
300-
c.roundRect(box_x, box_y, box_width, box_height, radius=4, stroke=1, fill=0)
300+
rate_width = c.stringWidth(f'{int(problem.correctRate)}%', "Pretendard-Regular", 12)
301301

302302
# 텍스트 그리기
303-
c.setFont("Pretendard-Regular", 14) # 글꼴과 크기 설정
303+
c.setFont("Pretendard-Regular", 12) # 글꼴과 크기 설정
304304
c.setFillColor(orange_color)
305-
c.drawString(box_x + 6, box_y + 5, f'{int(problem.correctRate)}%')
305+
c.drawString(box_x + 4, box_y + 5, f'{int(problem.correctRate)}%') # 박스 안 텍스트 위치 조정
306+
307+
# 박스 그리기 (배경)
308+
c.setLineWidth(1) # 테두리 두께 설정 (얇게)
309+
c.setStrokeColor(HexColor("#FFA500")) # 주황색 테두리
310+
c.roundRect(box_x, box_y, rate_width + 8, box_height, radius=4, stroke=1, fill=0)
306311

307312

308313
page_num = 2

0 commit comments

Comments
 (0)