--- capa/capa51/pProj/capaCommon.c 2000/08/07 20:47:29 1.14 +++ capa/capa51/pProj/capaCommon.c 2001/12/21 20:25:40 1.20 @@ -48,6 +48,8 @@ int yyparse(); extern FILE *yyin; extern void yyrestart(); +extern FILE *dfp; + /*----------------------------------------------------------*/ /* RETURN: -1 file error */ /* 0 success */ @@ -1447,10 +1449,14 @@ void capa_get_due_date(char *date_str,T_ if ((duration > 0) && (student_number!=NULL)) { if (capa_get_login_time(student_number,set,&logintime)==1) { duetime=logintime+duration; - due_time_tm=localtime(&duetime); - sprintf(date_str,"%04d/%02d/%02d %02d:%02d",((due_time_tm->tm_year)+1900), - due_time_tm->tm_mon+1,due_time_tm->tm_mday,due_time_tm->tm_hour, - due_time_tm->tm_min); + if (compare_datetime(duetime,current->due_date)==-1) { + due_time_tm=localtime(&duetime); + sprintf(date_str,"%04d/%02d/%02d %02d:%02d",((due_time_tm->tm_year)+1900), + due_time_tm->tm_mon+1,due_time_tm->tm_mday,due_time_tm->tm_hour, + due_time_tm->tm_min); + } else { + strncpy(date_str,current->due_date,DATE_BUFFER); + } return; } } @@ -3017,10 +3023,10 @@ capa_check_ans(ai,ans, error) AnswerInfo for(idx=0;idx tol ) { outcome = INCORRECT; } } @@ -3367,8 +3377,15 @@ Problem_t *p; char **answers; int cnt; c outcomes = (int *)capa_malloc(sizeof(int),cnt); for(ii=0;iianswer,answers[0],outcomes[0]); +#endif for(ii=1, ai = p->ans_list; ai; ii++,ai = ai->ans_next ) { outcomes[ii] = capa_check_ans(ai,answers[ii],&(errormsg[ii])); +#ifdef COMMON_DBUG + printf("CAPA_CHECK_ANS(%s,%s): outcome[%d]=%d\n", ai->ans_str,answers[ii],ii,outcomes[ii]); +#endif } done = ii = 0; result = 0; @@ -3383,10 +3400,12 @@ Problem_t *p; char **answers; int cnt; c ii++; if(ii==cnt) done = 1; } - if( result == 0 ) { /* check if any of the outcome has failed to be a numeric */ + if( result == 0 ) { + /* check if any of the outcome has failed to be a numeric + or was a malformed equation */ done = ii = 0; while( !done ) { - if( outcomes[ii] == WANTED_NUMERIC ) { + if( outcomes[ii] == WANTED_NUMERIC || outcomes[ii] == BAD_FORMULA ) { result = outcomes[ii]; done = 1; } @@ -3394,7 +3413,7 @@ Problem_t *p; char **answers; int cnt; c if(ii==cnt) done = 1; } } - if( result == 0 ) { /* check if any of the outcome has failed on sig figs */ + if( result == 0 ) {/*check if any of the outcome has failed on sig figs*/ done = ii = 0; while( !done ) { if( outcomes[ii] == SIG_FAIL ) { @@ -3537,7 +3556,7 @@ char *key_word;char *value; } } if (c=='\n') found=1; - if (((char)c)==((char)EOF)) break; + if (((char)c)==((char)EOF)) {failed=1;break;} } } } while (!done && !failed);