sandeepsingh738 / concerto-platform

Automatically exported from code.google.com/p/concerto-platform
0 stars 0 forks source link

Timeout for a question #26

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi,
I want to provide a timeout for a few questions, i.e., the candidate should 
answer the question within 15 seconds. After that time, the test should move 
forward to the next question.

I can't find any relevant documentation. Is the above possible in concerto ? If 
so, how ?

Regards,
Rama

Original issue reported on code.google.com by ramat...@gmail.com on 8 Oct 2012 at 10:56

GoogleCodeExporter commented 9 years ago
Set TIME_LIMIT variable in your test logic before showing the template. It 
indicates number of seconds after which template will be automatically 
submitted.

Original comment by LisPrzem...@gmail.com on 8 Oct 2012 at 10:58

GoogleCodeExporter commented 9 years ago
Ok, the the timeout works. But it doesn't go to the next question. Instead,
the R system crashes (see below). What additional logic I should build into
the test to handle a timeout?

R return code1
------------------------------
R code
sink(stdout(), type='message')
options(encoding='UTF-8')
library(session)
restore.session('/var/www/html/concerto/temp/1/session_55.Rs')

CONCERTO_DB_HOST <- 'localhost'
CONCERTO_DB_PORT <- as.numeric(3306)
CONCERTO_DB_LOGIN <- 'root'
[hidden]

CONCERTO_DRIVER <- dbDriver('MySQL')
for(CONCERTO_DB_CONNECTION in dbListConnections(CONCERTO_DRIVER)) {
dbDisconnect(CONCERTO_DB_CONNECTION) }
CONCERTO_DB_CONNECTION <- dbConnect(CONCERTO_DRIVER, user =
CONCERTO_DB_LOGIN, password = CONCERTO_DB_PASSWORD, dbname =
CONCERTO_DB_NAME, host = CONCERTO_DB_HOST, port = CONCERTO_DB_PORT)
dbSendQuery(CONCERTO_DB_CONNECTION,statement = "SET NAMES 'utf8';")
dbSendQuery(CONCERTO_DB_CONNECTION,statement = "SET time_zone='+0:00';")

rm(CONCERTO_DB_HOST)
rm(CONCERTO_DB_PORT)
rm(CONCERTO_DB_LOGIN)
rm(CONCERTO_DB_PASSWORD)

TIME_TAKEN <- '5'
TIME_TAKEN <<- convertVariable(TIME_TAKEN)

LAST_PRESSED_BUTTON_NAME <- 'NONE'
LAST_PRESSED_BUTTON_NAME <<- convertVariable(LAST_PRESSED_BUTTON_NAME)

CONCERTO_TEST_FLOW<-14
evalWithTimeout({
while(CONCERTO_TEST_FLOW > 0){
CONCERTO_TEST_FLOW <-
do.call(paste('CONCERTO_Test',CONCERTO_TEST_ID,'Section',CONCERTO_TEST_FLOW,sep=
''),list())
}
CONCERTO_FLOW_LOOP_FINISHED <- TRUE
},timeout=30,onTimeout='error')
if(CONCERTO_TEST_FLOW==-2) update.session.release(1)

save.session('/var/www/html/concerto/temp/1/session_55.Rs')
------------------------------
R outputLoading all data...
Loading packages...
Restoring search path...
Done.
<MySQLResult:(18795,0,0)>
<MySQLResult:(18795,0,1)>
[1] "Start of section with index: 14"
Error in value[[3L]](cond) : object 'radio1' not found
Calls: evalWithTimeout ... tryCatch -> tryCatchList -> tryCatchOne ->
<Anonymous>
Execution halted

Original comment by ramat...@gmail.com on 8 Oct 2012 at 11:07

GoogleCodeExporter commented 9 years ago
Error in value[[3L]](cond) : object 'radio1' not found 

You have to handle in your code situation when no radio buttons/checkboxes are 
checked ( their variable won't be created then ).

Original comment by LisPrzem...@gmail.com on 8 Oct 2012 at 11:09

GoogleCodeExporter commented 9 years ago
I have already put that logic. Pls see the screenshot below,

But it still crashes.

Original comment by ramat...@gmail.com on 8 Oct 2012 at 11:14

GoogleCodeExporter commented 9 years ago
Error in value[[3L]](cond) : object 'radio1' not found 

In your test logic in section #14 you try to do something with radio1 variable. 
It doesn't exist. You should first check if it exist ( exists("radio1") ) and 
then do whatever you want to do with it.

Original comment by LisPrzem...@gmail.com on 8 Oct 2012 at 11:16

GoogleCodeExporter commented 9 years ago
Works great.
Much thanks!

Original comment by ramat...@gmail.com on 8 Oct 2012 at 11:40