77use App \Events \SpeedtestBenchmarking ;
88use App \Events \SpeedtestBenchmarkUnhealthy ;
99use App \Helpers \Benchmark ;
10+ use App \Helpers \Number ;
1011use App \Models \Result ;
1112use App \Settings \ThresholdSettings ;
1213use Illuminate \Bus \Batchable ;
@@ -83,7 +84,8 @@ private function benchmark(Result $result, ThresholdSettings $settings): array
8384 'bar ' => 'min ' ,
8485 'passed ' => Benchmark::bitrate ($ result ->download , ['value ' => $ settings ->absolute_download , 'unit ' => 'mbps ' ]),
8586 'type ' => 'absolute ' ,
86- 'value ' => $ settings ->absolute_download ,
87+ 'test_value ' => Number::bitsToMagnitude (bits: $ result ->download_bits , precision: 0 , magnitude: 'mbit ' ),
88+ 'benchmark_value ' => $ settings ->absolute_download ,
8789 'unit ' => 'mbps ' ,
8890 ]);
8991
@@ -97,7 +99,8 @@ private function benchmark(Result $result, ThresholdSettings $settings): array
9799 'bar ' => 'min ' ,
98100 'passed ' => filter_var (Benchmark::bitrate ($ result ->upload , ['value ' => $ settings ->absolute_upload , 'unit ' => 'mbps ' ]), FILTER_VALIDATE_BOOLEAN ),
99101 'type ' => 'absolute ' ,
100- 'value ' => $ settings ->absolute_upload ,
102+ 'test_value ' => Number::bitsToMagnitude (bits: $ result ->upload_bits , precision: 0 , magnitude: 'mbit ' ),
103+ 'benchmark_value ' => $ settings ->absolute_upload ,
101104 'unit ' => 'mbps ' ,
102105 ]);
103106
@@ -111,7 +114,8 @@ private function benchmark(Result $result, ThresholdSettings $settings): array
111114 'bar ' => 'max ' ,
112115 'passed ' => Benchmark::ping ($ result ->ping , ['value ' => $ settings ->absolute_ping ]),
113116 'type ' => 'absolute ' ,
114- 'value ' => $ settings ->absolute_ping ,
117+ 'test_value ' => round ($ result ->ping ),
118+ 'benchmark_value ' => $ settings ->absolute_ping ,
115119 'unit ' => 'ms ' ,
116120 ]);
117121
0 commit comments