only show future shifts
This commit is contained in:
parent
42a4107162
commit
ea2cfa4bea
1 changed files with 11 additions and 2 deletions
|
|
@ -1,5 +1,5 @@
|
|||
use crate::grist::{Priority, Shift};
|
||||
use chrono::{DateTime, FixedOffset, TimeZone};
|
||||
use chrono::{DateTime, FixedOffset, TimeZone, Utc};
|
||||
use clap::{CommandFactory, Parser, Subcommand};
|
||||
use matrix_sdk::{Client, Room};
|
||||
|
||||
|
|
@ -102,7 +102,16 @@ pub async fn handle(command: impl AsRef<str>, room: Room, client: Client) -> Res
|
|||
match clap.action {
|
||||
Action::List => {
|
||||
debug!("user asked for list");
|
||||
let shifts = crate::grist::list_shifts().await?;
|
||||
let shifts = crate::grist::list_shifts()
|
||||
.await?
|
||||
.into_iter()
|
||||
.filter(|shift| {
|
||||
let now = Utc::now().with_timezone(
|
||||
&FixedOffset::east_opt(2 * 3600).expect("failed to local time 1"),
|
||||
);
|
||||
shift.start_time >= now
|
||||
})
|
||||
.collect();
|
||||
debug!("{:?}", shifts);
|
||||
send_room_msg_html(client, room, format_shifts(shifts)).await?;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue