convert the user input to uppercase before calling the pool Details API
This commit is contained in:
parent
6abcb97f3a
commit
5ee99cdcd8
@ -3,6 +3,7 @@ package application
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"git.defalsify.org/vise.git/db"
|
"git.defalsify.org/vise.git/db"
|
||||||
"git.defalsify.org/vise.git/resource"
|
"git.defalsify.org/vise.git/resource"
|
||||||
@ -104,6 +105,7 @@ func (h *MenuHandlers) GetDefaultPool(ctx context.Context, sym string, input []b
|
|||||||
|
|
||||||
// ViewPool retrieves the pool details from the user store
|
// ViewPool retrieves the pool details from the user store
|
||||||
// and displays it to the user for them to select it.
|
// and displays it to the user for them to select it.
|
||||||
|
// if the data does not exist, it calls the API to get the pool details
|
||||||
func (h *MenuHandlers) ViewPool(ctx context.Context, sym string, input []byte) (resource.Result, error) {
|
func (h *MenuHandlers) ViewPool(ctx context.Context, sym string, input []byte) (resource.Result, error) {
|
||||||
var res resource.Result
|
var res resource.Result
|
||||||
sessionId, ok := ctx.Value("SessionId").(string)
|
sessionId, ok := ctx.Value("SessionId").(string)
|
||||||
@ -131,8 +133,11 @@ func (h *MenuHandlers) ViewPool(ctx context.Context, sym string, input []byte) (
|
|||||||
if poolData == nil {
|
if poolData == nil {
|
||||||
flag_api_call_error, _ := h.flagManager.GetFlag("flag_api_call_error")
|
flag_api_call_error, _ := h.flagManager.GetFlag("flag_api_call_error")
|
||||||
|
|
||||||
|
// convert to uppercase before the call
|
||||||
|
poolSymbol := strings.ToUpper(inputStr)
|
||||||
|
|
||||||
// no match found. Call the API using the inputStr as the symbol
|
// no match found. Call the API using the inputStr as the symbol
|
||||||
poolResp, err := h.accountService.RetrievePoolDetails(ctx, inputStr)
|
poolResp, err := h.accountService.RetrievePoolDetails(ctx, poolSymbol)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
res.FlagSet = append(res.FlagSet, flag_api_call_error)
|
res.FlagSet = append(res.FlagSet, flag_api_call_error)
|
||||||
return res, nil
|
return res, nil
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user