Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

230
Visualizações
Index every overlapping slot and the same number can't overlap itself in php

I'm using jq.schedule(https://github.com/ateliee/jquery.schedule/) to display a schedule that is changing every day. Today we "index" every blue time slot with a number from 1-7 depending on how many time slots are overlapping manually on paper. The index number tells the cashier which register they should be at.

For example, in the morning between 7 and 9 in the morning, there are only 2 cashiers. So the highest index number can be 2. And between 16-17 there are 5 overlapping slots, so the highest number can be 5.

All the time slots are in a array. I've tried to loop foreach and find which are overlapping but I don't get the numbers correct.

And to get the cashier to move and get rotation, the same person shouldn't be the same number more than two hours at a time.

Purple means break, so there shouldn't be any index on those.

This is what I've tried:

    foreach ($timeslot as $thisevent) {
    $kassanralla = 1;
    foreach ($timeslot as $thatevent) {
       if ($thisevent['Timestart'] > $thatevent['Timestart']) {
        
        $thisevent_from = $thisevent['Timestart'];
        $thisevent_ends = $thisevent['Timestop'];
        $thatevent_from = $thatevent['Timestart'];
        $thatevent_ends = $thatevent['Timestop'];
        if ($thatevent_ends > $thisevent_from AND $thisevent_ends > $thatevent_from) {
            $kassanralla++;
        }
    }
    if ($kassanralla === 0) {

    }
    }
    echo'
    $("#schedule").timeSchedule("addSchedule", "'.$thisevent['Row'].'", {
    start: "'.$thisevent['Timestart'].'",
    end: "'.$thisevent['Timestop'].'",
    text:"'.$kassanralla.'",
    data:{
    "class": "'.$divclass.'"
    }
    });';

image of the schedule:
Click here for image of the schedule

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda