I am having huge issues with the parameters cause they are not being
sent to the function at all...
def insert_updatedb():
session.correct=request.vars.correct
session.numquest=request.vars.number
session.time_quest=request.vars.total_time
session.mgp=request.vars.mgp
.
.
.
On May 5, 8:37 pm, Resa <[email protected]> wrote:
> Correction:
> function MGP(correct)
> {
> var time_per_question=2; //2 second to
> answer one question
> var numBer={{=request.vars.number}}; // the
> number of questions in worksheet
> var bonus= (numBer<20)? 1: (numBer<40)? 3 :(numBer<60)? 7:
> (numBer<80)? 9: (numBer<100)? 11 :13 // calculate bonus
> var total_time=converttime();
> var mgp= (((correct/numBer)+(total_time/
> (numBer*time_per_question))+bonus));
> ajax('{{=URL('insert_updatedb')}}',
> ['numBer','mgp','total_time','correct'],'');
> }
>
> On May 5, 7:35 pm, pbreit <[email protected]> wrote:
>
> > This is pretty confusing code.
>
> > I'm not sure how these assignments are going to work:
> > {{=numBer}}=numBer
> > ...
>
> > Normally you have something like num={{=row.num}}
>
> > In the dict() it looks like you are assigning strings. Normally it would
> > look more like this dict(numBer=numBer,...)
>
> > You definitely don't want this: {{URL(... That's not going to do
> > anything.
>
> > Then you need something to trigger the Ajax call.
>
> > Review the Book:http://web2py.com/book/default/chapter/10#The-ajax-Function
>
> > I would suggest starting very simply, prove that it works and then add the
> > complexity.
>
>