Skip to content

Commit b9d36a6

Browse files
committed
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.
1 parent cbf11ac commit b9d36a6

File tree

14 files changed

+27
-42
lines changed

14 files changed

+27
-42
lines changed

RELEASE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
## v9.93.0
44

55
- Added support for Iron Banner Zone Control (iron_banner_zone_control)
6-
- 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.
6+
- 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.
77

88
## v9.91.0 December 6, 2022
99

src/Cargo.lock

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/dcli/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "dcli"
33
#version
4-
version = "0.91.0"
4+
version = "0.93.0"
55
authors = ["Mike Chambers <mikechambers@gmail.com>"]
66
edition = "2018"
77
description = "Library for the dcli collection of command line tools for Destiny 2."

src/dcli/src/activitystoreinterface.rs

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ use indicatif::{ProgressBar, ProgressState, ProgressStyle};
2929

3030
use crate::enums::moment::Moment;
3131
use crate::playeractivitiessummary::PlayerActivitiesSummary;
32-
use crate::response::activities::DestinyHistoricalStatsActivity;
3332
use crate::utils::{
3433
format_error, COMPETITIVE_PVP_ACTIVITY_HASH,
3534
FREELANCE_COMPETITIVE_PVP_ACTIVITY_HASH,
@@ -957,12 +956,6 @@ impl ActivityStoreInterface {
957956
_ => was_updated = false,
958957
};
959958

960-
//println!("found private match: updated : {}", was_updated);
961-
962-
if was_updated {
963-
self.add_to_modes(activity, Mode::AllPvP);
964-
}
965-
966959
was_updated
967960
}
968961

@@ -1491,13 +1484,6 @@ impl ActivityStoreInterface {
14911484
character_row_id: i32,
14921485
mode: &Mode,
14931486
) -> Result<i64, Error> {
1494-
let restrict_mode_id = if mode.is_private() {
1495-
-1
1496-
} else {
1497-
//if not private, then we dont include any results that are private
1498-
Mode::PrivateMatchesAll.as_id() as i32
1499-
};
1500-
15011487
let rows = sqlx::query(
15021488
r#"
15031489
SELECT
@@ -1508,20 +1494,16 @@ impl ActivityStoreInterface {
15081494
activity ON activity_queue.activity_id = activity.activity_id,
15091495
character_activity_stats ON character_activity_stats.activity = activity.id,
15101496
character on character_activity_stats.character = character.id,
1511-
modes ON modes.activity = activity.id
1497+
modes ON modes.activity = activity.id and modes.mode = ?
15121498
WHERE
15131499
character_activity_stats.character = ? AND
1514-
activity_queue.character = ? AND
1515-
exists (select 1 from modes where activity = activity.id and mode = ?) AND
1516-
not exists (select 1 from modes where activity = activity.id and mode = ?)
1500+
activity_queue.character = ?
15171501
ORDER BY activity.period DESC LIMIT 1
15181502
"#,
15191503
)
1520-
1504+
.bind(mode.as_id().to_string())
15211505
.bind(character_row_id.to_string())
15221506
.bind(character_row_id.to_string())
1523-
.bind(mode.as_id().to_string())
1524-
.bind(restrict_mode_id)
15251507
.fetch_all(&mut self.db)
15261508
.await?;
15271509

@@ -1531,6 +1513,7 @@ impl ActivityStoreInterface {
15311513

15321514
let row = &rows[0];
15331515
let activity_id: i64 = row.try_get("max_activity_id")?;
1516+
15341517
Ok(activity_id)
15351518
}
15361519

src/dcli/src/utils.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,9 @@ pub fn format_error(msg: &str, error: Error) -> String {
8888

8989
strings.push("\nIf you think you have hit a bug and would like to report it (or would just like some help):".to_string());
9090
strings.push(" 1. Run command with '--verbose' flag.".to_string());
91-
strings.push(" 2. Copy output, and log a bug at: ".to_string());
91+
strings.push(" 2a. Copy output, and share on Discord: ".to_string());
92+
strings.push(" https://discord.gg/2Y8bV2Mq3p".to_string());
93+
strings.push(" 2b. Copy output, and log a bug at: ".to_string());
9294
strings
9395
.push(" https://github.com/mikechambers/dcli/issues".to_string());
9496

src/dclia/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "dclia"
33
#version
4-
version = "0.91.0"
4+
version = "0.93.0"
55
authors = ["Mike Chambers <mikechambers@gmail.com>"]
66
description = "Command line tool for retrieving information on current activity for specified player character."
77
homepage = "https://www.mikechambers.com"

src/dcliad/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "dcliad"
33
#version
4-
version = "0.91.0"
4+
version = "0.93.0"
55
authors = ["Mike Chambers <mikechambers@gmail.com>"]
66
edition = "2018"
77
description = "Command line tool for viewing Destiny 2 activity details."

src/dcliah/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "dcliah"
33
#version
4-
version = "0.91.0"
4+
version = "0.93.0"
55
authors = ["Mike Chambers <mikechambers@gmail.com>"]
66
edition = "2018"
77
description = "Command line tool for viewing Destiny 2 activity history."

src/dclif/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "dclif"
33
#version
4-
version = "0.91.0"
4+
version = "0.93.0"
55
authors = ["Mike Chambers <mikechambers@gmail.com>"]
66
edition = "2018"
77
description = "Command line tool for querying specific Destiny 2 pvp stats."

src/dclim/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "dclim"
33
#version
4-
version = "0.91.0"
4+
version = "0.93.0"
55
authors = ["Mike Chambers <mikechambers@gmail.com>"]
66
edition = "2018"
77
description = "Command line tool for managing and syncing the remote Destiny 2 API manifest database."

0 commit comments

Comments
 (0)