Salve sto realizzando un sito di e-elearnig nel quale l'utente fa un quiz con domande a risposta multipla. Tutto funziona a meraviglia, (preciso che ho realizzato il tutto con dreamweaver Mx e l'estensione Course Bulider + learning site) il "sistema" scive le rispote sul Db appositamente creato e fornisce anche una percentuale delle riposte corrette. Il problema è che se l'utente prova a rifare il test, il sistema funziona in tutto tranne per il fatto che non aggiorna più la percentuale o per lo meno lo fa per i primi 2 test e poi basta, se provo con un nuovo utente lo fa per 3 volte o per una, proprio non capisco. Dalle pagine generate dall'estensione, le due che credo "collaboriono" passandosi i dati sono le due di cui posto il codice sotto, per favore un aiuto su ciò che devo modificare.
Grazie 10000![]()
--------------------------------------------------------------
pagina tracking asp:
<%@LANGUAGE="VBSCRIPT" %>
<%Response.Buffer = true %>
<html>
<head>
<title>Tracking</title>
</head>
<body bgcolor="#FFFFFF">
<form name="form1" method="post" action="">
<input type="hidden" name="session_id">
<input type="hidden" name="Date">
<input type="hidden" name="aicc_data">
</form>
<%' Get the UserID and ActivityID from the Session_IDs Table
SQLString = "SELECT Session_IDs.UserID, Session_IDs.ActivityID FROM Session_IDs WHERE Session_IDs.SessionID=" & request.form("session_id") & ";"
set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_LearningSite_STRING
Recordset1.Source = SQLString
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 3
Recordset1.Open
Recordset1_numRows = 0
' assign values to variables
UserIDVar = Recordset1.Fields.Item("UserID").Value
ActivityIDVar = Recordset1.Fields.Item("ActivityID").Value%>
<%' --------------------------------------------------------
if request.form("command") = "initialize" then
' clear out status table
' clear out details table
end if%>
<%' Here is where the different commands are processed.
' --------------------------------------------------------
if request.form("command") = "putinteractions" then
'Get aicc data that CourseBuilder based objects are sending
ReceivedString = request.form("aicc_data")
' get the second return delimited block of data
if (InStr(ReceivedString, Chr(13)&Chr(10)) = 0) then
ReceivedString = replace(ReceivedString, "latency""", "latency"""&Chr(13)&Chr(10))
end if
ReceivedDataTemp = Split(ReceivedString, Chr(13)&Chr(10))
ReceivedData = ReceivedDataTemp(1)
'remove the quotes from the Data
ReceivedData = replace(ReceivedData, """", "")
' make the data into an array for easier reference
ReceivedData = Split(ReceivedData)
' clean up each position - take out the extra commas
for index = 0 to UBound(ReceivedData)
if Right(ReceivedData(index), 1) = "," then
ReceivedData(index) = Left(ReceivedData(index), Len(ReceivedData(index))-1)
end if
next
'Build SQLString based on that data
SQLString = "INSERT INTO Activity_Detail (ActivityID, UserID, Question, UserResponse, Result, QuestionTime, QuestionDate, TypeInteraction, CorrectResponse, ResponseValue, Weight, Latency, ObjectiveID) Values ( '" & ActivityIDVar & "', '" & UserIDVar & "','" & ReceivedData(2) & "', '" & ReceivedData(6) & "', '" & ReceivedData(7) & "', '" & ReceivedData(1) & "', '" & ReceivedData(0) & "', '" & ReceivedData(4) & "', '" & ReceivedData(5) & "', '" & "" & "', '" & ReceivedData(8) & "', '" & ReceivedData(9) & "', '" & ReceivedData(3) & "');"
'Write SQLString into database
set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_LearningSite_STRING
Recordset1.Source = SQLString
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 3
Recordset1.Open
Recordset1_numRows = 0
end if%>
<%' --------------------------------------------------------
if request.form("command") = "putparam" then
' hold data as it is coming in
receivedString = request.form("aicc_data")
'response.write(receivedString)
' make the data into an array for easier reference
receivedData = Split(receivedString, Chr(13)&Chr(10))
' repeat for each position of the array
For i = LBound(receivedData) to UBound(receivedData)
' get each line one at a time
dataString = receivedData(i)
' find positions of the = divider for each line
index = Instr(dataString, "=")
index2 = Len(dataString) - index
' separate the label and the content
dataStringLabel = Left(dataString, index)
dataStringContent = Right(dataString, index2)
if index > 0 then
' Check for what type of content we have on this line
' ------------------
if InStr(dataStringLabel,"Lesson_Status=") then
' do lesson Status stuff
SQLString = "UPDATE Activity_Status SET Activity_Status.Status = '" & dataStringContent & "' WHERE Activity_Status.ActivityID = '" & ActivityIDVar & "' AND Activity_Status.UserID = '" & UserIDVar & "';"
end if
' ------------------
if InStr(dataStringLabel,"score=") then
' do Score stuff
' get score content from database
SQLString = "SELECT Score FROM Activity_Status WHERE Activity_Status.ActivityID = '" & ActivityIDVar & "' AND Activity_Status.UserID = '" & UserIDVar & "';"
set dbGetScore = Server.CreateObject("ADODB.Recordset")
dbGetScore.ActiveConnection = MM_LearningSite_STRING
dbGetScore.Source = SQLString
dbGetScore.CursorType = 0
dbGetScore.CursorLocation = 2
dbGetScore.LockType = 3
dbGetScore.Open
dbGetScore_numRows = 0
end if
' ------------------
if InStr(dataStringLabel,"Time=") then
' do lesson Time stuff
' break received data into an array receivedTime
if Instr(dataStringContent, ":") > 0 then
receivedTime = Split(dataStringContent, ":")
receivedTime(0) = Int(receivedTime(0))
receivedTime(1) = Int(receivedTime(1))
receivedTime(2) = Int(receivedTime(2))
else
receivedTime(0) = 0
receivedTime(1) = 0
receivedTime(2) = 0
end if
' get time content from database
SQLString = "SELECT TotalTime FROM Activity_Status WHERE Activity_Status.ActivityID = '" & ActivityIDVar & "' AND Activity_Status.UserID = '" & UserIDVar & "';"
set dbGetTime = Server.CreateObject("ADODB.Recordset")
dbGetTime.ActiveConnection = MM_LearningSite_STRING
dbGetTime.Source = SQLString
dbGetTime.CursorType = 0
dbGetTime.CursorLocation = 2
dbGetTime.LockType = 3
dbGetTime.Open
dbGetTime_numRows = 0
if Instr(dbGetTime.Fields.Item("TotalTime").Value, ":") > 0 then
' break database content into an array dbTime
dbTime = Split( dbGetTime.Fields.Item("TotalTime").Value, ":")
dbTime(0) = Int(dbTime(0))
dbTime(1) = Int(dbTime(1))
dbTime(2) = Int(dbTime(2))
else
receivedTime(0) = 0
receivedTime(1) = 0
receivedTime(2) = 0
end if
' add seconds
totalTimeSecs = receivedTime(2) + dbTime(2)
' if total is over 60, add (total/60) to minutes, and keep remainder(total - what we add to minutes) as seconds
if totalTimeSecs > 60 then
totalTimeMins = Int(totalTimeSecs/60)
totalTimeSecs = totalTimeSecs - (Int(totalTimeSecs/60)*60)
end if
' add minutes
totalTimeMins = totalTimeMins + receivedTime(1) + dbTime(1)
' if total is over 60, add Int(total/60) to hours, and keep remainder( total - Int(total/60) ) as minutes
if totalTimeMins > 60 then
totalTimeHours = Int(totalTimeMins/60)
totalTimeMins = totalTimeMins - (Int(totalTimeMins/60)*60)
end if
' add hours
totalTimeHours = totalTimeHours + receivedTime(0) + dbTime(0)
' adjust for 2 zeros
if totalTimeHours < 10 then totalTimeHours = "0" & totalTimeHours
if totalTimeMins < 10 then totalTimeMins = "0" & totalTimeMins
if totalTimeSecs < 10 then totalTimeSecs = "0" & totalTimeSecs
SQLString = "UPDATE Activity_Status SET Activity_Status.TotalTime = '" & totalTimeHours & ":" & totalTimeMins & ":" & totalTimeSecs & "' WHERE Activity_Status.ActivityID = '" & ActivityIDVar & "' AND Activity_Status.UserID = '" & UserIDVar & "';"
end if
' ------------------
if InStr(dataStringLabel,"Lesson_Location=") then
' do Location stuff
SQLString = "UPDATE Activity_Status SET Activity_Status.Location = '" & dataStringContent & "' WHERE Activity_Status.ActivityID = '" & ActivityIDVar & "' AND Activity_Status.UserID = '" & UserIDVar & "';"
end if
' ------------------
end if
if SQLString <> "" then
' execute SQLString
Set MM_insertCmd = Server.CreateObject("ADODB.Command")
MM_insertCmd.ActiveConnection = MM_LearningSite_STRING
MM_insertCmd.CommandText = SQLString
MM_insertCmd.Execute
end if
Next
end if
%>
<%'--------------------------------------------------------------------
if request.form("command") = "getparam" then
end if %>
</body>
</html>
siccome non ci entra tutto l'altra pagina la posto su un altro 3d dal titolo: problemi con dati non aggiornati parte 2