aboutsummaryrefslogtreecommitdiff
path: root/src/filters.rs
diff options
context:
space:
mode:
authorDaniel <kingdread@gmx.de>2019-05-18 01:37:50 +0200
committerDaniel <kingdread@gmx.de>2019-05-18 01:37:50 +0200
commit54e29430b3a668e9e98d3fc6e1a107fd36af8af4 (patch)
treed7143e4012ceb9cc8a84fc4013b2012ee4734348 /src/filters.rs
parente132410e7a526239389d3e8dedbcf5a84f0503b5 (diff)
downloadraidgrep-54e29430b3a668e9e98d3fc6e1a107fd36af8af4.tar.gz
raidgrep-54e29430b3a668e9e98d3fc6e1a107fd36af8af4.tar.bz2
raidgrep-54e29430b3a668e9e98d3fc6e1a107fd36af8af4.zip
add support for weekday filtering
Diffstat (limited to 'src/filters.rs')
-rw-r--r--src/filters.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/filters.rs b/src/filters.rs
index ef8bfad..d8d43ea 100644
--- a/src/filters.rs
+++ b/src/filters.rs
@@ -2,6 +2,8 @@ use evtclib::{AgentName, Log};
use super::{SearchField, LogResult, Opt};
+use chrono::Datelike;
+
/// Do filtering based on the character or account name.
pub fn filter_name(log: &Log, opt: &Opt) -> bool {
for player in log.players() {
@@ -28,6 +30,11 @@ pub fn filter_outcome(result: &LogResult, opt: &Opt) -> bool {
opt.outcome.contains(&result.outcome)
}
+/// Do filtering based on the weekday of the fight.
+pub fn filter_weekday(result: &LogResult, opt: &Opt) -> bool {
+ opt.weekdays.contains(&result.time.weekday())
+}
+
/// Do filtering based on encounter time.
pub fn filter_time(result: &LogResult, opt: &Opt) -> bool {
let after_ok = match opt.after {