Skip to content

Commit

Permalink
Remove auto-calibration
Browse files Browse the repository at this point in the history
It is just in our way when we are conducting tests.
It seems useful in the real world but it fucks with the data.
  • Loading branch information
mads256h committed Dec 7, 2023
1 parent 60452b6 commit 989f455
Showing 1 changed file with 2 additions and 19 deletions.
21 changes: 2 additions & 19 deletions CentralHub.Api/Controllers/MeasurementController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,29 +89,12 @@ public async Task<GetFirstAggregatedMeasurementsDateTimeResponse> GetFirstAggreg

private static IReadOnlyList<AggregatedMeasurements> CreateMeasurements(IReadOnlyCollection<AggregatedMeasurementDto> aggregatedMeasurements)
{
var recentAggregatedMeasurements = aggregatedMeasurements
.Where(am => am.EndTime > (DateTime.UtcNow - TimeSpan.FromDays(1)))
.ToImmutableArray();

int bluetoothCalibrationNumber;
int wifiCalibrationNumber;
if (recentAggregatedMeasurements.Any())
{
bluetoothCalibrationNumber = recentAggregatedMeasurements.Min(am => am.BluetoothCount);
wifiCalibrationNumber = recentAggregatedMeasurements.Min(am => am.WifiCount);
}
else
{
bluetoothCalibrationNumber = 0;
wifiCalibrationNumber = 0;
}

return aggregatedMeasurements.Select(am => new AggregatedMeasurements(
am.AggregatedMeasurementDtoId,
am.StartTime,
am.EndTime,
am.BluetoothCount - bluetoothCalibrationNumber,
am.WifiCount - wifiCalibrationNumber)
am.BluetoothCount,
am.WifiCount)
).ToImmutableArray();
}
}

0 comments on commit 989f455

Please sign in to comment.