Hopbot log for 2007-12-01 - Helma IRC channel: #helma on irc.freenode.net

2007-12-01:

[22:07] <midnightmonster> hey. HopObject.getOrderedView seems to be using old/bad data on my site
[22:07] <midnightmonster> (using the built-in xml object db)
[22:09] <midnightmonster> see "Most Recently Recorded" section of <http://preachingtheword.net/sermons/>. It used to be correct. And the current order may have been correct at one time. I had some folks doing data entry who put the current date in for a bunch, but then went back and corrected it. But the listing certainly isn't right with the current data
[22:11] <midnightmonster> this code uses the same method of sorting as the live code and returns the same wacky set of dates (though stored as milliseconds since the epoch, since the object db won't store date objects).
[22:11] <midnightmonster> this.getOrderedView('recorded_ desc').list(0,10).map(function(ob){ return ob.recorded_; });
[22:17] <midnightmonster> this code, otoh, produces the desired affect (but is presumably a good bit slower):
[22:17] <midnightmonster> this.list().sort(function(a,b){ return b.recorded_-a.recorded_; }).splice(0,10).map(function(ob){ return ob.recorded_; });
[22:22] <midnightmonster> note: I've replaced the live code with my workaround code, so the url above no longer shows the error. please don't let that stop you from helping! the Sermons by Title section is still working correctly using getOrderedView, though getOrderedView on recorded_ without the desc modifier also appeared to work (uselessly for my purposes). so looks like only ordering desc was broken
[22:25] <midnightmonster> just tried getORderedView('title desc')--it appears to work fine. it really looks like helma has cached the answer to .getOrderedView('recorded_ desc'), and is only updating it on object insertions or deletions, not updates. how to fix?
[22:35] <zumbrunn> what does hobj.invalidate() do in this context?
[22:36] <zumbrunn> if you call that after updating a hobj
[22:36] <zumbrunn> http://helma.zumbrunn.net/reference/HopObject.html#HopObject.invalidate
[22:36] <zumbrunn> (just as a workaround)
[22:42] <midnightmonster> I'll come back and try that in a bit. non-trivial to do, actually, since there were 17 objects that were updated
[22:45] <midnightmonster> does nothing
[22:45] <midnightmonster> (at least, calling it on only one of the out-of-order objects doesn't fix it)
[22:45] <midnightmonster> (doesn't fix that one, either)
[22:45] <zumbrunn> just so we are talking about the same thing...
[22:46] <zumbrunn> what happens when you flush the app in question using the manage app?
[22:46] <zumbrunn> or even restart it
[22:46] <midnightmonster> ah, but invalidating the hopobject whose children were out of order does fix it
[22:46] <zumbrunn> aha
[22:47] <midnightmonster> so, is that correct behavior and I should add this._parent.invalidate() to any objects update code?
[22:47] <midnightmonster> (bbl)
[22:47] <zumbrunn> I don't know for sure
[22:47] <zumbrunn> best to ask hannes on the mailing list
[22:48] <zumbrunn> or just file a bug

 

 

In the channel now:

Logs by date: