Skip to content
Snippets Groups Projects
Commit f30dbb38 authored by Noé Le Cam's avatar Noé Le Cam
Browse files

Broke search

parent f49bf25c
Branches
No related merge requests found
......@@ -15,7 +15,6 @@ main > form {
main > form {
max-width: 28rem;
}
}
label {
......@@ -28,7 +27,7 @@ label {
fieldset {
display: flex;
flex-direction: row;
flex: 1 1 0px;
/* flex: 1 1 0px; */
padding: 0;
border: none;
gap: 0.5rem;
......@@ -42,8 +41,6 @@ input,
select {
background: #101010;
border: 1px solid rgba(255, 255, 255, 0.1);
box-sizing: border-box;
text-align: center;
font-size: 1rem;
......
......@@ -5,7 +5,8 @@
background: var(--smoke);
padding: 1rem 2rem;
border-radius: 10px;
width: 30vw;
box-sizing: border-box;
width: 100%;
box-shadow: 0 0 20px rgb(0, 0, 0, 0.5);
}
......
......@@ -4,6 +4,7 @@ section {
gap: 0.5rem;
overflow:hidden; overflow-y:scroll;
height: 55vh;
width: 40rem;
}
h2 {
......
......@@ -49,7 +49,8 @@ class TimeSlot
return $this->$name;
}
public function __clone() {
public function __clone()
{
$this->start = clone $this->start;
$this->end = clone $this->end;
}
......@@ -75,32 +76,30 @@ class TimeSlot
$ee_diff = $this->end->diff($slot->end);
// If $slot starts and ends before $this starts and ends respectively
if ($ss_diff->invert && $ee_diff->invert)
{
if ($ss_diff->invert && $ee_diff->invert) {
$clone = clone $this;
$clone->start->add($se_diff);
array_push($cutout, $clone);
}
// If $slot starts and ends after $this starts and ends respectively
elseif (!$ss_diff->invert && !$ee_diff->invert)
{
elseif (!$ss_diff->invert && !$ee_diff->invert) {
$clone = clone $this;
$clone->end->add($es_diff);
array_push($cutout, $clone);
}
// If $slot splits this in two
elseif (!$ss_diff->invert && $ee_diff->invert)
{
elseif (!$ss_diff->invert && $ee_diff->invert) {
$pre = clone $this;
$post = clone $this;
$pre->end->add($es_diff);
$post->start->add($se_diff);
array_push($cutout, $pre, $post);
}
elseif (!$ss_diff->invert || $ee_diff->invert) {
} elseif (!($ss_diff->invert && !$ee_diff->invert)) {
array_push($cutout, clone $this);
}
return $cutout;
return array_filter($cutout, function (TimeSlot $e) {
return $e->start != $e->end;
});
}
}
......@@ -78,7 +78,14 @@ try {
<h2>Résultats de la recherche</h2>
<hr>
<section>
<?php
foreach ($query_result as $overlap) {
$overlap->display();
}
echo "Scis";
$final_results = [];
foreach ($wanted_slots as $span) {
$scissors = array_filter(
......@@ -94,18 +101,41 @@ try {
foreach ($cutouts as $x)
$temp = array_merge($temp, $x->cut($overlap));
$cutouts = $temp;
}
$final_results = array_merge($final_results, $cutouts);
}
$final_results = array_filter($final_results, function(TimeSlot $e){
return $e->start != $e->end;
});
foreach ($final_results as $slot)
$slot->display();
echo "test";
$test_room = new Room();
$test_room->id = "UWU";
$test_room->location = 10;
$test_room->type = "tp";
$test_span = new TimeSlot();
$test_span->start_time = "09:00";
$test_span->end_time = "15:00";
$test_span->room = $test_room;
$test_cut = new TimeSlot();
$test_cut->start_time = "13:00";
$test_cut->end_time = "15:00";
$test_cut->room = $test_room;
$res = $test_span->cut($test_cut);
foreach ($res as $x) {
$x->display();
}
?>
</section>
</main>
<?php include "assets/php/cookies.php"; ?>
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment