ul 로 출력하던 방식에서 table 방식으로 수정, 인라인 스타일 추가.
This commit is contained in:
@ -37,7 +37,7 @@ def get_precipitation_summary():
|
||||
try:
|
||||
data = response.json()
|
||||
total_rainfall = 0.0
|
||||
lines = [f"<h3>[시간대별 강수량]</h3><ul>"]
|
||||
lines = [f'<h3 style="font-size:2em; text-align:center;">[시간대별 강수량]</h3><table><tr><th>시간</th><th>강수량</th></tr>']
|
||||
|
||||
for item in data['response']['body']['items']['item']:
|
||||
if item['category'] == 'PCP' and item['fcstDate'] == TODAY:
|
||||
@ -45,11 +45,11 @@ def get_precipitation_summary():
|
||||
if 900 < int(time) < 2300:
|
||||
mm = parse_precip(item['fcstValue'])
|
||||
time_str = f"{time[:2]}:{time[2:]}" # '11:00'
|
||||
lines.append(f"<li>{time_str} → {mm}mm</li>")
|
||||
lines.append(f"<tr><td>{time_str}</td><td>{mm}mm</td></tr>")
|
||||
total_rainfall += mm
|
||||
|
||||
|
||||
lines.append("</ul>")
|
||||
lines.append("</table>")
|
||||
lines.append(f"<p>영업시간 중 총 예상 강수량: <strong>{total_rainfall:.1f}mm</strong></p>")
|
||||
|
||||
return ''.join(lines)
|
||||
|
||||
Reference in New Issue
Block a user