Skip to content
Snippets Groups Projects
Commit a8a8381f authored by marcantoinem's avatar marcantoinem
Browse files

chore: cleanup the codebase and small bugfix

parent 0029fe41
No related branches found
No related tags found
No related merge requests found
......@@ -165,7 +165,7 @@ where
>
<SearchCourse courses=courses.clone() action_courses set_active_tab/>
</Await>
<div class="flex w-full">
<div class="flex w-full flex-wrap">
<button class="tab-button chips" class=("tab-selected", move || active_tab.get() == "") id="personal" on:click={
move |_| set_active_tab.set("".to_string())
}>
......
......@@ -41,7 +41,6 @@ pub fn GeneratorPage() -> impl IntoView {
.dyn_into::<web_sys::Element>()
.unwrap();
let scroll_top = target.scroll_top() as f64;
logging::log!("{} {}", scroll_top, target.client_height());
if (scroll_top + target.client_height() as f64 >= target.scroll_height() as f64 - 500.0) && state.step.get() == 5 {
state.regenerate();
}
......
use std::sync::atomic::{AtomicUsize, Ordering};
use aep_schedule_generator::{
algorithm::{generation::SchedulesOptions, schedule::Schedule, scores::EvaluationOption},
data::time::week::Week,
......@@ -23,7 +25,7 @@ pub struct OptionState {
pub step: RwSignal<u8>,
pub hide: RwSignal<bool>,
pub schedule: RwSignal<Vec<Schedule>>,
pub max_size: StoredValue<usize>,
pub max_size: StoredValue<AtomicUsize>,
}
impl OptionState {
......@@ -68,13 +70,16 @@ impl OptionState {
}
pub fn generate(&self) {
self.max_size.set_value(5);
self.max_size
.update_value(|v| v.store(8, Ordering::Relaxed));
self.gen();
}
pub fn regenerate(&self) {
self.max_size.update_value(|size| {
*size = std::cmp::max(*size * 2, 2usize.pow(16));
let _ = size.fetch_update(Ordering::Relaxed, Ordering::Relaxed, |v| {
Some(std::cmp::min(v * 2, 2usize.pow(12)))
});
});
self.gen();
}
......@@ -120,7 +125,7 @@ impl Default for OptionState {
step: create_rw_signal(0),
schedule: create_rw_signal(vec![]),
hide: create_rw_signal(false),
max_size: store_value(5usize),
max_size: store_value(AtomicUsize::from(8)),
}
}
}
......@@ -135,7 +140,10 @@ impl From<&OptionState> for SchedulesOptions {
.into_iter()
.map(|c| c.into())
.collect();
let max_size = state.max_size.get_value();
let mut max_size = 8;
state
.max_size
.update_value(|v| max_size = v.load(Ordering::Relaxed));
let max_nb_conflicts = state.max_nb_conflicts.get();
let evaluation = EvaluationOption {
day_off: state.day_off.get(),
......
......@@ -114,15 +114,6 @@
align-items: center;
}
.number-input {
height: 22pt;
margin-left: auto;
}
.title {
line-height: 0.1;
}
.selected-hour {
background-color: rgb(87, 104, 175);
}
......@@ -131,10 +122,6 @@
background-color: $light-background;
}
.selection {
pointer-events: none;
}
.notif-modal {
position: absolute;
left: 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment