Skip to content

Commit d7b8e34

Browse files
authored
fix: history data at launch (#7)
1 parent 68e1d68 commit d7b8e34

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

src/Dishy.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -263,11 +263,6 @@ public function setSleepModeConfig(int $start = 0, int $duration = 1, bool $enab
263263

264264
public static function reorderHistoryData(array $array, int $current): array
265265
{
266-
// If current is less than buffer size, return valid samples
267-
if ($current < self::$historyBufferSize) {
268-
return $array;
269-
}
270-
271266
// Calculate the rotation point
272267
$startIndex = $current % self::$historyBufferSize;
273268

tests/Feature/HistoryDataReorderedTest.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,12 @@
3636

3737
expect($test_array[0])->toBe(1)
3838
->and($test_array[99])->toBe(100)
39-
->and($result[0])->toBe(1)
40-
->and($result[99])->toBe(100);
39+
->and($test_array[100])->toBe(0)
40+
->and($test_array[799])->toBe(0)
41+
->and($result[0])->toBe(0)
42+
->and($result[799])->toBe(0)
43+
->and($result[800])->toBe(1)
44+
->and($result[899])->toBe(100);
4145
});
4246

4347
it('reorder history data with the circula buffer at 900', function () {

0 commit comments

Comments
 (0)