diff --git a/TODO.md b/TODO.md index 89ce09e..9bd384b 100644 --- a/TODO.md +++ b/TODO.md @@ -58,3 +58,7 @@ curl -u $PAHEKO_CLIENT_ID:$PAHEKO_CLIENT_SECRET http://localhost:8082/api/sql -d - handle additional donation amount +## 2024-01-21 + +- to sort members by date, process older answers first + diff --git a/src/helloasso.rs b/src/helloasso.rs index b2d9121..92ed7d0 100644 --- a/src/helloasso.rs +++ b/src/helloasso.rs @@ -355,6 +355,8 @@ impl Organization { for entry in data { answers.push(serde_json::from_value(entry).context("Cannot parse FormAnswer")?) } + // sort by date, most older first + answers.sort_by(|a, b| a.order.inception_time.cmp(&b.order.inception_time)); Ok(answers) } } diff --git a/src/sync_csv.rs b/src/sync_csv.rs index ffbde7a..de550f7 100644 --- a/src/sync_csv.rs +++ b/src/sync_csv.rs @@ -139,6 +139,8 @@ pub async fn sync_csv( generalized_answers.push(generalized_answer); } + // sort by date, most older first + generalized_answers.sort_by(|a, b| a.inception_time.cmp(&b.inception_time)); eprintln!("Generated GeneralizedAnswers"); sync_paheko( paheko_client,