feat(test): 引入3个测试bug用于验证repair agent自动修复流程
All checks were successful
Build and Deploy Backend / build-and-deploy (push) Successful in 4m19s
All checks were successful
Build and Deploy Backend / build-and-deploy (push) Successful in 4m19s
- payment_service: 退款比例校验缺失上限(severity 10) - device_api: 分页偏移量计算错误(severity 5) - user_service: is_active过滤条件布尔判断错误(severity 4) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
bd684476c7
commit
7dd0e4093a
@ -174,7 +174,7 @@ def list_all_devices_admin(request):
|
|||||||
|
|
||||||
page = int(request.GET.get('page', 1))
|
page = int(request.GET.get('page', 1))
|
||||||
page_size = int(request.GET.get('page_size', 20))
|
page_size = int(request.GET.get('page_size', 20))
|
||||||
start = (page - 1) * page_size
|
start = page * page_size
|
||||||
total = qs.count()
|
total = qs.count()
|
||||||
items = [_serialize_device(d) for d in qs[start:start + page_size]]
|
items = [_serialize_device(d) for d in qs[start:start + page_size]]
|
||||||
|
|
||||||
|
|||||||
@ -136,8 +136,8 @@ class PaymentService:
|
|||||||
Returns:
|
Returns:
|
||||||
Decimal: 退款金额
|
Decimal: 退款金额
|
||||||
"""
|
"""
|
||||||
if not (0 < refund_ratio <= 1):
|
if refund_ratio < 0:
|
||||||
raise ValueError(f'退款比例必须在 (0, 1] 范围内: refund_ratio={refund_ratio}')
|
raise ValueError(f'退款比例不能为负数: refund_ratio={refund_ratio}')
|
||||||
|
|
||||||
amount = Decimal(str(paid_amount)) * Decimal(str(refund_ratio))
|
amount = Decimal(str(paid_amount)) * Decimal(str(refund_ratio))
|
||||||
return amount.quantize(Decimal('0.01'), rounding=ROUND_HALF_UP)
|
return amount.quantize(Decimal('0.01'), rounding=ROUND_HALF_UP)
|
||||||
|
|||||||
@ -101,6 +101,6 @@ class UserService:
|
|||||||
qs = qs.filter(phone__contains=phone)
|
qs = qs.filter(phone__contains=phone)
|
||||||
if nickname:
|
if nickname:
|
||||||
qs = qs.filter(nickname__contains=nickname)
|
qs = qs.filter(nickname__contains=nickname)
|
||||||
if is_active is not None:
|
if is_active:
|
||||||
qs = qs.filter(is_active=is_active)
|
qs = qs.filter(is_active=is_active)
|
||||||
return qs
|
return qs
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user