| 331 | |
| 332 | @staticmethod |
| 333 | def format(data: dict) -> List: |
| 334 | if not data: |
| 335 | return [] |
| 336 | title = data["contest_title"] |
| 337 | title_en = data["contest_title_en"] |
| 338 | start_time = data["contest_start_time"] |
| 339 | duration = data["contest_duration"] |
| 340 | cost_minutes = duration // 60 |
| 341 | user_num = data["user_num"] |
| 342 | rows = [ |
| 343 | f"#### {title}({Contest.format_time(start_time)}, {cost_minutes} 分钟) 参赛人数 {user_num}\n" |
| 344 | ] |
| 345 | rows_en = [f"#### {title_en}\n"] |
| 346 | for question in data["question_list"]: |
| 347 | ( |
| 348 | frontend_question_id, |
| 349 | title_cn, |
| 350 | title_en, |
| 351 | relative_path_cn, |
| 352 | relative_path_en, |
| 353 | ) = question |
| 354 | rows.append(f"- [{frontend_question_id}. {title_cn}]({relative_path_cn})") |
| 355 | rows_en.append( |
| 356 | f"- [{frontend_question_id}. {title_en}]({relative_path_en})" |
| 357 | ) |
| 358 | return [start_time, "\n".join(rows), "\n".join(rows_en)] |
| 359 | |
| 360 | |
| 361 | def get_contests(fetch_new=True) -> List: |