mirror of
https://github.com/Djeeberjr/fw-anwesenheit.git
synced 2025-10-13 15:06:39 +00:00
changed Date to u8 array
This commit is contained in:
parent
db7e22f45d
commit
09f21403ec
@ -83,10 +83,10 @@ impl Persistence for SDCardPersistence {
|
|||||||
let mut root_dir = vol_0.open_root_dir().unwrap();
|
let mut root_dir = vol_0.open_root_dir().unwrap();
|
||||||
let mut days_dir = root_dir.open_dir("days").unwrap();
|
let mut days_dir = root_dir.open_dir("days").unwrap();
|
||||||
|
|
||||||
let mut days = Vec::new();
|
let mut days: Vec<[u8; 10]> = Vec::new();
|
||||||
days_dir
|
days_dir
|
||||||
.iterate_dir(|e| {
|
.iterate_dir(|e| {
|
||||||
days.push(1);
|
days.push([0; 10]);
|
||||||
})
|
})
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
use crate::drivers::rtc;
|
||||||
|
use crate::drivers::rtc::RTCClock;
|
||||||
use crate::store::persistence::Persistence;
|
use crate::store::persistence::Persistence;
|
||||||
|
|
||||||
use super::Date;
|
use super::Date;
|
||||||
@ -45,8 +47,8 @@ impl<T: Persistence> IDStore<T> {
|
|||||||
// Some(map) => map,
|
// Some(map) => map,
|
||||||
// None => IDMapping::new(),
|
// None => IDMapping::new(),
|
||||||
// };
|
// };
|
||||||
|
|
||||||
let current_date: Date = 1;
|
let current_date: Date = [0; 10];
|
||||||
|
|
||||||
let day = persistence_layer
|
let day = persistence_layer
|
||||||
.load_day(current_date)
|
.load_day(current_date)
|
||||||
@ -72,8 +74,7 @@ impl<T: Persistence> IDStore<T> {
|
|||||||
|
|
||||||
/// Add a new id for the current day
|
/// Add a new id for the current day
|
||||||
/// Returns false if ID is already present at the current day.
|
/// Returns false if ID is already present at the current day.
|
||||||
pub async fn add_id(&mut self, id: TallyID) -> bool {
|
pub async fn add_id(&mut self, id: TallyID, current_date: Date) -> bool {
|
||||||
let current_date: Date = 1;
|
|
||||||
|
|
||||||
if self.current_day.date == current_date {
|
if self.current_day.date == current_date {
|
||||||
let changed = self.current_day.add_id(id);
|
let changed = self.current_day.add_id(id);
|
||||||
|
@ -5,5 +5,5 @@ mod id_store;
|
|||||||
pub use id_mapping::{IDMapping, Name};
|
pub use id_mapping::{IDMapping, Name};
|
||||||
pub use id_store::{IDStore,AttendanceDay};
|
pub use id_store::{IDStore,AttendanceDay};
|
||||||
|
|
||||||
pub type TallyID = [u8; 8];
|
pub type TallyID = [u8; 12];
|
||||||
pub type Date = u64;
|
pub type Date = [u8; 10];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user