fix(csv): column name as english
This commit is contained in:
parent
17bf5c0564
commit
1b023e6042
1 changed files with 26 additions and 21 deletions
|
@ -37,48 +37,47 @@ pub async fn sync_csv(
|
|||
paheko_client: &paheko::AuthentifiedClient,
|
||||
config: &Config,
|
||||
_user_cache: &mut UserCache,
|
||||
_dry_run: bool
|
||||
dry_run: bool
|
||||
) -> Result<()> {
|
||||
// raw row record directly from CSV
|
||||
#[derive(Debug, serde::Deserialize)]
|
||||
struct AnswerRecord {
|
||||
#[serde(rename = "Date")]
|
||||
// Ref BP
|
||||
reference: String,
|
||||
|
||||
date: String,
|
||||
#[serde(rename = "Email acheteur")]
|
||||
email: String,
|
||||
#[serde(rename = "Prénom")]
|
||||
first_name: String,
|
||||
#[serde(rename = "Nom")]
|
||||
last_name: String,
|
||||
#[serde(rename = "Tarif")]
|
||||
// Mode / Tarif "Individuel" "Couple"
|
||||
membership_mode: String,
|
||||
|
||||
#[serde(rename = "Cotisation (€)")]
|
||||
subscription_amount: String,
|
||||
#[serde(rename = "Don (€)")]
|
||||
donation_amount: String,
|
||||
|
||||
#[serde(rename = "CC 1 Prénom conjoint")]
|
||||
// CC 1 Prénom conjoint
|
||||
linked_user_first_name: String,
|
||||
|
||||
#[serde(rename = "CC 2 ADRESSE")]
|
||||
// CC 2 ADRESSE
|
||||
address: String,
|
||||
#[serde(rename = "CC 3 CODE POSTAL")]
|
||||
// CC 3 CODE POSTAL
|
||||
postal_code: String,
|
||||
#[serde(rename = "CC 4 VILLE")]
|
||||
// CC 4 VILLE
|
||||
city: String,
|
||||
#[serde(rename = "CC 5 TÉLÉPHONE")]
|
||||
// CC 5 TÉLÉPHONE
|
||||
phone: String,
|
||||
|
||||
#[serde(rename = "CC 7 PROFESSION")]
|
||||
// CC 7 PROFESSION
|
||||
job: String,
|
||||
#[serde(rename = "CC 8 CENTRE D'INTÉRÊTS / COMPÉTENCES")]
|
||||
// CC 8 CENTRE D'INTÉRÊTS / COMPÉTENCES
|
||||
skills: String,
|
||||
#[serde(rename = "CC 9 DATE DE NAISSANCE")]
|
||||
// CC 9 DATE DE NAISSANCE
|
||||
birth_date: String,
|
||||
|
||||
#[serde(rename = "REF BP/")]
|
||||
reference: String
|
||||
// Cotisation (€)
|
||||
subscription_amount: String,
|
||||
// Don (€)
|
||||
donation_amount: String,
|
||||
|
||||
// Mode de paiement
|
||||
payment_mode: String
|
||||
}
|
||||
|
||||
let stdin = io::stdin();
|
||||
|
@ -142,6 +141,12 @@ pub async fn sync_csv(
|
|||
// sort by date, most older first
|
||||
generalized_answers.sort_by(|a, b| a.inception_time.cmp(&b.inception_time));
|
||||
eprintln!("Generated GeneralizedAnswers");
|
||||
if dry_run {
|
||||
dbg!(generalized_answers);
|
||||
eprintln!("Stopping here, dry run");
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
sync_paheko(
|
||||
paheko_client,
|
||||
config,
|
||||
|
|
Loading…
Reference in a new issue