Visualizzazione dei risultati da 1 a 9 su 9
  1. #1
    Utente di HTML.it
    Registrato dal
    Mar 2003
    Messaggi
    140

    problemi di dati non aggiornati 1

    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

  2. #2
    Utente di HTML.it
    Registrato dal
    Mar 2003
    Messaggi
    140

    problemi di dati non aggiornati 2 (leggere prima la parte 1)

    questa è la seconda parte del messaggio leggere prima la parte 1 (nel precedente 3d non ci entrava.....)


    --------------------------------------------------------------------
    pagina results.asp
    ---------------------------------------------------------------------

    <%@LANGUAGE="VBSCRIPT"%>

    <%
    Dim sessionInfo__MMColParam
    sessionInfo__MMColParam = "0"
    if (Request.QueryString("aicc_sid") <> "") then sessionInfo__MMColParam = Request.QueryString("aicc_sid")
    %>
    <%
    set sessionInfo = Server.CreateObject("ADODB.Recordset")
    sessionInfo.ActiveConnection = MM_LearningSite_STRING
    sessionInfo.Source = "SELECT UserID, ActivityID FROM Session_IDs WHERE SessionID = " + Replace(sessionInfo__MMColParam, "'", "''") + ""
    sessionInfo.CursorType = 0
    sessionInfo.CursorLocation = 2
    sessionInfo.LockType = 3
    sessionInfo.Open()
    sessionInfo_numRows = 0
    %>
    <% UserID = (sessionInfo.Fields.Item("UserID").Value)
    ActivityID = (sessionInfo.Fields.Item("ActivityID").Value)
    %>
    <%
    set UserInfo = Server.CreateObject("ADODB.Recordset")
    UserInfo.ActiveConnection = MM_LearningSite_STRING
    UserInfo.Source = "SELECT * FROM Student_Data WHERE UserID = '" + (sessionInfo.Fields.Item("UserID").Value) + "';"
    UserInfo.CursorType = 0
    UserInfo.CursorLocation = 2
    UserInfo.LockType = 3
    UserInfo.Open()
    UserInfo_numRows = 0
    %>
    <%
    set ActivityInfo = Server.CreateObject("ADODB.Recordset")
    ActivityInfo.ActiveConnection = MM_LearningSite_STRING
    ActivityInfo.Source = "SELECT * FROM Activities WHERE ActivityID = '" + (sessionInfo.Fields.Item("ActivityID").Value) + "'"
    ActivityInfo.CursorType = 0
    ActivityInfo.CursorLocation = 2
    ActivityInfo.LockType = 3
    ActivityInfo.Open()
    ActivityInfo_numRows = 0
    %>
    <%
    set ActivityStatus = Server.CreateObject("ADODB.Recordset")
    ActivityStatus.ActiveConnection = MM_LearningSite_STRING
    ActivityStatus.Source = "SELECT * FROM Activity_Status WHERE ActivityID = '" + (sessionInfo.Fields.Item("ActivityID").Value) + "' AND UserID = '" + (sessionInfo.Fields.Item("UserID").Value) + "';"
    ActivityStatus.CursorType = 0
    ActivityStatus.CursorLocation = 2
    ActivityStatus.LockType = 3
    ActivityStatus.Open()
    ActivityStatus_numRows = 0
    %>
    <%
    set ActivityDetail = Server.CreateObject("ADODB.Recordset")
    ActivityDetail.ActiveConnection = MM_LearningSite_STRING
    ActivityDetail.Source = "SELECT * FROM Activity_Detail WHERE ActivityID = '" + (sessionInfo.Fields.Item("ActivityID").Value) + "' AND UserID = '" + (sessionInfo.Fields.Item("UserID").Value) + "';"
    ActivityDetail.CursorType = 0
    ActivityDetail.CursorLocation = 2
    ActivityDetail.LockType = 3
    ActivityDetail.Open()
    ActivityDetail_numRows = 0
    %>
    <%
    Dim Repeat1__numRows
    Repeat1__numRows = -1
    Dim Repeat1__index
    Repeat1__index = 0
    ActivityDetail_numRows = ActivityDetail_numRows + Repeat1__numRows
    %>
    <script language=JavaScript RUNAT=SERVER>
    function URLDecode(encString){
    var repPlus = /\+/g;
    return unescape(String(encString).replace(repPlus, " "));
    }
    </script>
    <html>
    <head>
    <title>Student Summary</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>
    <body bgcolor="#FFFFFF">
    <table width="100%" border="0" align="center">
    <tr valign="top">
    <td colspan="4">
    <table width="100%" border="0">
    <tr>
    <td rowspan="5" valign="top" name="results">[img]images/results.gif[/img]</td>
    <td><font face="Arial, Helvetica, sans-serif" size="+1"><%=(UserInfo.Fields.Item("FirstName").Value)%>&nbs p<%=(UserInfo.Fields.Item("MiddleName").Value)%><% =(UserInfo.Fields.Item("LastName").Value)%></font></td>
    </tr>
    <tr>
    <td><font face="Arial, Helvetica, sans-serif"><%=URLDecode(ActivityInfo.Fields.Item("ActivityNam e").Value)%></font></td>
    </tr>
    <tr>
    <td><font face="Arial, Helvetica, sans-serif">Total Score: <%=(ActivityStatus.Fields.Item("Score").Value)%> </font></td>
    </tr>
    <tr>
    <td><font face="Arial, Helvetica, sans-serif">Total Time: <%=(ActivityStatus.Fields.Item("TotalTime").Value) %></font></td>
    </tr>
    <tr>
    <td><font face="Arial, Helvetica, sans-serif">Last Attempt:<%=(ActivityStatus.Fields.Item("ActivityDa te").Value)%></font></td>
    </tr>
    </table>
    </td>
    </tr>
    <tr valign="top">
    <td colspan="4"></td>
    </tr>
    <tr valign="top">
    <td colspan="4">
    <table width="100%" border="1">
    <tr>
    <td>
    <div align="center"><font face="Arial, Helvetica, sans-serif" size="-1">Question
    </font></div>
    </td>
    <td>
    <div align="center"><font face="Arial, Helvetica, sans-serif" size="-1">User
    Response
    </font></div>
    </td>
    <td>
    <div align="center"><font face="Arial, Helvetica, sans-serif" size="-1">Result</font></div>
    </td>
    <td>
    <div align="center"><font face="Arial, Helvetica, sans-serif" size="-1">Latency</font></div>
    </td>
    </tr>
    <%
    While ((Repeat1__numRows <> 0) AND (NOT ActivityDetail.EOF))
    %>
    <tr>
    <td><%=(ActivityDetail.Fields.Item("Question").Val ue)%> </td>
    <td><%=(ActivityDetail.Fields.Item("UserResponse") .Value)%> </td>
    <td><%=(ActivityDetail.Fields.Item("Result").Value )%> </td>
    <td><%=(ActivityDetail.Fields.Item("Latency").Valu e)%> </td>
    </tr>
    <%
    Repeat1__index=Repeat1__index+1
    Repeat1__numRows=Repeat1__numRows-1
    ActivityDetail.MoveNext()
    Wend
    %>
    </table>
    </td>
    </tr>
    </table>
    </body>
    </html>
    <%
    sessionInfo.Close()
    %>
    <%
    UserInfo.Close()
    %>
    <%
    ActivityInfo.Close()
    %>
    <%
    ActivityStatus.Close()
    %>
    <%
    ActivityDetail.Close()
    %>

  3. #3
    Utente di HTML.it
    Registrato dal
    Mar 2003
    Messaggi
    140
    un aiutino?

  4. #4
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    Se tu dovessi commentare lo script che DW MX ti ha "creato" ne saresti capace?

    Roby

  5. #5
    Utente di HTML.it
    Registrato dal
    Mar 2003
    Messaggi
    140
    vorrei sbagliarmi ma non so perchè, noto nel tuo messaggio una puntatina di sarcasmo......se è così probabilmente ho sbagliato forum oppure (più probabilmente) malgrado sei un moderatore, non hai capito tu lo spirito dei forum ( ) dove ci si scambia suggerimenti e si aiuta chi è in difficolta. :rollo: Se per caso ho toppato clamorosamente e ti porgo le mie più umili scuse. In ogni caso vengo alla tua domanda: asp lo capisco così così non benissimo altrimenti non avrei certo scritto ed il codice che ha prodotto DW Mx l'ho capito a grandi linee x questo vorrei un aiutino.
    Grazie in ogni caso.

  6. #6
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    Non c'era sarcasmo, volevo solo capire il tuo livello di conoscenza.
    Ci si può affidare a DW indipendentemnete dalla conoscenza di ASP ma è indubbio che ciò che scrive DW possa essere più che dimezzato se si possiede un minimo di conoscenza di VbScript.
    Io non l'ho mai usato quindi non posso aiutarti. Posso invece suggerirti di iniziare pian pianino a comprendere quello che DW ti propina perché più grande è il progetto più è difficile se non impossibile metterci le mani anche per modifiche effimere.

    Roby


  7. #7
    Utente di HTML.it
    Registrato dal
    Mar 2003
    Messaggi
    140
    ok grazie farò così, cmq se ci fosse qualcuno che si volesse darmi una manina :rollo:

  8. #8
    Utente di HTML.it
    Registrato dal
    Mar 2003
    Messaggi
    140
    nessuno che possa spiegarmi questa "pazzia" in ASP?
    Vi pregoooooooooooooooo

  9. #9
    Utente di HTML.it
    Registrato dal
    Mar 2003
    Messaggi
    140

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.