mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-20 13:31:56 +00:00
fix(BE-78)change typedata in recording dto and validation for create and update
This commit is contained in:
@@ -13,16 +13,15 @@ func MapBodyWeights(recordingID uint, items []validation.BodyWeight) []entity.Re
|
||||
result := make([]entity.RecordingBW, 0, len(items))
|
||||
for _, item := range items {
|
||||
totalWeight := item.TotalWeight
|
||||
if totalWeight == nil {
|
||||
calculated := item.AvgWeight * item.Qty
|
||||
totalWeight = &calculated
|
||||
if totalWeight <= 0 {
|
||||
totalWeight = item.AvgWeight * item.Qty
|
||||
}
|
||||
|
||||
result = append(result, entity.RecordingBW{
|
||||
RecordingId: recordingID,
|
||||
AvgWeight: item.AvgWeight,
|
||||
Qty: item.Qty,
|
||||
TotalWeight: *totalWeight,
|
||||
TotalWeight: totalWeight,
|
||||
})
|
||||
}
|
||||
return result
|
||||
@@ -35,12 +34,8 @@ func MapStocks(recordingID uint, items []validation.Stock) []entity.RecordingSto
|
||||
|
||||
result := make([]entity.RecordingStock, 0, len(items))
|
||||
for _, item := range items {
|
||||
var usageAmount float64
|
||||
if item.Qty != nil {
|
||||
usageAmount = *item.Qty
|
||||
}
|
||||
usagePtr := new(float64)
|
||||
*usagePtr = usageAmount
|
||||
*usagePtr = item.Qty
|
||||
pending := item.PendingQty
|
||||
if pending == nil {
|
||||
pending = new(float64)
|
||||
|
||||
Reference in New Issue
Block a user