From 2e40a387a37c61db6a08d4c3c6f7133607dc7d88 Mon Sep 17 00:00:00 2001 From: Pavel Perestoronin Date: Wed, 7 Sep 2022 23:23:20 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=91=20Crawler:=20account=20for=20`null?= =?UTF-8?q?`s=20in=20`next=5Fcheck=5Fat`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/crawler.rs | 2 +- src/database/mongodb/models/account.rs | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/crawler.rs b/src/crawler.rs index 82c208ca..6742eb0d 100644 --- a/src/crawler.rs +++ b/src/crawler.rs @@ -230,7 +230,7 @@ impl Crawler { last_battle_time: Some(account_info.last_battle_time), partial_tank_stats, prio: false, - next_check_at: NextCheckAt::from(account_info.last_battle_time).into(), + next_check_at: Some(NextCheckAt::from(account_info.last_battle_time).into()), }; let account_snapshot = database::AccountSnapshot::new(self.realm, &account_info, tank_last_battle_times); diff --git a/src/database/mongodb/models/account.rs b/src/database/mongodb/models/account.rs index 4b8fec65..db8ebcd3 100644 --- a/src/database/mongodb/models/account.rs +++ b/src/database/mongodb/models/account.rs @@ -44,9 +44,10 @@ pub struct Account { #[serde(default)] pub prio: bool, + /// FIXME: remove `Option` when filled in. #[serde(rename = "due", default)] - #[serde_as(as = "bson::DateTime")] - pub next_check_at: DateTime, + #[serde_as(as = "Option")] + pub next_check_at: Option, } impl TypedDocument for Account { @@ -89,7 +90,7 @@ impl Account { last_battle_time: None, partial_tank_stats: Vec::new(), prio: false, - next_check_at: DateTime::default(), + next_check_at: Some(DateTime::default()), } } }