- pick only best results fixed
This commit is contained in:
		
							parent
							
								
									5011bd956b
								
							
						
					
					
						commit
						77cf3f267a
					
				@ -462,15 +462,15 @@ class TestMgr
 | 
			
		||||
            foreach ($tests as $test) {
 | 
			
		||||
                $nickname = $test["nickname"];
 | 
			
		||||
                if (!in_array($nickname, $best_test_ids)) {
 | 
			
		||||
                    $best_tests[$nickname] = $test["_id"];
 | 
			
		||||
                    $best_test_ids[$nickname] = $test["_id"];
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // just keep values, drop the keys (nicknames)
 | 
			
		||||
            $best_tests = array_values($best_tests);
 | 
			
		||||
            $best_test_ids = array_values($best_test_ids);
 | 
			
		||||
 | 
			
		||||
            // remove non-best results
 | 
			
		||||
            $test_data_array = array_filter($test_data_array, fn($test) => in_array($test["_id"], $best_tests));
 | 
			
		||||
            $test_data_array = array_filter($test_data_array, fn($test) => in_array($test["_id"], $best_test_ids));
 | 
			
		||||
 | 
			
		||||
            // renumber results
 | 
			
		||||
            $test_data_array = array_values($test_data_array);
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user