Skip to content

Commit

Permalink
Workaround for floats
Browse files Browse the repository at this point in the history
Signed-off-by: Florian Oberndörfer <florian8751t@gmail.com>
  • Loading branch information
flo0852 committed Nov 26, 2024
1 parent c37e6d6 commit 1e439ee
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
5 changes: 3 additions & 2 deletions apps/backend/src/app/alerting/alerting.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@ export class AlertingService {
const alert = new AlertEntity();

alert.type = createAlertDto.type;
alert.value = createAlertDto.value;
alert.referenceValue = createAlertDto.referenceValue;
alert.value = Math.floor(createAlertDto.value);
alert.referenceValue = Math.floor(createAlertDto.referenceValue);
const backupDataEntity = await this.backupDataService.findOneById(
createAlertDto.backupId
);
if (!backupDataEntity) {
console.log(`Backup with id ${createAlertDto.backupId} not found`);
throw new NotFoundException(
`Backup with id ${createAlertDto.backupId} not found`
);
Expand Down
14 changes: 11 additions & 3 deletions apps/backend/src/app/backupData/backupData.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ export class BackupDataService extends PaginationService {
async create(
createBackupDataDto: CreateBackupDataDto
): Promise<BackupDataEntity> {
return await this.backupDataRepository.save(createBackupDataDto);
return await this.backupDataRepository.save({
...createBackupDataDto,
sizeMB: Math.floor(createBackupDataDto.sizeMB),
});
}

/**
Expand All @@ -66,7 +69,12 @@ export class BackupDataService extends PaginationService {
async createBatched(
createBackupDataDtos: CreateBackupDataDto[]
): Promise<void> {
await this.backupDataRepository.save(createBackupDataDtos);
await this.backupDataRepository.save(
createBackupDataDtos.map((dto) => ({
...dto,
sizeMB: Math.floor(dto.sizeMB),
}))
);
}

/**
Expand Down Expand Up @@ -95,7 +103,7 @@ export class BackupDataService extends PaginationService {
from.setHours(0);
from.setMinutes(0);
from.setSeconds(0);
from.setMilliseconds(0)
from.setMilliseconds(0);
console.log(from);
}
if (backupDataFilterDto.toDate) {
Expand Down

0 comments on commit 1e439ee

Please sign in to comment.