On Thursday, July 26, 2012 5:41:40 PM UTC+2, viniciusban wrote:
>
> Some suggestions, but I've not tested any of them: 
>
> 1) Use timedelta(days=int(db.userCard.stage)) to convert your Field to 
> int. 
>

The typecast brings the following exception:
<type 'exceptions.TypeError'> int() argument must be a string or a number, 
not 'Field'I think the problem is, that in this case it is not the 
particalur db.userCard.stage selected which correspond to itself in 
db.userCard.lastTimeLearned. Could that be?
 

>
> 2) Split your query in 2 parts. The 2nd should use find() or exclude(). 
>

I'll try that after reading the qeb2py manual.
 

>
> 3) Use db.executesql() to insert your SQL statement. 
>

I haven't heard about this opportunity. I'll look it up

Thank you!
 

>
>
> -- 
> Vinicius Assef 
>
>
>
> On 07/26/2012 12:23 PM, jw wrote: 
> > Ok guys... I did step for step and now the query works for the stage 
> > (progress). 
> > The second thing (stage is multiplicator for time) I have no glue how to 
> > move on. 
> > 
> > cards2learn = db((db.groupCards.card_id == db.card.id) \ 
> >          & (db.groupCards.studyGroup_id == auth.user.studyGroup_id) \ 
> >          & (session.chosenSubject_id == db.card.subject_id) \ 
> >          & (db.userCard.card_id == db.card.id) 
> >          & (db.userCard.stage <= 5) \ 
> >          & (db.userCard.lastTimeLearned < (date.today() - 
> > timedelta(days=(1)))) 
> >          ).select(db.userCard.ALL,db.card.ALL,db.groupCards.ALL, 
> > left=db.userCard.on((db.userCard.card_id == db.card.id))) 
> > 
> > timedelta(days=(1)) should be timedelta(days=(db.userCard.stage)) but it 
> > says: 
> > 
> > 
> >         <type 'exceptions.TypeError'> unsupported type for timedelta 
> >         days component: Field 
> > 
> > 
> > How do I use the db.userCard.stage in timedelta (stage is an integer 
> > field in the table)? 
> > 
> > Many thanks for the previous answers! 
> > 
> > -- 
> > 
> > 
> > 
>
>

-- 



Reply via email to