From b9d36a63a5648caf690cd2f75f182e048f2bc09b Mon Sep 17 00:00:00 2001 From: Mike Chambers Date: Tue, 13 Dec 2022 19:51:25 -0800 Subject: [PATCH] Some refactoring of recent changes Don't set AllPvp in modes for private matches (to be consistent with API). Simplify how we get last activity id. --- RELEASE.md | 2 +- src/Cargo.lock | 18 +++++++++--------- src/dcli/Cargo.toml | 2 +- src/dcli/src/activitystoreinterface.rs | 25 ++++--------------------- src/dcli/src/utils.rs | 4 +++- src/dclia/Cargo.toml | 2 +- src/dcliad/Cargo.toml | 2 +- src/dcliah/Cargo.toml | 2 +- src/dclif/Cargo.toml | 2 +- src/dclim/Cargo.toml | 2 +- src/dclistat/Cargo.toml | 2 +- src/dclisync/Cargo.toml | 2 +- src/dclitime/Cargo.toml | 2 +- src/tell/Cargo.toml | 2 +- 14 files changed, 27 insertions(+), 42 deletions(-) diff --git a/RELEASE.md b/RELEASE.md index adba7f3..b246b5f 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -3,7 +3,7 @@ ## v9.93.0 - Added support for Iron Banner Zone Control (iron_banner_zone_control) -- Added code that attempts to fix missing / incorrect mode data for some match returned from API. This includes Season of the Seraph comp match data, as well as data for private matches. In order to get fixed data, you will need to delete your data store and resync once. +- Added code that attempts to fix missing / incorrect mode data for some matches returned from API. This includes Season of the Seraph comp match data, as well as data for private matches. In order to get fixed data, you will need to delete your data store and resync all data. ## v9.91.0 December 6, 2022 diff --git a/src/Cargo.lock b/src/Cargo.lock index d60d9e8..da2420b 100644 --- a/src/Cargo.lock +++ b/src/Cargo.lock @@ -367,7 +367,7 @@ dependencies = [ [[package]] name = "dcli" -version = "0.91.0" +version = "0.93.0" dependencies = [ "chrono", "crossterm", @@ -389,7 +389,7 @@ dependencies = [ [[package]] name = "dclia" -version = "0.91.0" +version = "0.93.0" dependencies = [ "dcli", "env_logger", @@ -401,7 +401,7 @@ dependencies = [ [[package]] name = "dcliad" -version = "0.91.0" +version = "0.93.0" dependencies = [ "dcli", "env_logger", @@ -413,7 +413,7 @@ dependencies = [ [[package]] name = "dcliah" -version = "0.91.0" +version = "0.93.0" dependencies = [ "chrono", "dcli", @@ -427,7 +427,7 @@ dependencies = [ [[package]] name = "dclim" -version = "0.91.0" +version = "0.93.0" dependencies = [ "dcli", "env_logger", @@ -444,7 +444,7 @@ dependencies = [ [[package]] name = "dclistat" -version = "0.91.0" +version = "0.93.0" dependencies = [ "chrono", "dcli", @@ -458,7 +458,7 @@ dependencies = [ [[package]] name = "dclisync" -version = "0.91.0" +version = "0.93.0" dependencies = [ "ctrlc", "dcli", @@ -472,7 +472,7 @@ dependencies = [ [[package]] name = "dclitime" -version = "0.91.0" +version = "0.93.0" dependencies = [ "chrono", "dcli", @@ -1905,7 +1905,7 @@ dependencies = [ [[package]] name = "tell" -version = "0.91.0" +version = "0.93.0" dependencies = [ "lazy_static", ] diff --git a/src/dcli/Cargo.toml b/src/dcli/Cargo.toml index 883f2c5..07d88b7 100644 --- a/src/dcli/Cargo.toml +++ b/src/dcli/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dcli" #version -version = "0.91.0" +version = "0.93.0" authors = ["Mike Chambers "] edition = "2018" description = "Library for the dcli collection of command line tools for Destiny 2." diff --git a/src/dcli/src/activitystoreinterface.rs b/src/dcli/src/activitystoreinterface.rs index f92841d..9770b98 100644 --- a/src/dcli/src/activitystoreinterface.rs +++ b/src/dcli/src/activitystoreinterface.rs @@ -29,7 +29,6 @@ use indicatif::{ProgressBar, ProgressState, ProgressStyle}; use crate::enums::moment::Moment; use crate::playeractivitiessummary::PlayerActivitiesSummary; -use crate::response::activities::DestinyHistoricalStatsActivity; use crate::utils::{ format_error, COMPETITIVE_PVP_ACTIVITY_HASH, FREELANCE_COMPETITIVE_PVP_ACTIVITY_HASH, @@ -957,12 +956,6 @@ impl ActivityStoreInterface { _ => was_updated = false, }; - //println!("found private match: updated : {}", was_updated); - - if was_updated { - self.add_to_modes(activity, Mode::AllPvP); - } - was_updated } @@ -1491,13 +1484,6 @@ impl ActivityStoreInterface { character_row_id: i32, mode: &Mode, ) -> Result { - let restrict_mode_id = if mode.is_private() { - -1 - } else { - //if not private, then we dont include any results that are private - Mode::PrivateMatchesAll.as_id() as i32 - }; - let rows = sqlx::query( r#" SELECT @@ -1508,20 +1494,16 @@ impl ActivityStoreInterface { activity ON activity_queue.activity_id = activity.activity_id, character_activity_stats ON character_activity_stats.activity = activity.id, character on character_activity_stats.character = character.id, - modes ON modes.activity = activity.id + modes ON modes.activity = activity.id and modes.mode = ? WHERE character_activity_stats.character = ? AND - activity_queue.character = ? AND - exists (select 1 from modes where activity = activity.id and mode = ?) AND - not exists (select 1 from modes where activity = activity.id and mode = ?) + activity_queue.character = ? ORDER BY activity.period DESC LIMIT 1 "#, ) - + .bind(mode.as_id().to_string()) .bind(character_row_id.to_string()) .bind(character_row_id.to_string()) - .bind(mode.as_id().to_string()) - .bind(restrict_mode_id) .fetch_all(&mut self.db) .await?; @@ -1531,6 +1513,7 @@ impl ActivityStoreInterface { let row = &rows[0]; let activity_id: i64 = row.try_get("max_activity_id")?; + Ok(activity_id) } diff --git a/src/dcli/src/utils.rs b/src/dcli/src/utils.rs index 08b102f..9dcf2d7 100644 --- a/src/dcli/src/utils.rs +++ b/src/dcli/src/utils.rs @@ -88,7 +88,9 @@ pub fn format_error(msg: &str, error: Error) -> String { strings.push("\nIf you think you have hit a bug and would like to report it (or would just like some help):".to_string()); strings.push(" 1. Run command with '--verbose' flag.".to_string()); - strings.push(" 2. Copy output, and log a bug at: ".to_string()); + strings.push(" 2a. Copy output, and share on Discord: ".to_string()); + strings.push(" https://discord.gg/2Y8bV2Mq3p".to_string()); + strings.push(" 2b. Copy output, and log a bug at: ".to_string()); strings .push(" https://github.com/mikechambers/dcli/issues".to_string()); diff --git a/src/dclia/Cargo.toml b/src/dclia/Cargo.toml index 24422c8..e8d8a31 100644 --- a/src/dclia/Cargo.toml +++ b/src/dclia/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dclia" #version -version = "0.91.0" +version = "0.93.0" authors = ["Mike Chambers "] description = "Command line tool for retrieving information on current activity for specified player character." homepage = "https://www.mikechambers.com" diff --git a/src/dcliad/Cargo.toml b/src/dcliad/Cargo.toml index f5a738c..948ea96 100644 --- a/src/dcliad/Cargo.toml +++ b/src/dcliad/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dcliad" #version -version = "0.91.0" +version = "0.93.0" authors = ["Mike Chambers "] edition = "2018" description = "Command line tool for viewing Destiny 2 activity details." diff --git a/src/dcliah/Cargo.toml b/src/dcliah/Cargo.toml index a89739b..f1a5cb4 100644 --- a/src/dcliah/Cargo.toml +++ b/src/dcliah/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dcliah" #version -version = "0.91.0" +version = "0.93.0" authors = ["Mike Chambers "] edition = "2018" description = "Command line tool for viewing Destiny 2 activity history." diff --git a/src/dclif/Cargo.toml b/src/dclif/Cargo.toml index ede3c7a..e31827d 100644 --- a/src/dclif/Cargo.toml +++ b/src/dclif/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dclif" #version -version = "0.91.0" +version = "0.93.0" authors = ["Mike Chambers "] edition = "2018" description = "Command line tool for querying specific Destiny 2 pvp stats." diff --git a/src/dclim/Cargo.toml b/src/dclim/Cargo.toml index ee761d5..7735510 100644 --- a/src/dclim/Cargo.toml +++ b/src/dclim/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dclim" #version -version = "0.91.0" +version = "0.93.0" authors = ["Mike Chambers "] edition = "2018" description = "Command line tool for managing and syncing the remote Destiny 2 API manifest database." diff --git a/src/dclistat/Cargo.toml b/src/dclistat/Cargo.toml index 8fa7248..2495236 100644 --- a/src/dclistat/Cargo.toml +++ b/src/dclistat/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dclistat" #version -version = "0.91.0" +version = "0.93.0" authors = ["Mike Chambers "] edition = "2018" description = "Command line tool for querying specific Destiny 2 pvp stats." diff --git a/src/dclisync/Cargo.toml b/src/dclisync/Cargo.toml index 7be78db..1f44007 100644 --- a/src/dclisync/Cargo.toml +++ b/src/dclisync/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dclisync" #version -version = "0.91.0" +version = "0.93.0" authors = ["Mike Chambers "] edition = "2018" description = "Command line tool for downloading and syncing Destiny 2 Crucible activity history." diff --git a/src/dclitime/Cargo.toml b/src/dclitime/Cargo.toml index e44cebf..3df9ac0 100644 --- a/src/dclitime/Cargo.toml +++ b/src/dclitime/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dclitime" #version -version = "0.91.0" +version = "0.93.0" authors = ["Mike Chambers "] edition = "2018" description = "Command line tool for retrieving Destiny 2 related date / time stamps" diff --git a/src/tell/Cargo.toml b/src/tell/Cargo.toml index 141500c..86daa94 100644 --- a/src/tell/Cargo.toml +++ b/src/tell/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "tell" #version -version = "0.91.0" +version = "0.93.0" authors = ["Mike Chambers "] edition = "2018" description = "Simple library for handling different levels of user output for command line apps."