@@ -387,6 +387,222 @@ describe('validatePersonAssignmentScheduleConflicts', () => {
387387 const errors = validatePersonAssignmentScheduleConflicts ( wcif ) ;
388388 expect ( errors ) . toHaveLength ( 0 ) ;
389389 } ) ;
390+
391+ it ( 'should not detect conflicts for grouped activities in cumulative time-limit rounds' , ( ) => {
392+ const wcif : Competition = {
393+ ...mockWcif ,
394+ events : [
395+ {
396+ id : '444bf' ,
397+ rounds : [
398+ {
399+ id : '444bf-r1' ,
400+ timeLimit : { centiseconds : 540000 , cumulativeRoundIds : [ '444bf-r1' , '555bf-r1' ] } ,
401+ } ,
402+ ] ,
403+ } ,
404+ {
405+ id : '555bf' ,
406+ rounds : [
407+ {
408+ id : '555bf-r1' ,
409+ timeLimit : { centiseconds : 540000 , cumulativeRoundIds : [ '444bf-r1' , '555bf-r1' ] } ,
410+ } ,
411+ ] ,
412+ } ,
413+ ] as Competition [ 'events' ] ,
414+ schedule : {
415+ ...mockWcif . schedule ,
416+ venues : [
417+ {
418+ ...mockWcif . schedule . venues [ 0 ] ,
419+ rooms : [
420+ {
421+ ...mockWcif . schedule . venues [ 0 ] . rooms [ 0 ] ,
422+ activities : [
423+ {
424+ id : 11 ,
425+ name : '4BLD Round 1' ,
426+ activityCode : '444bf-r1' ,
427+ startTime : '2024-01-01T09:00:00.000Z' ,
428+ endTime : '2024-01-01T10:00:00.000Z' ,
429+ childActivities : [
430+ {
431+ id : 142 ,
432+ name : '4BLD Round 1, Group 1' ,
433+ activityCode : '444bf-r1-g1' ,
434+ startTime : '2024-01-01T09:00:00.000Z' ,
435+ endTime : '2024-01-01T10:00:00.000Z' ,
436+ childActivities : [ ] ,
437+ extensions : [ ] ,
438+ } ,
439+ ] ,
440+ extensions : [ ] ,
441+ } ,
442+ {
443+ id : 12 ,
444+ name : '5BLD Round 1' ,
445+ activityCode : '555bf-r1' ,
446+ startTime : '2024-01-01T09:00:00.000Z' ,
447+ endTime : '2024-01-01T10:00:00.000Z' ,
448+ childActivities : [
449+ {
450+ id : 143 ,
451+ name : '5BLD Round 1, Group 1' ,
452+ activityCode : '555bf-r1-g1' ,
453+ startTime : '2024-01-01T09:00:00.000Z' ,
454+ endTime : '2024-01-01T10:00:00.000Z' ,
455+ childActivities : [ ] ,
456+ extensions : [ ] ,
457+ } ,
458+ ] ,
459+ extensions : [ ] ,
460+ } ,
461+ ] ,
462+ } ,
463+ ] ,
464+ } ,
465+ ] ,
466+ } ,
467+ persons : [
468+ createPerson ( {
469+ assignments : [
470+ { activityId : 142 , stationNumber : null , assignmentCode : 'competitor' } ,
471+ { activityId : 143 , stationNumber : null , assignmentCode : 'competitor' } ,
472+ ] ,
473+ } ) ,
474+ ] ,
475+ } ;
476+
477+ const errors = validatePersonAssignmentScheduleConflicts ( wcif ) ;
478+ expect ( errors ) . toHaveLength ( 0 ) ;
479+ } ) ;
480+
481+ it ( 'should not detect conflicts for same-event rounds that share cumulative time limits' , ( ) => {
482+ const wcif : Competition = {
483+ ...mockWcif ,
484+ events : [
485+ {
486+ id : '333fm' ,
487+ rounds : [
488+ {
489+ id : '333fm-r1' ,
490+ timeLimit : { centiseconds : 360000 , cumulativeRoundIds : [ '333fm-r1' , '333fm-r2' ] } ,
491+ } ,
492+ {
493+ id : '333fm-r2' ,
494+ timeLimit : { centiseconds : 360000 , cumulativeRoundIds : [ '333fm-r1' , '333fm-r2' ] } ,
495+ } ,
496+ ] ,
497+ } ,
498+ ] as Competition [ 'events' ] ,
499+ schedule : {
500+ ...mockWcif . schedule ,
501+ venues : [
502+ {
503+ ...mockWcif . schedule . venues [ 0 ] ,
504+ rooms : [
505+ {
506+ ...mockWcif . schedule . venues [ 0 ] . rooms [ 0 ] ,
507+ activities : [
508+ {
509+ id : 21 ,
510+ name : 'FMC Round 1' ,
511+ activityCode : '333fm-r1-a1' ,
512+ startTime : '2024-01-01T09:00:00.000Z' ,
513+ endTime : '2024-01-01T10:00:00.000Z' ,
514+ childActivities : [ ] ,
515+ extensions : [ ] ,
516+ } ,
517+ {
518+ id : 22 ,
519+ name : 'FMC Round 2' ,
520+ activityCode : '333fm-r2-a1' ,
521+ startTime : '2024-01-01T09:00:00.000Z' ,
522+ endTime : '2024-01-01T10:00:00.000Z' ,
523+ childActivities : [ ] ,
524+ extensions : [ ] ,
525+ } ,
526+ ] ,
527+ } ,
528+ ] ,
529+ } ,
530+ ] ,
531+ } ,
532+ persons : [
533+ createPerson ( {
534+ assignments : [
535+ { activityId : 21 , stationNumber : null , assignmentCode : 'competitor' } ,
536+ { activityId : 22 , stationNumber : null , assignmentCode : 'competitor' } ,
537+ ] ,
538+ } ) ,
539+ ] ,
540+ } ;
541+
542+ const errors = validatePersonAssignmentScheduleConflicts ( wcif ) ;
543+ expect ( errors ) . toHaveLength ( 0 ) ;
544+ } ) ;
545+
546+ it ( 'should still detect conflicts within the same cumulative time-limit round' , ( ) => {
547+ const wcif : Competition = {
548+ ...mockWcif ,
549+ events : [
550+ {
551+ id : '444bf' ,
552+ rounds : [
553+ {
554+ id : '444bf-r1' ,
555+ timeLimit : { centiseconds : 540000 , cumulativeRoundIds : [ '444bf-r1' , '555bf-r1' ] } ,
556+ } ,
557+ ] ,
558+ } ,
559+ ] as Competition [ 'events' ] ,
560+ schedule : {
561+ ...mockWcif . schedule ,
562+ venues : [
563+ {
564+ ...mockWcif . schedule . venues [ 0 ] ,
565+ rooms : [
566+ {
567+ ...mockWcif . schedule . venues [ 0 ] . rooms [ 0 ] ,
568+ activities : [
569+ {
570+ id : 31 ,
571+ name : '4BLD Round 1, Group 1' ,
572+ activityCode : '444bf-r1-g1' ,
573+ startTime : '2024-01-01T09:00:00.000Z' ,
574+ endTime : '2024-01-01T10:00:00.000Z' ,
575+ childActivities : [ ] ,
576+ extensions : [ ] ,
577+ } ,
578+ {
579+ id : 32 ,
580+ name : '4BLD Round 1, Group 2' ,
581+ activityCode : '444bf-r1-g2' ,
582+ startTime : '2024-01-01T09:30:00.000Z' ,
583+ endTime : '2024-01-01T10:30:00.000Z' ,
584+ childActivities : [ ] ,
585+ extensions : [ ] ,
586+ } ,
587+ ] ,
588+ } ,
589+ ] ,
590+ } ,
591+ ] ,
592+ } ,
593+ persons : [
594+ createPerson ( {
595+ assignments : [
596+ { activityId : 31 , stationNumber : null , assignmentCode : 'competitor' } ,
597+ { activityId : 32 , stationNumber : null , assignmentCode : 'staff-judge' } ,
598+ ] ,
599+ } ) ,
600+ ] ,
601+ } ;
602+
603+ const errors = validatePersonAssignmentScheduleConflicts ( wcif ) ;
604+ expect ( errors ) . toHaveLength ( 1 ) ;
605+ } ) ;
390606} ) ;
391607
392608describe ( 'validatePersonAssignments' , ( ) => {
0 commit comments