Skip to content

Commit

Permalink
Stable sort CSV by source instead of key
Browse files Browse the repository at this point in the history
  • Loading branch information
Dekkonot committed Sep 26, 2024
1 parent 099643f commit ff21a40
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/snapshot_middleware/csv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ fn localization_to_csv(csv_contents: &str) -> anyhow::Result<Vec<u8>> {
serde_json::from_str(csv_contents).context("cannot decode JSON from localization table")?;

// TODO sort this better
csv.sort_unstable_by(|a, b| a.key.partial_cmp(&b.key).unwrap());
csv.sort_by(|a, b| a.source.partial_cmp(&b.source).unwrap());

let mut headers = vec!["Key", "Source", "Context", "Example"];
// We want both order and a lack of duplicates, so we use a BTreeSet.
Expand Down

0 comments on commit ff21a40

Please sign in to comment.