mirror of
https://github.com/hyperledger/fabric-samples.git
synced 2026-06-21 17:15: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 (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/hyperledger/fabric-contract-api-go/v2/contractapi"
|
"github.com/hyperledger/fabric-contract-api-go/v2/contractapi"
|
||||||
)
|
)
|
||||||
|
|
@ -344,6 +345,12 @@ func (s *SmartContract) GetMultipleRecetas(ctx contractapi.TransactionContextInt
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("error al parsear la receta con ID %s: %v", id, err)
|
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)
|
recetas = append(recetas, &receta)
|
||||||
}
|
}
|
||||||
return recetas, nil
|
return recetas, nil
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue