Try:

#!/usr/bin/python
# -*- coding: utf-8 -*-
rows = db(db.urlop.id > 0).select(db.urlop.ilosc_dni,db.termin_od,
db.termin_do)
howmany = len(rows)
busy_with = 0
for row in rows:
     busywith += 1
     print 'busy with %d of %d' % (busywith, howmany)




On 19 June 2014 18:29, Tomasz Sokołowski <orbitalny...@gmail.com> wrote:

> Hello
>
> Recently I have upgraded the function dni_urlopu() which is used in a
> computed field in the table "urlop".
> How can I recompute/refresh all instances of already existing records
> which where not properly compute
> because of error in previous version of function "dni_urlopu()"
>
> Best regards,
> Tomek
>
>
> def dni_urlopu(termin_od, termin_do):
>     return workdays.networkdays(termin_od, termin_do,
> [datetime.date(year=2014,month=01,day=01),
>
> datetime.date(year=2014,month=01,day=06),
>
> datetime.date(year=2014,month=04,day=21),
>
> datetime.date(year=2014,month=05,day=01),
>
> datetime.date(year=2014,month=06,day=19),
>
> datetime.date(year=2014,month=07,day=15),
>
> datetime.date(year=2014,month=11,day=11),
>
> datetime.date(year=2014,month=12,day=25),
>
> datetime.date(year=2014,month=12,day=26)])
>
> db.define_table('urlop',
>     Field('user_id', db.auth_user, default=auth.user_id, writable=True,
> label='Pracownik' ),
>     Field('urlop_typ', 'string',  requires=IS_IN_SET(URLOP_SET),
> label='Rodzaj urlopu'),
>     Field('termin_od', 'date', label='Termin od'),
>     Field('termin_do', 'date', label='Termin do'),
>     Field('ilosc_dni', compute=lambda r: dni_urlopu(r['termin_od'],
> r['termin_do']), label='Ilość dni'),
>     Field('uzasadnienie_urlop', 'text', label='Uzasadnienie'),
>     Field('status', requires=IS_IN_SET(STATUS_SET), default=STATUS_SET[0],
> label='Status'),
>     auth.signature)
>
>
>  --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Because experiencing your loyal love is better than life itself,
my lips will praise you.  (Psalm 63:3)

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to