fixed small bug
This commit is contained in:
1 parent
d2cf9d7498
commit
9fcf26ea75
2 files changed
+7
-5
No files matched your search
+3
-2
@@ -9,7 +9,8 @@ import (
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/didiercrunch/doorman/shared"
|
||||
client "github.com/didiercrunch/doorman/shared"
|
||||
"github.com/didiercrunch/doormanserver/shared"
|
||||
)
|
||||
|
||||
type DoormanValue struct {
|
||||
@@ -128,7 +129,7 @@ func (dmd *DoormanDefinition) CanBeUpdatedBy(dmd2 *DoormanDefinition) error {
|
||||
}
|
||||
|
||||
func (dmd *DoormanDefinition) AsDoormanUpdatePayload() ([]byte, error) {
|
||||
wu := &shared.DoormanUpdater{Id: dmd.Id.Hex()}
|
||||
wu := &client.DoormanUpdater{Id: shared.ObjectIdToPublicId(dmd.Id)}
|
||||
wu.Timestamp = time.Now().Unix()
|
||||
wu.Probabilities = make([]*big.Rat, len(dmd.Values))
|
||||
for i, value := range dmd.Values {
|
||||
|
||||
@@ -5,7 +5,8 @@ import (
|
||||
"math/big"
|
||||
"testing"
|
||||
|
||||
"github.com/didiercrunch/doorman/shared"
|
||||
client "github.com/didiercrunch/doorman/shared"
|
||||
"github.com/didiercrunch/doormanserver/shared"
|
||||
"gopkg.in/mgo.v2/bson"
|
||||
)
|
||||
|
||||
@@ -101,11 +102,11 @@ func TestAsDoormanUpdatePayload(t *testing.T) {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
wu := &shared.DoormanUpdater{}
|
||||
wu := &client.DoormanUpdater{}
|
||||
if err := json.Unmarshal(data, wu); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if wd.Id.Hex() != wu.Id {
|
||||
if shared.ObjectIdToPublicId(wd.Id) != wu.Id {
|
||||
t.Error("bad id", wu.Id)
|
||||
}
|
||||
if len(wu.Probabilities) != 2 {
|
||||
|
||||
Reference in new issue
Block a user