Skip to content

Commit

Permalink
Merge pull request #170 from jaredbischof/master
Browse files Browse the repository at this point in the history
Version 0.8.9
  • Loading branch information
jaredbischof committed Apr 4, 2014
2 parents 8b758a3 + aeed52c commit 00595f1
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.8.8
0.8.9
4 changes: 4 additions & 0 deletions shock-server/controller/node/multi.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ func (cr *NodeController) ReadMany(ctx context.Context) error {
if value != "" {
if numValue, err := strconv.Atoi(value); err == nil {
q["$or"] = ListOfMaps{{keyStr: value}, {keyStr: numValue}}
} else if value == "null" {
q["$or"] = ListOfMaps{{keyStr: value}, {keyStr: nil}}
} else {
q[keyStr] = value
}
Expand All @@ -77,6 +79,8 @@ func (cr *NodeController) ReadMany(ctx context.Context) error {
if value != "" {
if numValue, err := strconv.Atoi(value); err == nil {
q["$or"] = ListOfMaps{{key: value}, {key: numValue}}
} else if value == "null" {
q["$or"] = ListOfMaps{{key: value}, {key: nil}}
} else {
q[key] = value
}
Expand Down
2 changes: 1 addition & 1 deletion shock-server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func mapRoutes() {
R: []string{"node"},
T: "Shock",
U: host + "/",
V: "0.8.8",
V: "0.8.9",
}
return responder.WriteResponseObject(ctx, http.StatusOK, r)
})
Expand Down
6 changes: 3 additions & 3 deletions shock-server/node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/MG-RAST/golib/mgo/bson"
"io/ioutil"
"os"
"time"
)

type Node struct {
Expand All @@ -27,8 +28,8 @@ type Node struct {
Tags []string `bson:"tags" json:"tags"`
Revisions []Node `bson:"revisions" json:"-"`
Linkages []linkage `bson:"linkage" json:"linkages"`
CreatedOn string `bson:"created_on" json:"created_on"`
LastModified string `bson:"last_modified" json:"last_modified"`
CreatedOn time.Time `bson:"created_on" json:"created_on"`
LastModified time.Time `bson:"last_modified" json:"last_modified"`
}

type linkage struct {
Expand Down Expand Up @@ -58,7 +59,6 @@ func New() (node *Node) {
node.Indexes = make(map[string]IdxInfo)
node.File.Checksum = make(map[string]string)
node.setId()
node.LastModified = "-"
return
}

Expand Down
6 changes: 3 additions & 3 deletions shock-server/node/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,10 +272,10 @@ func (node *Node) Save() (err error) {
n := Node{node.Id, node.Version, node.File, node.Attributes, node.Public, node.Indexes, node.Acl, node.VersionParts, node.Tags, nil, node.Linkages, node.CreatedOn, node.LastModified}
node.Revisions = append(node.Revisions, n)
}
if node.CreatedOn == "" {
node.CreatedOn = time.Now().Format(time.UnixDate)
if node.CreatedOn.String() == "" {
node.CreatedOn = time.Now()
} else {
node.LastModified = time.Now().Format(time.UnixDate)
node.LastModified = time.Now()
}

bsonPath := fmt.Sprintf("%s/%s.bson", node.Path(), node.Id)
Expand Down

0 comments on commit 00595f1

Please sign in to comment.