Skip to content

Commit

Permalink
fix bug where resourceid and owner id's were compared instead of owne…
Browse files Browse the repository at this point in the history
…r->owner ids resulting in incorrect inventory computation in rare instances
  • Loading branch information
rwcarlsen committed Apr 1, 2016
1 parent f4a0625 commit 0a3f444
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions post/post.go
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ func (c *Context) walkDown(node *Node) {
rows.Close() // Close is idempotent - and this function is recursive.

// find resources owner changes (that occurred before children)
owners, times := c.getNewOwners(node.ResId)
owners, times := c.getNewOwners(node.OwnerId, node.ResId)

childOwner := node.OwnerId
if len(owners) > 0 {
Expand Down Expand Up @@ -345,7 +345,7 @@ func (c *Context) walkDown(node *Node) {
}
}

func (c *Context) getNewOwners(id int) (owners, times []int) {
func (c *Context) getNewOwners(currowner, id int) (owners, times []int) {
var owner, t int
rows, err := c.ownerStmt.Query(id, c.Simid)
panicif(err)
Expand All @@ -354,7 +354,7 @@ func (c *Context) getNewOwners(id int) (owners, times []int) {
err := rows.Scan(&owner, &t)
panicif(err)

if id == owner {
if currowner == owner {
continue
}
owners = append(owners, owner)
Expand Down

0 comments on commit 0a3f444

Please sign in to comment.