mirror of
https://github.com/hyperledger/fabric-samples.git
synced 2026-06-17 07:25:10 +00:00
fix get multiple recetetas para filtrar las que no estan borradas
This commit is contained in:
parent
d95af3b0f7
commit
2d3b46b741
1 changed files with 7 additions and 0 deletions
|
|
@ -3,6 +3,7 @@ package chaincode
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/hyperledger/fabric-contract-api-go/v2/contractapi"
|
||||
)
|
||||
|
|
@ -344,6 +345,12 @@ func (s *SmartContract) GetMultipleRecetas(ctx contractapi.TransactionContextInt
|
|||
if err != nil {
|
||||
return nil, fmt.Errorf("error al parsear la receta con ID %s: %v", id, err)
|
||||
}
|
||||
|
||||
status := strings.ToLower(strings.TrimSpace(receta.Status))
|
||||
if status == string(EstadoCancelled) {
|
||||
continue // Ignorar receta cancelada
|
||||
}
|
||||
|
||||
recetas = append(recetas, &receta)
|
||||
}
|
||||
return recetas, nil
|
||||
|
|
|
|||
Loading…
Reference in a new issue