55/*
66Usage:
77
8- use function Results\GetResults\get_results; // get_results($cat, $camp, $depth, $code)
8+ use function Results\GetResults\get_results;
99
1010*/
1111
12- use Tables \SqlTables \TablesSql ;
1312use function Results \FetchCatData \get_cat_exists_and_missing ;
1413use function Results \SparqlBot \filter_existing_out ;
1514use function TD \Render \TestPrint \test_print ;
@@ -35,7 +34,7 @@ function getinprocess($missing, $code)
3534 return $ titles ;
3635}
3736
38- function get_results ($ cat , $ camp , $ depth , $ code , $ filter_sparql ): array
37+ function get_results ($ cat , $ camp , $ depth , $ code , $ filter_sparql, $ cat2 ): array
3938{
4039 // Get existing and missing pages
4140 // ---
@@ -53,8 +52,6 @@ function get_results($cat, $camp, $depth, $code, $filter_sparql): array
5352 test_print ("Items missing: " . count ($ items_missing ));
5453
5554 // Check for a secondary category
56- $ cat2 = TablesSql::$ s_camps_cat2 [$ camp ] ?? '' ;
57-
5855 if (!empty ($ cat2 ) && $ cat2 !== $ cat ) {
5956 $ items_missing = filter_items_missing_cat2 ($ items_missing , $ cat2 , $ depth );
6057 }
@@ -63,7 +60,7 @@ function get_results($cat, $camp, $depth, $code, $filter_sparql): array
6360 test_print ("Length of existing pages: $ len_of_exists_pages " );
6461
6562 // Remove duplicates from missing items
66- $ missing = array_unique ($ items_missing );
63+ $ missing = array_values ( array_unique ($ items_missing) );
6764
6865 // Get in-process items
6966 $ inprocess = getinprocess ($ missing , $ code );
@@ -72,11 +69,14 @@ function get_results($cat, $camp, $depth, $code, $filter_sparql): array
7269 // Remove in-process items from missing list
7370 if ($ len_inprocess > 0 ) {
7471 $ missing = array_diff ($ missing , array_column ($ inprocess , 'title ' ));
75- // $missing = array_values($missing);
72+ $ missing = array_values ($ missing );
7673 }
7774
7875 $ summary = create_summary ($ code , $ cat , count ($ inprocess ), count ($ missing ), $ len_of_exists_pages );
7976
77+ // sort $items_exists by keys
78+ ksort ($ items_exists );
79+
8080 return [
8181 "inprocess " => $ inprocess ,
8282 "exists " => $ items_exists ,
0 commit comments