feat: sort answer by date, olders firsts

This commit is contained in:
Matthieu Bessat 2024-01-21 23:35:08 +01:00
parent 6913defcd9
commit aa4ea8cc4e
3 changed files with 8 additions and 0 deletions

View file

@ -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

View file

@ -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)
}
}

View file

@ -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,