WIP: data-migration #6

Closed
Alfred-mk wants to merge 8 commits from data-migration into master
4 changed files with 10 additions and 15 deletions

View File

@ -18,17 +18,17 @@ import (
"git.defalsify.org/vise.git/persist" "git.defalsify.org/vise.git/persist"
"git.defalsify.org/vise.git/resource" "git.defalsify.org/vise.git/resource"
"git.defalsify.org/vise.git/state" "git.defalsify.org/vise.git/state"
dataserviceapi "github.com/grassrootseconomics/ussd-data-service/pkg/api" "git.grassecon.net/grassrootseconomics/common/hex"
"git.grassecon.net/grassrootseconomics/common/identity"
commonlang "git.grassecon.net/grassrootseconomics/common/lang"
"git.grassecon.net/grassrootseconomics/common/person"
"git.grassecon.net/grassrootseconomics/common/phone"
"git.grassecon.net/grassrootseconomics/common/pin"
"git.grassecon.net/grassrootseconomics/sarafu-api/remote"
"git.grassecon.net/grassrootseconomics/sarafu-vise/profile" "git.grassecon.net/grassrootseconomics/sarafu-vise/profile"
"git.grassecon.net/grassrootseconomics/sarafu-vise/store" "git.grassecon.net/grassrootseconomics/sarafu-vise/store"
storedb "git.grassecon.net/grassrootseconomics/sarafu-vise/store/db" storedb "git.grassecon.net/grassrootseconomics/sarafu-vise/store/db"
"git.grassecon.net/grassrootseconomics/sarafu-api/remote" dataserviceapi "github.com/grassrootseconomics/ussd-data-service/pkg/api"
"git.grassecon.net/grassrootseconomics/common/hex"
commonlang "git.grassecon.net/grassrootseconomics/common/lang"
"git.grassecon.net/grassrootseconomics/common/pin"
"git.grassecon.net/grassrootseconomics/common/person"
"git.grassecon.net/grassrootseconomics/common/phone"
"git.grassecon.net/grassrootseconomics/common/identity"
) )
var ( var (
@ -101,17 +101,14 @@ func NewMenuHandlers(appFlags *FlagManager, userdataStore db.Db, accountService
return h, nil return h, nil
} }
Outdated
Review

Please remove this leftover commented code thanks

Please remove this leftover commented code thanks
// WithPersister sets persister instance to the handlers. // SetPersister sets persister instance to the handlers.
//func (h *MenuHandlers) WithPersister(pe *persist.Persister) *MenuHandlers {
func (h *MenuHandlers) SetPersister(pe *persist.Persister) { func (h *MenuHandlers) SetPersister(pe *persist.Persister) {
if h.pe != nil { if h.pe != nil {
panic("persister already set") panic("persister already set")
} }
h.pe = pe h.pe = pe
//return h
} }
// Init initializes the handler for a new session. // Init initializes the handler for a new session.
func (h *MenuHandlers) Init(ctx context.Context, sym string, input []byte) (resource.Result, error) { func (h *MenuHandlers) Init(ctx context.Context, sym string, input []byte) (resource.Result, error) {
var r resource.Result var r resource.Result

View File

@ -265,7 +265,6 @@ func TestWithPersister(t *testing.T) {
h.SetPersister(p) h.SetPersister(p)
assert.Equal(t, p, h.pe, "The persister should be set correctly.") assert.Equal(t, p, h.pe, "The persister should be set correctly.")
//assert.Equal(t, h, result, "The returned handler should be the same instance.")
} }
func TestWithPersister_PanicWhenAlreadySet(t *testing.T) { func TestWithPersister_PanicWhenAlreadySet(t *testing.T) {

View File

@ -60,7 +60,6 @@ func (ls *LocalHandlerService) GetHandler(accountService remote.AccountService)
if err != nil { if err != nil {
return nil, err return nil, err
} }
//appHandlers = appHandlers.WithPersister(ls.Pe)
appHandlers.SetPersister(ls.Pe) appHandlers.SetPersister(ls.Pe)
ls.DbRs.AddLocalFunc("set_language", appHandlers.SetLanguage) ls.DbRs.AddLocalFunc("set_language", appHandlers.SetLanguage)
ls.DbRs.AddLocalFunc("create_account", appHandlers.CreateAccount) ls.DbRs.AddLocalFunc("create_account", appHandlers.CreateAccount)

View File

@ -3,7 +3,7 @@ CATCH select_language flag_language_set 0
CATCH terms flag_account_created 0 CATCH terms flag_account_created 0
LOAD check_account_status 0 LOAD check_account_status 0
RELOAD check_account_status RELOAD check_account_status
CATCH api_failure flag_api_call_error 1 CATCH api_failure flag_api_call_error 1
CATCH account_pending flag_account_pending 1 CATCH account_pending flag_account_pending 1
CATCH create_pin flag_pin_set 0 CATCH create_pin flag_pin_set 0
CATCH main flag_account_success 1 CATCH main flag_account_success 1