Fix csv import logic
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Julius 2022-11-12 22:36:08 +01:00
parent 8d97c34fbe
commit 35bea09857
Signed by: j00lz
GPG key ID: AF241B0AA237BBA2
2 changed files with 5 additions and 4 deletions

View file

@ -144,6 +144,7 @@ async fn scan_card(
Extension(pool): Extension<Database>, Extension(pool): Extension<Database>,
Json(scan): Json<ScanRequest>, Json(scan): Json<ScanRequest>,
) -> impl IntoResponse { ) -> impl IntoResponse {
println!("{:?}", scan);
let scanned = pool.is_student_in_party(scan.party, &scan.code).await; let scanned = pool.is_student_in_party(scan.party, &scan.code).await;
if scan.check { if scan.check {
if let Some(mut ticket) = scanned { if let Some(mut ticket) = scanned {

View file

@ -133,7 +133,7 @@
}); });
} }
function scan_ticket(code) { function scan_ticket(code, coins) {
if (code === "COINS" || code === "000000") { if (code === "COINS" || code === "000000") {
document.getElementById("muntjes").checked = true; document.getElementById("muntjes").checked = true;
return; return;
@ -150,7 +150,7 @@
party: party_id, party: party_id,
code: code, code: code,
check: check, check: check,
coins: document.getElementById("muntjes").checked, coins: coins || document.getElementById("muntjes").checked,
}) })
}).then(function (response) { }).then(function (response) {
return response.json(); return response.json();
@ -280,10 +280,10 @@
coins = true; coins = true;
} }
} }
console.log(llnr_a, coins);
if (llnr_a !== "") { if (llnr_a !== "") {
num++; num++;
scan_ticket("COINS"); scan_ticket(llnr_a, coins);
scan_ticket(llnr_a);
} }
} }
document.getElementById("import-result").innerHTML = `${num} leerlingen geïmporteerd!` document.getElementById("import-result").innerHTML = `${num} leerlingen geïmporteerd!`