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

119
Visualizações
Sorting event data; multi-day and single

I am building an event calendar and am stuck binning single-day events around multi-day events. Each day is a div and I can build a month calendar no problem. The problem is mainly when multi-day events overlap and one will break line. The top blue line is continuous, yellow until 6th, red until 7th.
enter image description here
I have searched 'bin stacking' and many other approaches but can't seem to find what seems apt. Part of the problem is my maths limitations and found algorithms end up leave me feeling boggled. My current (non-math) concept is to build an array of arrays; 'number of days in the month' wide by 'expected maximum number of events high.'
Roughly like:

    xxxxxx... xxx // say 31 days  
    xxxxxx... xxx  
    ... +6  
    xxxxxx... xxx  
    xxxxxx... xxx // say max 10 events in any day.

A bit of pseudo code...
Run through array[0] for blueEv > is [0][4]=='x' && [0][5]=='x' && [0][6]=='x' = yes, then lay it in.
for yellowEv > is [0][4]=='x' && [0][5]=='x' = no - then
is [1][4]=='x' && [1][5]=='x' = yes - then do it
redEv... [0] no good [1/] no good and [2] fits
and so on through spanned events and then slot in singles into remaining 'x' slots
remove 'x's and empty arrays at the end and... well, it works but I suspect there is a much more elegant way of doing this.

Pointing to any existing algorithms or functions or some such would be great. I can code tolerably well enough so, in the absence of any known existing code, an outline of approach would great. I am just rounding out the list-view (piece of cake :) and girding my loins ready for month-view.
Q. Why don't I use an existing cal? There are certainly plenty. A. Learning + fun.

Thank you.

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