diff options
| author | 魏曹先生 <1992414357@qq.com> | 2025-12-30 15:28:16 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2025-12-30 15:28:16 +0800 |
| commit | 377459cd3a7a7c2cd8da1140265d68b2ca5c4140 (patch) | |
| tree | 16a341a9ea67b50b01fc999ee9ce008eb8c9d657 /src | |
| parent | c4d67bf738ca116c616b2f2c6c0859f16cccf6b4 (diff) | |
ix update editor to use latest version instead of mapped version
The update editor was incorrectly using the version from the cached
sheet mapping, which could be outdated. Now it fetches the latest
version from the latest file data to ensure correct version
calculations.
Diffstat (limited to 'src')
| -rw-r--r-- | src/bin/jv.rs | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/bin/jv.rs b/src/bin/jv.rs index e4df459..09dfae2 100644 --- a/src/bin/jv.rs +++ b/src/bin/jv.rs @@ -2996,6 +2996,19 @@ async fn start_update_editor( files: &HashSet<PathBuf>, args: &TrackFileArgs, ) -> HashMap<PathBuf, (NextVersion, UpdateDescription)> { + let account = workspace.config().lock().await.current_account(); + + let Ok(latest_file_data_path) = LatestFileData::data_path(&account) else { + eprintln!("{}", md(t!("jv.fail.read_cfg"))); + return HashMap::new(); + }; + + // Get latest file data + let Ok(latest_file_data) = LatestFileData::read_from(&latest_file_data_path).await else { + eprintln!("{}", md(t!("jv.fail.read_cfg"))); + return HashMap::new(); + }; + // Get files let Ok(analyzed) = AnalyzeResult::analyze_local_status(&workspace).await else { return HashMap::new(); @@ -3021,10 +3034,14 @@ async fn start_update_editor( .filter_map(|file| { if analyzed.modified.contains(file) { if let Some(mapping_item) = cached_sheet.mapping().get(file) { - return Some((file.clone(), mapping_item.version.clone())); + if let Some(latest_version) = latest_file_data.file_version(&mapping_item.id) { + return Some((file.clone(), latest_version.clone())); + } } + None + } else { + None } - None }) .collect(); |
