Sửa lỗi backend để chạy phần đăng ký
This commit is contained in:
Vendored
+5
-9
@@ -1,17 +1,14 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ExpenseEngine = void 0;
|
||||
const common_1 = require("@nestjs/common");
|
||||
class ExpenseEngine {
|
||||
import { BadRequestException } from '@nestjs/common';
|
||||
export class ExpenseEngine {
|
||||
calculateSplit(totalCost, adultCount, childCount, childDiscountPercent) {
|
||||
if (totalCost < 0 || adultCount < 0 || childCount < 0 || childDiscountPercent < 0) {
|
||||
throw new common_1.BadRequestException('Dữ liệu đầu vào không được là số âm.');
|
||||
throw new BadRequestException('Dữ liệu đầu vào không được là số âm.');
|
||||
}
|
||||
if (childDiscountPercent > 100) {
|
||||
throw new common_1.BadRequestException('Phần trăm giảm giá không thể vượt quá 100%.');
|
||||
throw new BadRequestException('Phần trăm giảm giá không thể vượt quá 100%.');
|
||||
}
|
||||
if (adultCount + childCount === 0) {
|
||||
throw new common_1.BadRequestException('Số lượng người tham gia phải lớn hơn 0.');
|
||||
throw new BadRequestException('Số lượng người tham gia phải lớn hơn 0.');
|
||||
}
|
||||
const discountRate = childDiscountPercent / 100;
|
||||
const childRateFactor = 1 - discountRate;
|
||||
@@ -34,5 +31,4 @@ class ExpenseEngine {
|
||||
};
|
||||
}
|
||||
}
|
||||
exports.ExpenseEngine = ExpenseEngine;
|
||||
//# sourceMappingURL=expense-engine.service.js.map
|
||||
Reference in New Issue
Block a user