From ec37b994114226829841c250d1170ce4053d99a7 Mon Sep 17 00:00:00 2001 From: Daniel Schadt Date: Fri, 24 Jul 2020 15:42:36 +0200 Subject: use Analyzer::outcome for Discord checkmarks This is way more accurate than Log::was_rewarded, especially for repeated kills in a week. --- src/discord.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/discord.rs b/src/discord.rs index 32cbf16..839b1c8 100644 --- a/src/discord.rs +++ b/src/discord.rs @@ -2,7 +2,7 @@ use std::sync::Arc; use anyhow::Result; use chrono::prelude::*; -use evtclib::Log; +use evtclib::{Log, Outcome}; use serenity::client::bridge::gateway::ShardManager; use serenity::model::id::*; use serenity::prelude::*; @@ -110,9 +110,10 @@ fn insert_link(text: &str, log: &Log, link: &str) -> String { } fn state_emoji(log: &Log) -> &'static str { - if log.was_rewarded() { - "✅" - } else { - "❌" + let outcome = log.analyzer().and_then(|a| a.outcome()); + match outcome { + Some(Outcome::Success) => "✅", + Some(Outcome::Failure) => "❌", + None => "❓", } } -- cgit v1.2.3