--- capa/capa51/pProj/capaCgiUtils.c 1999/09/28 21:26:20 1.1.1.1 +++ capa/capa51/pProj/capaCgiUtils.c 2000/01/25 17:14:29 1.10 @@ -404,12 +404,9 @@ void w_get_responses(int x,int q_idx,cha sscanf(g_entries[x].name,"INPUT%d",&q_idx); if( q_idx > 0 && q_idx < MAX_PROBLEM_CNT ) { if ( ! is_all_ws(g_entries[x].val) ) { - leng = strlen(g_entries[x].val) + 1; g_stu_ans_pp[q_idx] = (StudentAnswer_t *)capa_malloc(sizeof(StudentAnswer_t),1); (g_stu_ans_pp[q_idx])->a_idx = 1; (g_stu_ans_pp[q_idx])->a_str = strsave(g_entries[x].val); - if (leng > ANSWER_STRING_LENG) - (g_stu_ans_pp[q_idx])->a_str[ANSWER_STRING_LENG] = '\0'; (g_stu_ans_pp[q_idx])->a_next = NULL; trim_response_ws((g_stu_ans_pp[q_idx])->a_str); } @@ -424,12 +421,11 @@ void w_get_responses(int x,int q_idx,cha if( q_idx > 0 && q_idx < MAX_PROBLEM_CNT ) { if ( ! is_all_ws(g_entries[x].val) ) { StudentAnswer_t *sa_p; - leng = strlen(g_entries[x].val) + 1; sa_p = (StudentAnswer_t *)capa_malloc(sizeof(StudentAnswer_t),1); sa_p->a_idx = sub_idx; sa_p->a_str = strsave(g_entries[x].val); - if (leng > ANSWER_STRING_LENG) sa_p->a_str[ANSWER_STRING_LENG] = '\0'; sa_p->a_next = NULL; + trim_response_ws(sa_p->a_str); if( g_stu_ans_pp[q_idx] == NULL ) { g_stu_ans_pp[q_idx] = sa_p; } else { @@ -451,22 +447,18 @@ void w_get_responses(int x,int q_idx,cha if( index(g_entries[x].name, ',' ) == NULL ) { /* only one answer */ sscanf(g_entries[x].name,"LAST%d",&q_idx); if( q_idx > 0 && q_idx < MAX_PROBLEM_CNT ) { - leng = strlen(g_entries[x].val) + 1; sa_p = (StudentAnswer_t *)capa_malloc(sizeof(StudentAnswer_t),1); sa_p->a_idx = 1; sa_p->a_str = strsave(g_entries[x].val); - if (leng > ANSWER_STRING_LENG) sa_p->a_str[ANSWER_STRING_LENG] = '\0'; sa_p->a_next = NULL; g_last_ans_pp[q_idx] = sa_p; } } else { sscanf(g_entries[x].name,"LAST%d,%d",&q_idx,&sub_idx); if( q_idx > 0 && q_idx < MAX_PROBLEM_CNT ) { - leng = strlen(g_entries[x].val) + 1; sa_p = (StudentAnswer_t *)capa_malloc(sizeof(StudentAnswer_t),1); sa_p->a_idx = sub_idx; sa_p->a_str = strsave(g_entries[x].val); - if (leng > ANSWER_STRING_LENG) sa_p->a_str[ANSWER_STRING_LENG] = '\0'; sa_p->a_next = NULL; if( g_last_ans_pp[q_idx] == NULL) { g_last_ans_pp[q_idx] = sa_p; @@ -1043,11 +1035,11 @@ print_mainmenu(class,sn,pin)char *class; fprintf(stdout,"\n"); } outcome = check_termscore_option(); - fprintf(stdout,"\n",outcome); + fprintf(stdout,"\n",outcome); /*Termscore Button*/ if( outcome ) { fprintf(stdout,"
Answer %d of %d:\n",ii+1,p->ans_cnt,q_idx+1,ii+1); + } else { + sprintf(buf,"
Answer %d of %d:\n",ii+1,p->ans_cnt,q_idx+1,ii+1);
+ }
+ append_qtext(buf);
+ for(ii=1, ai=p->ans_list;ii Answer %d of %d:\n",ii+1,p->ans_cnt,q_idx+1,ii+1);
} else {
sprintf(buf," Answer %d of %d:\n",ii+1,p->ans_cnt,q_idx+1,ii+1);
}
@@ -1872,7 +1888,9 @@ char buf[MAX_BUFFER_SIZE];
}
/* returns a -1 if there were not enough answers, otherwise the number of responses
- for the question is returned*/
+ for the question is returned
+ !!!!!AS A SIDEEFFECT IT ALSO CROPS ANSWERS TO ANSWER_STRING_LENG!!!!!!!
+*/
int gather_answers(char ***ans,int q_idx,Problem_t *p)
{
int cnt;
@@ -1882,6 +1900,7 @@ int gather_answers(char ***ans,int q_idx
sa_p= g_stu_ans_pp[q_idx+1];
for(i=0;((i
\n");
/* SHOW TOTALS */
/* if capalogin_show_summary_score is set to none don't show it */
- sprintf(buf,"%d sets, total = %3d/%3d (%d%%)\n", set, term_score, term_valid, 100*term_score/term_valid);
+ if (term_valid > 0) {
+ sprintf(buf,"%d sets, total = %3d/%3d (%d%%)\n", tot_num_sets, term_score, term_valid, 100*term_score/term_valid);
+ } else {
+ sprintf(buf,"%d sets, total = %3d/%3d\n", tot_num_sets, term_score, term_valid);
+ }
result=read_capa_config("capalogin_show_summary_score",buf2);
if (result != 0 && result != -1) {
if (strcasecmp(buf2,"none")==0) {
@@ -2369,27 +2404,28 @@ FILE *out;
i, /* Question counter */
set_score, /* Score on a set */
term_score=0, /* Total points received */
- term_valid=0, /* Total points possible */
- result;
+ term_valid=0; /* Total points possible */
T_entry entry; /* Database entry for a set */
char buf[MAX_BUFFER_SIZE]; /* Output line buffer */
- char buf2[MAX_BUFFER_SIZE]; /* Output line buffer */
T_header header; /* Problem set header */
- int question_cnt,valid_wgt, rate,configResult,
- status_line_length=DEFAULT_STATUS_LINE_LENGTH,row;
+ int question_cnt,valid_wgt,configResult;
char class_fullpath[ONE_K],*serverName;
int hw_c, hw_r, qz_c, qz_r, fs, homework_count, quiz_count;
- int ex_c, epc_c;
float hw_w, qz_w, ex_w, fe_w, pc_w;
int idx, entry_count, tmp_len;
float *S, *F;
- int *X;
- char *capa_server, *qz_p, *ex_p, *epc_p;
- int max_set[4];
+ int *X; /* array controlling whether to extrapolate scores */
+ char *capa_server;
+ int max_set[4], width=600,height=750; /* width and height of applet*/
char **c_path_pp;
-
-
-
+
+ /*Unused Vars
+ char buf2[MAX_BUFFER_SIZE];
+ char *qz_p, *ex_p, *epc_p;
+ int ex_c, epc_c, result;
+ int rate, status_line_length=DEFAULT_STATUS_LINE_LENGTH,row;
+ */
+
serverName=getenv("SERVER_NAME");
if (!serverName) {
fprintf(out,"Enviroment variable SERVER_NAME not set.\n");
@@ -2433,6 +2469,9 @@ FILE *out;
return;
}
+
+ get_tscore_width_height(&width,&height);
+
c_path_pp = (char **)capa_malloc( 4, sizeof(char *));
tmp_len = strlen(class_fullpath) + 1;
c_path_pp[0] = (char *)capa_malloc(tmp_len,sizeof(char));
@@ -2473,12 +2512,14 @@ FILE *out;
c_path_pp[2] = (char *)capa_malloc( (tmp_len),sizeof(char));
sprintf(c_path_pp[2],"%s",buf);
max_set[2] = check_class_get_maxset(c_path_pp[2]);
+ printf("\n",c_path_pp[2],max_set[2]);
if( max_set[2] <= 0 ) {
- /* should we continue ? */
- max_set[2] = 0;
- for(idx=2;idx <= (fs*2); idx++) {
+ /* no sets */
+ max_set[2] = 0;
+ }
+ /* start extrapolation with sets that don't yet exist */
+ for(idx=2+(max_set[2]*2);idx <= (fs*2); idx++) {
X[idx] = 1;
- }
}
} else { /* if exam_path is not in capa.config, then skip exams */
fs = 0;
@@ -2525,15 +2566,24 @@ FILE *out;
term_score += set_score;
capa_mfree(header.weight);
capa_mfree(header.partial_credit);
+ printf("\n",c_path_pp[idx],set_score,valid_wgt);
if(idx==2) { /* exam sets */
S[set_idx*2] = (float)set_score;
F[set_idx*2] = (float)valid_wgt;
- X[set_idx*2] = 0;
+ if (valid_wgt == 0) {
+ X[set_idx*2] = 1;
+ } else {
+ X[set_idx*2] = 0;
+ }
}
if(idx==3) { /* correction sets */
S[set_idx*2+1] = (float)set_score;
F[set_idx*2+1] = (float)valid_wgt;
- X[set_idx*2+1] = 0;
+ if (valid_wgt == 0 ) {
+ X[set_idx*2+1] = 1;
+ } else {
+ X[set_idx*2+1] = 0;
+ }
}
}
if( (idx == 0) || (idx==1) ) { /* homeworks and quizzes */
@@ -2548,7 +2598,7 @@ FILE *out;
fprintf(out,"