mirror of
https://github.com/natsukagami/youmubot.git
synced 2025-04-16 07:18:54 +00:00
Print more information in contest hook
This commit is contained in:
parent
319c38cc2b
commit
dec7309f01
1 changed files with 17 additions and 7 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
use chrono::{TimeZone, Utc};
|
||||||
use codeforces::{Contest, Problem};
|
use codeforces::{Contest, Problem};
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
use rayon::{iter::Either, prelude::*};
|
use rayon::{iter::Either, prelude::*};
|
||||||
|
@ -156,18 +157,27 @@ fn print_info_message<'a>(
|
||||||
if !contests.is_empty() {
|
if !contests.is_empty() {
|
||||||
m.push_bold_line("Contests").push_line("");
|
m.push_bold_line("Contests").push_line("");
|
||||||
for (contest, problems, link) in contests {
|
for (contest, problems, link) in contests {
|
||||||
let duration: Duration = format!("{}s", contest.duration_seconds).parse().unwrap();
|
let duration = Duration::from_secs(contest.duration_seconds);
|
||||||
m.push(" - [")
|
m.push(" - [")
|
||||||
.push_bold_safe(&contest.name)
|
.push_bold_safe(&contest.name)
|
||||||
.push(format!("]({})", link))
|
.push(format!("]({})", link))
|
||||||
.push(format!(
|
.push(format!(" | {}", contest.phase))
|
||||||
" | {} | duration **{}**",
|
.push(
|
||||||
problems
|
problems
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.map(|v| format!("{} | **{}** problems", contest.phase, v.len()))
|
.map(|v| format!(" | **{}** problems", v.len()))
|
||||||
.unwrap_or(format!("{}", contest.phase)),
|
.unwrap_or("".to_owned()),
|
||||||
duration
|
)
|
||||||
));
|
.push(
|
||||||
|
contest
|
||||||
|
.start_time_seconds
|
||||||
|
.as_ref()
|
||||||
|
.map(|v| {
|
||||||
|
format!(" | from **{}**", Utc.timestamp(*v as i64, 0).to_rfc2822())
|
||||||
|
})
|
||||||
|
.unwrap_or("".to_owned()),
|
||||||
|
)
|
||||||
|
.push(format!(" | duration **{}**", duration));
|
||||||
if let Some(p) = &contest.prepared_by {
|
if let Some(p) = &contest.prepared_by {
|
||||||
m.push(format!(
|
m.push(format!(
|
||||||
" | prepared by [{}](https://codeforces.com/profile/{})",
|
" | prepared by [{}](https://codeforces.com/profile/{})",
|
||||||
|
|
Loading…
Add table
Reference in a new issue