mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Fixes for sorting
This commit is contained in:
parent
fabf02ace0
commit
0339e7a07b
@ -97,9 +97,12 @@ class TaskRepository extends BaseRepository
|
||||
} else {
|
||||
$time_log = [];
|
||||
}
|
||||
|
||||
$key_values = array_column($time_log, 0);
|
||||
array_multisort($key_values, SORT_ASC, $time_log);
|
||||
|
||||
// array_multisort($time_log);
|
||||
ksort($time_log);
|
||||
// ksort($time_log);
|
||||
|
||||
if (isset($data['action'])) {
|
||||
if ($data['action'] == 'start') {
|
||||
|
@ -99,6 +99,42 @@ class TaskApiTest extends TestCase
|
||||
}
|
||||
}
|
||||
|
||||
public function testMultiSortArray()
|
||||
{
|
||||
|
||||
$logs = [
|
||||
[1680035007,1680036807,"",true],
|
||||
[1681156840,1681158000,"",true],
|
||||
[1680302433,1680387960,"",true],
|
||||
[1680715620,1680722820,"",true],
|
||||
[1,1680737460,"",true]
|
||||
];
|
||||
|
||||
$key_values = array_column($logs, 0);
|
||||
|
||||
nlog($logs);
|
||||
|
||||
}
|
||||
|
||||
public function testKsortPerformance()
|
||||
{
|
||||
$logs = [
|
||||
[1680035007,1680036807,"",true],
|
||||
[1681156840,1681158000,"",true],
|
||||
[1680302433,1680387960,"",true],
|
||||
[1680715620,1680722820,"",true],
|
||||
[1,1680737460,"",true]
|
||||
];
|
||||
|
||||
$key_values = array_column($logs, 0);
|
||||
array_multisort($key_values, SORT_ASC, $logs);
|
||||
|
||||
$start = $logs[0];
|
||||
|
||||
$this->assertEquals(1, $start[0]);
|
||||
|
||||
}
|
||||
|
||||
public function testStartStopSanity()
|
||||
{
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user