Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

234
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda