version 1.4, 1999/11/08 22:30:02
|
version 1.7, 1999/12/03 18:39:38
|
Line 404 void w_get_responses(int x,int q_idx,cha
|
Line 404 void w_get_responses(int x,int q_idx,cha
|
sscanf(g_entries[x].name,"INPUT%d",&q_idx); |
sscanf(g_entries[x].name,"INPUT%d",&q_idx); |
if( q_idx > 0 && q_idx < MAX_PROBLEM_CNT ) { |
if( q_idx > 0 && q_idx < MAX_PROBLEM_CNT ) { |
if ( ! is_all_ws(g_entries[x].val) ) { |
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] = (StudentAnswer_t *)capa_malloc(sizeof(StudentAnswer_t),1); |
(g_stu_ans_pp[q_idx])->a_idx = 1; |
(g_stu_ans_pp[q_idx])->a_idx = 1; |
(g_stu_ans_pp[q_idx])->a_str = strsave(g_entries[x].val); |
(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; |
(g_stu_ans_pp[q_idx])->a_next = NULL; |
trim_response_ws((g_stu_ans_pp[q_idx])->a_str); |
trim_response_ws((g_stu_ans_pp[q_idx])->a_str); |
} |
} |
Line 424 void w_get_responses(int x,int q_idx,cha
|
Line 421 void w_get_responses(int x,int q_idx,cha
|
if( q_idx > 0 && q_idx < MAX_PROBLEM_CNT ) { |
if( q_idx > 0 && q_idx < MAX_PROBLEM_CNT ) { |
if ( ! is_all_ws(g_entries[x].val) ) { |
if ( ! is_all_ws(g_entries[x].val) ) { |
StudentAnswer_t *sa_p; |
StudentAnswer_t *sa_p; |
leng = strlen(g_entries[x].val) + 1; |
|
sa_p = (StudentAnswer_t *)capa_malloc(sizeof(StudentAnswer_t),1); |
sa_p = (StudentAnswer_t *)capa_malloc(sizeof(StudentAnswer_t),1); |
sa_p->a_idx = sub_idx; |
sa_p->a_idx = sub_idx; |
sa_p->a_str = strsave(g_entries[x].val); |
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; |
sa_p->a_next = NULL; |
if( g_stu_ans_pp[q_idx] == NULL ) { |
if( g_stu_ans_pp[q_idx] == NULL ) { |
g_stu_ans_pp[q_idx] = sa_p; |
g_stu_ans_pp[q_idx] = sa_p; |
Line 451 void w_get_responses(int x,int q_idx,cha
|
Line 446 void w_get_responses(int x,int q_idx,cha
|
if( index(g_entries[x].name, ',' ) == NULL ) { /* only one answer */ |
if( index(g_entries[x].name, ',' ) == NULL ) { /* only one answer */ |
sscanf(g_entries[x].name,"LAST%d",&q_idx); |
sscanf(g_entries[x].name,"LAST%d",&q_idx); |
if( q_idx > 0 && q_idx < MAX_PROBLEM_CNT ) { |
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 = (StudentAnswer_t *)capa_malloc(sizeof(StudentAnswer_t),1); |
sa_p->a_idx = 1; |
sa_p->a_idx = 1; |
sa_p->a_str = strsave(g_entries[x].val); |
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; |
sa_p->a_next = NULL; |
g_last_ans_pp[q_idx] = sa_p; |
g_last_ans_pp[q_idx] = sa_p; |
} |
} |
} else { |
} else { |
sscanf(g_entries[x].name,"LAST%d,%d",&q_idx,&sub_idx); |
sscanf(g_entries[x].name,"LAST%d,%d",&q_idx,&sub_idx); |
if( q_idx > 0 && q_idx < MAX_PROBLEM_CNT ) { |
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 = (StudentAnswer_t *)capa_malloc(sizeof(StudentAnswer_t),1); |
sa_p->a_idx = sub_idx; |
sa_p->a_idx = sub_idx; |
sa_p->a_str = strsave(g_entries[x].val); |
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; |
sa_p->a_next = NULL; |
if( g_last_ans_pp[q_idx] == NULL) { |
if( g_last_ans_pp[q_idx] == NULL) { |
g_last_ans_pp[q_idx] = sa_p; |
g_last_ans_pp[q_idx] = sa_p; |
Line 1043 print_mainmenu(class,sn,pin)char *class;
|
Line 1034 print_mainmenu(class,sn,pin)char *class;
|
fprintf(stdout,"<input type=\"submit\" value=\"Display Quiz summary\" ></form>\n"); |
fprintf(stdout,"<input type=\"submit\" value=\"Display Quiz summary\" ></form>\n"); |
} |
} |
outcome = check_termscore_option(); |
outcome = check_termscore_option(); |
fprintf(stdout,"<!-- Outcome of check_termscore_option()=%d --!>\n",outcome); |
fprintf(stdout,"<!-- Outcome of check_termscore_option()=%d -->\n",outcome); |
/*Termscore Button*/ |
/*Termscore Button*/ |
if( outcome ) { |
if( outcome ) { |
fprintf(stdout,"<li><form method=\"post\" "); |
fprintf(stdout,"<li><form method=\"post\" "); |
sprintf(buf,"action=\"http://%s/%s/capahtml\">",serverName,g_cgibin_path); |
sprintf(buf,"action=\"http://%s/%s/%s/capasbin\">",serverName,g_cgibin_path,g_cowner); |
fprintf(stdout,"%s\n", buf); |
fprintf(stdout,"%s\n", buf); |
fprintf(stdout,"<input type=\"hidden\" name=\"CLASS\" value=\"%s\">\n",class); |
fprintf(stdout,"<input type=\"hidden\" name=\"CLASS\" value=\"%s\">\n",class); |
fprintf(stdout,"<input type=\"hidden\" name=\"SNUM\" value=\"%s\">\n",sn); |
fprintf(stdout,"<input type=\"hidden\" name=\"SNUM\" value=\"%s\">\n",sn); |
Line 1895 char buf[MAX_BUFFER_SIZE];
|
Line 1886 char buf[MAX_BUFFER_SIZE];
|
} |
} |
|
|
/* returns a -1 if there were not enough answers, otherwise the number of responses |
/* 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 gather_answers(char ***ans,int q_idx,Problem_t *p) |
{ |
{ |
int cnt; |
int cnt; |
Line 1905 int gather_answers(char ***ans,int q_idx
|
Line 1898 int gather_answers(char ***ans,int q_idx
|
sa_p= g_stu_ans_pp[q_idx+1]; |
sa_p= g_stu_ans_pp[q_idx+1]; |
for(i=0;((i<p->ans_cnt)&&(sa_p));i++){ |
for(i=0;((i<p->ans_cnt)&&(sa_p));i++){ |
ans[0][i]=sa_p->a_str; |
ans[0][i]=sa_p->a_str; |
|
if ((strlen(ans[0][i])+1) > ANSWER_STRING_LENG) ans[0][i][ANSWER_STRING_LENG]='\0'; |
sa_p=sa_p->a_next; |
sa_p=sa_p->a_next; |
} |
} |
cnt=p->ans_cnt; |
cnt=p->ans_cnt; |
Line 1912 int gather_answers(char ***ans,int q_idx
|
Line 1906 int gather_answers(char ***ans,int q_idx
|
} else { |
} else { |
*ans=(char**)capa_malloc(p->ans_cnt,1); |
*ans=(char**)capa_malloc(p->ans_cnt,1); |
ans[0][0]=g_stu_ans_pp[q_idx+1]->a_str; |
ans[0][0]=g_stu_ans_pp[q_idx+1]->a_str; |
|
if ((strlen(ans[0][0])+1) > ANSWER_STRING_LENG) ans[0][0][ANSWER_STRING_LENG]='\0'; |
cnt=1; |
cnt=1; |
} |
} |
return cnt; |
return cnt; |
Line 2002 int tries;
|
Line 1997 int tries;
|
submit_subjective(q_idx,p); |
submit_subjective(q_idx,p); |
return; |
return; |
} |
} |
|
|
cnt=gather_answers(&ans,q_idx,p); |
cnt=gather_answers(&ans,q_idx,p); |
if (cnt == -1) { |
if (cnt == -1) { |
g_tried[q_idx]--; |
g_tried[q_idx]--; |
Line 2416 FILE *out;
|
Line 2411 FILE *out;
|
float hw_w, qz_w, ex_w, fe_w, pc_w; |
float hw_w, qz_w, ex_w, fe_w, pc_w; |
int idx, entry_count, tmp_len; |
int idx, entry_count, tmp_len; |
float *S, *F; |
float *S, *F; |
int *X; |
int *X; /* array controlling whether to extrapolate scores */ |
char *capa_server; |
char *capa_server; |
int max_set[4]; |
int max_set[4], width=600,height=750; /* width and height of applet*/ |
char **c_path_pp; |
char **c_path_pp; |
|
|
/*Unused Vars |
/*Unused Vars |
Line 2471 FILE *out;
|
Line 2466 FILE *out;
|
|
|
return; |
return; |
} |
} |
|
|
|
get_tscore_width_height(&width,&height); |
|
|
c_path_pp = (char **)capa_malloc( 4, sizeof(char *)); |
c_path_pp = (char **)capa_malloc( 4, sizeof(char *)); |
tmp_len = strlen(class_fullpath) + 1; |
tmp_len = strlen(class_fullpath) + 1; |
c_path_pp[0] = (char *)capa_malloc(tmp_len,sizeof(char)); |
c_path_pp[0] = (char *)capa_malloc(tmp_len,sizeof(char)); |
Line 2511 FILE *out;
|
Line 2509 FILE *out;
|
c_path_pp[2] = (char *)capa_malloc( (tmp_len),sizeof(char)); |
c_path_pp[2] = (char *)capa_malloc( (tmp_len),sizeof(char)); |
sprintf(c_path_pp[2],"%s",buf); |
sprintf(c_path_pp[2],"%s",buf); |
max_set[2] = check_class_get_maxset(c_path_pp[2]); |
max_set[2] = check_class_get_maxset(c_path_pp[2]); |
|
printf("<!-- for %s max_set %d -->\n",c_path_pp[2],max_set[2]); |
if( max_set[2] <= 0 ) { |
if( max_set[2] <= 0 ) { |
/* should we continue ? */ |
/* no sets */ |
max_set[2] = 0; |
max_set[2] = 0; |
for(idx=2;idx <= (fs*2); idx++) { |
} |
|
/* start extrapolation with sets that don't yet exist */ |
|
for(idx=2+(max_set[2]*2);idx <= (fs*2); idx++) { |
X[idx] = 1; |
X[idx] = 1; |
} |
|
} |
} |
} else { /* if exam_path is not in capa.config, then skip exams */ |
} else { /* if exam_path is not in capa.config, then skip exams */ |
fs = 0; |
fs = 0; |
Line 2563 FILE *out;
|
Line 2563 FILE *out;
|
term_score += set_score; |
term_score += set_score; |
capa_mfree(header.weight); |
capa_mfree(header.weight); |
capa_mfree(header.partial_credit); |
capa_mfree(header.partial_credit); |
|
printf("<!-- %s %d %d -->\n",c_path_pp[idx],set_score,valid_wgt); |
if(idx==2) { /* exam sets */ |
if(idx==2) { /* exam sets */ |
S[set_idx*2] = (float)set_score; |
S[set_idx*2] = (float)set_score; |
F[set_idx*2] = (float)valid_wgt; |
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 */ |
if(idx==3) { /* correction sets */ |
S[set_idx*2+1] = (float)set_score; |
S[set_idx*2+1] = (float)set_score; |
F[set_idx*2+1] = (float)valid_wgt; |
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 */ |
if( (idx == 0) || (idx==1) ) { /* homeworks and quizzes */ |
Line 2586 FILE *out;
|
Line 2595 FILE *out;
|
|
|
|
|
fprintf(out,"<CENTER>\n"); |
fprintf(out,"<CENTER>\n"); |
fprintf(out,"<APPLET CODE=TScore.class CODEBASE=\"http://%s\" width=600 height=750>\n",capa_server); |
fprintf(out,"<APPLET CODE=TScore.class CODEBASE=\"http://%s\" width=%d height=%d>\n",capa_server,width,height); |
fprintf(out,"<PARAM NAME=\"HW_W\" VALUE=\"%f\">\n", hw_w); |
fprintf(out,"<PARAM NAME=\"HW_W\" VALUE=\"%f\">\n", hw_w); |
fprintf(out,"<PARAM NAME=\"QZ_W\" VALUE=\"%f\">\n", qz_w); |
fprintf(out,"<PARAM NAME=\"QZ_W\" VALUE=\"%f\">\n", qz_w); |
fprintf(out,"<PARAM NAME=\"EX_W\" VALUE=\"%f\">\n", ex_w); |
fprintf(out,"<PARAM NAME=\"EX_W\" VALUE=\"%f\">\n", ex_w); |
Line 2630 FILE *out;
|
Line 2639 FILE *out;
|
capa_mfree((char *)capa_server); |
capa_mfree((char *)capa_server); |
} |
} |
|
|
|
int |
|
get_tscore_width_height(width,height) |
|
int *width;int *height; |
|
{ |
|
char buf[MAX_BUFFER_SIZE]; |
|
int configResult; |
|
|
|
configResult=read_capa_config("tscore_width",buf); |
|
if (configResult != 0 && configResult != -1 ) { |
|
sscanf(buf,"%d", width); |
|
if (*width <= 0 ) { *width = DEFAULT_WIDTH; } |
|
} else { |
|
printf("<!-- tscore_width not found. %d-->\n",configResult); |
|
} |
|
configResult=read_capa_config("tscore_height",buf); |
|
if (configResult != 0 && configResult != -1 ) { |
|
sscanf(buf,"%d", height); |
|
if (*height <= 0 ) { *height = DEFAULT_HEIGHT; } |
|
} else { |
|
printf("<!-- tscore_height not found. %d-->\n",configResult); |
|
} |
|
} |
|
|
int |
int |
get_termscore_params(hw,qw,ew,fw,pw,hc,qc,fs) |
get_termscore_params(hw,qw,ew,fw,pw,hc,qc,fs) |