[web2py] Re: How do I update only the last row of a db query?

2016-05-11 Thread Niphlod
record = db(db.loc_data.school_id == auth.user_id).select().last() record.update_record(end_time=request.utcnow+datetime.timedelta(0,19800)) or, REALLY better (for anyone listening, using first() and last() without a limitby and orderby is the FIRST thing to change in your app's code, performanc

[web2py] Re: How do I update only the last row of a db query?

2016-05-11 Thread Steve Joe
Thank you for pointing that out Niphlod. So how should I correct it? On Wednesday, May 11, 2016 at 5:37:43 PM UTC+5:30, Niphlod wrote: > > yep. you need to FILTER before APPLYing the update. it's rather easy to > spot the error because last() comes AFTER update(). > > On Wednesday, May 11, 2016 a

[web2py] Re: How do I update only the last row of a db query?

2016-05-11 Thread Niphlod
yep. you need to FILTER before APPLYing the update. it's rather easy to spot the error because last() comes AFTER update(). On Wednesday, May 11, 2016 at 1:15:45 PM UTC+2, Steve Joe wrote: > > db(db.loc_data.school_id == > auth.user_id).update(end_time=request.utcnow+datetime.timedelta(0,19800)