mirror of
https://github.com/Djeeberjr/fw-anwesenheit.git
synced 2025-07-03 01:24:17 +00:00
added IDMapping to IDStore
This commit is contained in:
parent
de7c260e14
commit
907b758626
@ -5,7 +5,7 @@ use std::{
|
|||||||
};
|
};
|
||||||
use tokio::fs;
|
use tokio::fs;
|
||||||
|
|
||||||
use crate::tally_id::TallyID;
|
use crate::{id_mapping::IDMapping, tally_id::TallyID};
|
||||||
|
|
||||||
/// Represents a single day that IDs can attend
|
/// Represents a single day that IDs can attend
|
||||||
#[derive(Deserialize, Serialize)]
|
#[derive(Deserialize, Serialize)]
|
||||||
@ -18,12 +18,14 @@ pub struct AttendanceDay {
|
|||||||
#[derive(Deserialize, Serialize)]
|
#[derive(Deserialize, Serialize)]
|
||||||
pub struct IDStore {
|
pub struct IDStore {
|
||||||
days: HashMap<String, AttendanceDay>,
|
days: HashMap<String, AttendanceDay>,
|
||||||
|
pub mapping: IDMapping,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl IDStore {
|
impl IDStore {
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
IDStore {
|
IDStore {
|
||||||
days: HashMap::new(),
|
days: HashMap::new(),
|
||||||
|
mapping: IDMapping::new(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,7 +84,7 @@ impl IDStore {
|
|||||||
days.sort();
|
days.sort();
|
||||||
|
|
||||||
let header = days.join(seperator);
|
let header = days.join(seperator);
|
||||||
csv.push_str(&format!("ID{}{}\n", seperator, header));
|
csv.push_str(&format!("ID{seperator}{header}\n"));
|
||||||
|
|
||||||
for user_id in user_ids.iter() {
|
for user_id in user_ids.iter() {
|
||||||
csv.push_str(&user_id.0.to_string());
|
csv.push_str(&user_id.0.to_string());
|
||||||
@ -95,7 +97,7 @@ impl IDStore {
|
|||||||
.contains(user_id);
|
.contains(user_id);
|
||||||
|
|
||||||
if was_there {
|
if was_there {
|
||||||
csv.push_str(&format!("{}x", seperator));
|
csv.push_str(&format!("{seperator}x"));
|
||||||
} else {
|
} else {
|
||||||
csv.push_str(seperator);
|
csv.push_str(seperator);
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,7 @@ mod parser;
|
|||||||
mod pm3;
|
mod pm3;
|
||||||
mod tally_id;
|
mod tally_id;
|
||||||
mod webserver;
|
mod webserver;
|
||||||
|
mod id_mapping;
|
||||||
|
|
||||||
const STORE_PATH: &str = "./data.json";
|
const STORE_PATH: &str = "./data.json";
|
||||||
const PWM_CHANNEL_BUZZER: Channel = Channel::Pwm0; //PWM0 = GPIO18/Physical pin 12
|
const PWM_CHANNEL_BUZZER: Channel = Channel::Pwm0; //PWM0 = GPIO18/Physical pin 12
|
||||||
|
Loading…
x
Reference in New Issue
Block a user