Sort events by color if otherwise equal.

This commit is contained in:
Leo Vasanko 2025-08-23 06:43:05 -06:00
parent 6b8963c698
commit f54b6b971b

View File

@ -61,6 +61,12 @@ const eventSpans = computed(() => {
const spanB = b.endIdx - b.startIdx const spanB = b.endIdx - b.startIdx
if (spanA !== spanB) return spanB - spanA if (spanA !== spanB) return spanB - spanA
if (a.startIdx !== b.startIdx) return a.startIdx - b.startIdx if (a.startIdx !== b.startIdx) return a.startIdx - b.startIdx
// For one-day events that are otherwise equal, sort by color (0 first)
if (spanA === 0 && spanB === 0 && a.startIdx === b.startIdx) {
const colorA = a.colorId || 0
const colorB = b.colorId || 0
if (colorA !== colorB) return colorA - colorB
}
return String(a.id).localeCompare(String(b.id)) return String(a.id).localeCompare(String(b.id))
}) })
// Assign non-overlapping rows // Assign non-overlapping rows