@@ -96,33 +96,62 @@ def create_review_note(data: DetailResultApplication, file_name: str, buffer):
9696
9797 ## 문제들
9898 text_y = 500
99- for i , problem in enumerate (data .incorrectProblems ):
100-
101- if i % 5 == 0 and i > 0 :
102- text_y -= 30
103-
104- c .setFillColor (black_color )
105- c .setFont ("Pretendard-Regular" , 20 )
106- p_num = f'{ problem .problemNumber } 번'
107- c .drawString (25 + (i % 5 )* 105 , text_y , p_num )
108-
109- p_num_width = c .stringWidth (p_num , "Pretendard-Regular" , 24 )
110-
111- box_width = 40
112- box_height = 20
113- box_x = 24 + (i % 5 )* 105 + p_num_width
114- box_y = text_y - 3
115-
116- # 박스 그리기 (배경)
117- c .setLineWidth (1 ) # 테두리 두께 설정 (얇게)
118- c .setStrokeColor (HexColor ("#FFA500" )) # 주황색 테두리
119- c .roundRect (box_x , box_y , box_width , box_height , radius = 4 , stroke = 1 , fill = 0 )
120-
121- # 텍스트 그리기
122- c .setFont ("Pretendard-Regular" , 14 ) # 글꼴과 크기 설정
123- c .setFillColor (orange_color )
124- c .drawString (box_x + 6 , box_y + 4 , f'{ int (problem .correctRate )} %' ) # 박스 안 텍스트 위치 조정
99+ if len (data .incorrectProblems ) <= 10 :
100+ for i , problem in enumerate (data .incorrectProblems ):
101+
102+ if i % 5 == 0 and i > 0 :
103+ text_y -= 30
104+
105+ c .setFillColor (black_color )
106+ c .setFont ("Pretendard-Regular" , 20 )
107+ p_num = f'{ problem .problemNumber } 번'
108+ c .drawString (25 + (i % 5 )* 105 , text_y , p_num )
109+
110+ p_num_width = c .stringWidth (p_num , "Pretendard-Regular" , 24 )
111+
112+ box_width = 40
113+ box_height = 20
114+ box_x = 24 + (i % 5 )* 105 + p_num_width
115+ box_y = text_y - 3
125116
117+ # 텍스트 그리기
118+ c .setFont ("Pretendard-Regular" , 14 ) # 글꼴과 크기 설정
119+ 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 )
122+
123+ # 박스 그리기 (배경)
124+ c .setLineWidth (1 ) # 테두리 두께 설정 (얇게)
125+ c .setStrokeColor (HexColor ("#FFA500" )) # 주황색 테두리
126+ c .roundRect (box_x , box_y , rate_width + 2 , box_height , radius = 4 , stroke = 1 , fill = 0 )
127+
128+
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 )} %' ) # 박스 안 텍스트 위치 조정
126155 # 점선 상자1
127156 draw_dashed_box (c , 30 , 190 , width - 60 , 270 )
128157
@@ -240,7 +269,7 @@ def create_review_note(data: DetailResultApplication, file_name: str, buffer):
240269 text = c .beginText (53 , 119 )
241270 text .setFont ("Pretendard-Regular" , 14 )
242271 text .setTextOrigin (53 , 119 )
243- text .textLine ("현재 등급 이상을 안정적으로 받기 위해 체크해볼 만한 문제예요 ." )
272+ text .textLine ("현재 등급 대비 난이도가 낮은 문제예요. 다시 한번 풀어보세요 ." )
244273 c .drawText (text )
245274
246275 if len (data .forBeforeRating ) == 0 :
@@ -300,7 +329,7 @@ def create_review_note(data: DetailResultApplication, file_name: str, buffer):
300329 buffer .seek (0 )
301330
302331 headers = {
303- f"Content-Disposition" : "inline ; filename={file_name}.pdf" , # 파일명 설정
332+ f"Content-Disposition" : "attachment ; filename={file_name}.pdf" , # 파일명 설정
304333 }
305334
306335 # StreamingResponse로 PDF 반환
0 commit comments