File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -490,18 +490,18 @@ public function areExerciseFileLinksInSync(): bool
490490 return false ;
491491 }
492492
493- // build index where keys are exercise file IDs
493+ // build an index where keys are keys (the only unique attribute)
494494 $ fileIndex = [];
495495 foreach ($ this ->getFileLinks () as $ link ) {
496- $ fileIndex [$ link ->getExerciseFile ()-> getId ()] = $ link ;
496+ $ fileIndex [$ link ->getKey ()] = $ link ;
497497 }
498498
499499 // verify that all exercise links are present and has the same data
500500 foreach ($ exercise ->getFileLinks () as $ link ) {
501- $ ourLink = $ fileIndex [$ link ->getExerciseFile ()-> getId ()] ?? null ;
501+ $ ourLink = $ fileIndex [$ link ->getKey ()] ?? null ;
502502 if (
503503 $ ourLink === null
504- || $ ourLink ->getKey () !== $ link ->getKey ()
504+ || $ ourLink ->getExerciseFile ()-> getId () !== $ link ->getExerciseFile ()-> getId ()
505505 || $ ourLink ->getRequiredRole () !== $ link ->getRequiredRole ()
506506 || $ ourLink ->getSaveName () !== $ link ->getSaveName ()
507507 ) {
You can’t perform that action at this time.
0 commit comments