Index: lams_tool_lamc/db/sql/create_lams_tool_lamc.sql
===================================================================
diff -u -r7d9590c15a0ee3175f63dec067d4b5191a8a6e4d -r43b99721a0fa18b4ee65f3e94caf81cc7782ce87
--- lams_tool_lamc/db/sql/create_lams_tool_lamc.sql (.../create_lams_tool_lamc.sql) (revision 7d9590c15a0ee3175f63dec067d4b5191a8a6e4d)
+++ lams_tool_lamc/db/sql/create_lams_tool_lamc.sql (.../create_lams_tool_lamc.sql) (revision 43b99721a0fa18b4ee65f3e94caf81cc7782ce87)
@@ -87,6 +87,7 @@
, time_zone VARCHAR(255)
, mark VARCHAR(255) NOT NULL DEFAULT '0'
, passed TINYINT(1) NOT NULL DEFAULT 0
+ , attemptOrder INTEGER NOT NULL DEFAULT 1
, PRIMARY KEY (uid)
, INDEX (que_usr_id)
, CONSTRAINT FK_tl_lamc11_usr_attempt_1 FOREIGN KEY (que_usr_id)
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McAppConstants.java
===================================================================
diff -u -r59fe1db88f298509908caae77a8ddfd6fb7d2292 -r43b99721a0fa18b4ee65f3e94caf81cc7782ce87
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McAppConstants.java (.../McAppConstants.java) (revision 59fe1db88f298509908caae77a8ddfd6fb7d2292)
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McAppConstants.java (.../McAppConstants.java) (revision 43b99721a0fa18b4ee65f3e94caf81cc7782ce87)
@@ -155,6 +155,7 @@
public static final String MAP_LEARNER_FEEDBACK_INCORRECT ="mapLeanerFeedbackIncorrect";
public static final String MAP_LEARNER_FEEDBACK_CORRECT ="mapLeanerFeedbackCorrect";
public static final String MAP_QUESTION_WEIGHTS ="mapQuestionWeights";
+ public static final String MAP_QUE_ATTEMPTS ="mapQueAttempts";
public static final String MAP_WEIGHTS ="mapWeights";
@@ -184,7 +185,9 @@
public static final String PASSMARK ="passMark";
public static final String SHOW_FEEDBACK ="showFeedback";
public static final String USER_PASSED ="userPassed";
+ public static final String VIEW_ANSWERS ="viewAnswers";
+
public static final String ONLINE_INSTRUCTIONS ="onlineInstructions";
public static final String OFFLINE_INSTRUCTIONS ="offlineInstructions";
public static final String END_LEARNING_MESSSAGE ="endLearningMessage";
@@ -287,6 +290,7 @@
public static final String TOTAL_QUESTION_COUNT ="totalQuestionCount";
public static final String LEARNER_MARK ="learnerMark";
public static final String LEARNER_BEST_MARK ="learnerBestMark";
+ public static final String LEARNER_LAST_ATTEMPT_ORDER ="learnerLastAttemptOrder";
public static final String LEARNER_MARK_ATLEAST ="learnerMarkAtLeast";
public static final String MAP_ANSWERS ="mapAnswers";
public static final String CURRENT_ANSWER ="currentAnswer";
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McUsrAttempt.java
===================================================================
diff -u -r59fe1db88f298509908caae77a8ddfd6fb7d2292 -r43b99721a0fa18b4ee65f3e94caf81cc7782ce87
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McUsrAttempt.java (.../McUsrAttempt.java) (revision 59fe1db88f298509908caae77a8ddfd6fb7d2292)
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McUsrAttempt.java (.../McUsrAttempt.java) (revision 43b99721a0fa18b4ee65f3e94caf81cc7782ce87)
@@ -53,7 +53,11 @@
private boolean passed;
+ private Integer attemptOrder;
+
private Long queUsrId;
+
+ private Long mcQueContentId;
/** persistent field */
private org.lamsfoundation.lams.tool.mc.McQueContent mcQueContent;
@@ -95,6 +99,17 @@
this.passed = passed;
}
+ public McUsrAttempt(Date attemptTime, String timeZone, org.lamsfoundation.lams.tool.mc.McQueContent mcQueContent,
+ org.lamsfoundation.lams.tool.mc.McQueUsr mcQueUsr, org.lamsfoundation.lams.tool.mc.McOptsContent mcOptionsContent, Integer mark, boolean passed, Integer attemptOrder) {
+ this.attemptTime = attemptTime;
+ this.timeZone = timeZone;
+ this.mcQueContent = mcQueContent;
+ this.mcQueUsr = mcQueUsr;
+ this.mcOptionsContent = mcOptionsContent;
+ this.mark = mark;
+ this.passed = passed;
+ this.attemptOrder=attemptOrder;
+ }
/** default constructor */
@@ -207,4 +222,28 @@
public void setQueUsrId(Long queUsrId) {
this.queUsrId = queUsrId;
}
+ /**
+ * @return Returns the attemptOrder.
+ */
+ public Integer getAttemptOrder() {
+ return attemptOrder;
+ }
+ /**
+ * @param attemptOrder The attemptOrder to set.
+ */
+ public void setAttemptOrder(Integer attemptOrder) {
+ this.attemptOrder = attemptOrder;
+ }
+ /**
+ * @return Returns the mcQueContentId.
+ */
+ public Long getMcQueContentId() {
+ return mcQueContentId;
+ }
+ /**
+ * @param mcQueContentId The mcQueContentId to set.
+ */
+ public void setMcQueContentId(Long mcQueContentId) {
+ this.mcQueContentId = mcQueContentId;
+ }
}
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcUsrAttemptDAO.java
===================================================================
diff -u -r59fe1db88f298509908caae77a8ddfd6fb7d2292 -r43b99721a0fa18b4ee65f3e94caf81cc7782ce87
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcUsrAttemptDAO.java (.../IMcUsrAttemptDAO.java) (revision 59fe1db88f298509908caae77a8ddfd6fb7d2292)
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcUsrAttemptDAO.java (.../IMcUsrAttemptDAO.java) (revision 43b99721a0fa18b4ee65f3e94caf81cc7782ce87)
@@ -57,7 +57,7 @@
* * updates McUsrAttempt
* with the given identifier mcUsrAttempt
*
- * @param uid
+ * @param mcUsrAttempt
* @return
*/
public void updateMcUsrAttempt(McUsrAttempt mcUsrAttempt);
@@ -75,7 +75,7 @@
* * removes McUsrAttempt
* with the given identifier mcUsrAttempt
*
- * @param uid
+ * @param mcUsrAttempt
* @return
*/
public void removeMcUsrAttempt(McUsrAttempt mcUsrAttempt);
@@ -84,10 +84,40 @@
* * returns the highest mark of a learner
* with the given identifier queUsrId
*
- * @param uid
+ * @param queUsrId
* @return
*/
public List getHighestMark(Long queUsrId);
+
+ /**
+ * * returns the highest mark of a learner
+ * with the given identifier queUsrId
+ *
+ * @param queUsrId
+ * @return
+ */
+ public List getHighestAttemptOrder(Long queUsrId);
+
+ /**
+ * * returns a list of attempts
+ * with the given identifiers queUsrId
and mcQueContentId
+ *
+ * @param queUsrId
+ * @param mcQueContentId
+ * @return
+ */
+ public List getAttemptForQueContent(final Long queUsrId, final Long mcQueContentId);
+
+ /**
+ * * returns a list of attempts
+ * with the given identifiers queUsrId
and mcQueContentId
and attemptOrder
+ *
+ * @param queUsrId
+ * @param mcQueContentId
+ * @param attemptOrder
+ * @return
+ */
+ public List getAttemptByAttemptOrder(final Long queUsrId, final Long mcQueContentId, final Integer attemptOrder);
}
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McUsrAttemptDAO.java
===================================================================
diff -u -r59fe1db88f298509908caae77a8ddfd6fb7d2292 -r43b99721a0fa18b4ee65f3e94caf81cc7782ce87
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McUsrAttemptDAO.java (.../McUsrAttemptDAO.java) (revision 59fe1db88f298509908caae77a8ddfd6fb7d2292)
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McUsrAttemptDAO.java (.../McUsrAttemptDAO.java) (revision 43b99721a0fa18b4ee65f3e94caf81cc7782ce87)
@@ -40,6 +40,12 @@
private static final String LOAD_HIGHEST_MARK_BY_USER_ID = "from mcUsrAttempt in class McUsrAttempt where mcUsrAttempt.queUsrId=:queUsrId";
+ private static final String LOAD_HIGHEST_ATTEMPT_ORDER_BY_USER_ID = "from mcUsrAttempt in class McUsrAttempt where mcUsrAttempt.queUsrId=:queUsrId";
+
+ private static final String LOAD_ATTEMPT_FOR_QUE_CONTENT = "from mcUsrAttempt in class McUsrAttempt where mcUsrAttempt.queUsrId=:queUsrId and mcUsrAttempt.mcQueContentId=:mcQueContentId";
+
+ private static final String LOAD_ATTEMPT_BY_ATTEMPT_ORDER = "from mcUsrAttempt in class McUsrAttempt where mcUsrAttempt.queUsrId=:queUsrId and mcUsrAttempt.mcQueContentId=:mcQueContentId and attemptOrder=:attemptOrder";
+
public McUsrAttempt getMcUserAttemptByUID(Long uid)
{
return (McUsrAttempt) this.getHibernateTemplate()
@@ -61,6 +67,37 @@
return list;
}
+ public List getHighestAttemptOrder(Long queUsrId)
+ {
+ HibernateTemplate templ = this.getHibernateTemplate();
+ List list = getSession().createQuery(LOAD_HIGHEST_ATTEMPT_ORDER_BY_USER_ID)
+ .setLong("queUsrId", queUsrId.longValue())
+ .list();
+ return list;
+ }
+
+ public List getAttemptForQueContent(final Long queUsrId, final Long mcQueContentId)
+ {
+ HibernateTemplate templ = this.getHibernateTemplate();
+ List list = getSession().createQuery(LOAD_ATTEMPT_FOR_QUE_CONTENT)
+ .setLong("queUsrId", queUsrId.longValue())
+ .setLong("mcQueContentId", mcQueContentId.longValue())
+ .list();
+ return list;
+ }
+
+
+ public List getAttemptByAttemptOrder(final Long queUsrId, final Long mcQueContentId, final Integer attemptOrder)
+ {
+ HibernateTemplate templ = this.getHibernateTemplate();
+ List list = getSession().createQuery(LOAD_ATTEMPT_BY_ATTEMPT_ORDER)
+ .setLong("queUsrId", queUsrId.longValue())
+ .setLong("mcQueContentId", mcQueContentId.longValue())
+ .setInteger("attemptOrder", attemptOrder.intValue())
+ .list();
+ return list;
+ }
+
public void updateMcUsrAttempt(McUsrAttempt mcUsrAttempt)
{
this.getHibernateTemplate().update(mcUsrAttempt);
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/IMcService.java
===================================================================
diff -u -r59fe1db88f298509908caae77a8ddfd6fb7d2292 -r43b99721a0fa18b4ee65f3e94caf81cc7782ce87
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/IMcService.java (.../IMcService.java) (revision 59fe1db88f298509908caae77a8ddfd6fb7d2292)
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/IMcService.java (.../IMcService.java) (revision 43b99721a0fa18b4ee65f3e94caf81cc7782ce87)
@@ -203,5 +203,11 @@
public void persistFile(String uuid, boolean isOnlineFile, String fileName, McContent mcContent) throws McApplicationException;
public List getHighestMark(Long queUsrId) throws McApplicationException;
+
+ public List getHighestAttemptOrder(Long queUsrId) throws McApplicationException;
+
+ public List getAttemptForQueContent(final Long queUsrId, final Long mcQueContentId) throws McApplicationException;
+
+ public List getAttemptByAttemptOrder(final Long queUsrId, final Long mcQueContentId, final Integer attemptOrder) throws McApplicationException;
}
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/McServicePOJO.java
===================================================================
diff -u -r59fe1db88f298509908caae77a8ddfd6fb7d2292 -r43b99721a0fa18b4ee65f3e94caf81cc7782ce87
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/McServicePOJO.java (.../McServicePOJO.java) (revision 59fe1db88f298509908caae77a8ddfd6fb7d2292)
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/McServicePOJO.java (.../McServicePOJO.java) (revision 43b99721a0fa18b4ee65f3e94caf81cc7782ce87)
@@ -337,6 +337,51 @@
}
}
+
+ public List getHighestAttemptOrder(Long queUsrId) throws McApplicationException
+ {
+ try
+ {
+ return mcUsrAttemptDAO.getHighestAttemptOrder(queUsrId);
+ }
+ catch (DataAccessException e)
+ {
+ throw new McApplicationException("Exception occured when lams is getting the learner's highest attempt order: "
+ + e.getMessage(),
+ e);
+ }
+ }
+
+
+ public List getAttemptForQueContent(final Long queUsrId, final Long mcQueContentId) throws McApplicationException
+ {
+ try
+ {
+ return mcUsrAttemptDAO.getAttemptForQueContent(queUsrId, mcQueContentId);
+ }
+ catch (DataAccessException e)
+ {
+ throw new McApplicationException("Exception occured when lams is getting the learner's attempts by user id and que content id: "
+ + e.getMessage(),
+ e);
+ }
+ }
+
+
+ public List getAttemptByAttemptOrder(final Long queUsrId, final Long mcQueContentId, final Integer attemptOrder) throws McApplicationException
+ {
+ try
+ {
+ return mcUsrAttemptDAO.getAttemptByAttemptOrder(queUsrId, mcQueContentId, attemptOrder);
+ }
+ catch (DataAccessException e)
+ {
+ throw new McApplicationException("Exception occured when lams is getting the learner's attempts by user id and que content id and attempt order: "
+ + e.getMessage(),
+ e);
+ }
+ }
+
public McQueContent retrieveMcQueContentByUID(Long uid) throws McApplicationException
{
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/LearningUtil.java
===================================================================
diff -u -r59fe1db88f298509908caae77a8ddfd6fb7d2292 -r43b99721a0fa18b4ee65f3e94caf81cc7782ce87
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/LearningUtil.java (.../LearningUtil.java) (revision 59fe1db88f298509908caae77a8ddfd6fb7d2292)
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/LearningUtil.java (.../LearningUtil.java) (revision 43b99721a0fa18b4ee65f3e94caf81cc7782ce87)
@@ -14,7 +14,6 @@
import org.apache.log4j.Logger;
import org.lamsfoundation.lams.tool.mc.McAppConstants;
-import org.lamsfoundation.lams.tool.mc.McApplicationException;
import org.lamsfoundation.lams.tool.mc.McComparator;
import org.lamsfoundation.lams.tool.mc.McContent;
import org.lamsfoundation.lams.tool.mc.McOptsContent;
@@ -296,20 +295,35 @@
while (itLearnerAssessmentMap.hasNext())
{
Map.Entry pairs = (Map.Entry)itLearnerAssessmentMap.next();
- logger.debug("using the pair: " + pairs.getKey() + " = " + pairs.getValue());
if (pairs.getValue().toString().equalsIgnoreCase("true"))
{
- logger.debug("correct response");
++correctAnswerCount;
}
}
return correctAnswerCount;
}
+ public static int getHighestAttemptOrder(HttpServletRequest request, Long queUsrId)
+ {
+ IMcService mcService =McUtils.getToolService(request);
+ List listMarks=mcService.getHighestAttemptOrder(queUsrId);
+
+ Iterator itMarks=listMarks.iterator();
+ int highestAO=0;
+ while (itMarks.hasNext())
+ {
+ McUsrAttempt mcUsrAttempt=(McUsrAttempt)itMarks.next();
+ int currentAO=mcUsrAttempt.getAttemptOrder().intValue();
+ if (currentAO > highestAO)
+ highestAO= currentAO;
+ }
+ return highestAO;
+ }
+
+
public static int getHighestMark(HttpServletRequest request, Long queUsrId)
{
- logger.debug("queUsrId : " + queUsrId);
IMcService mcService =McUtils.getToolService(request);
List listMarks=mcService.getHighestMark(queUsrId);
@@ -318,13 +332,10 @@
while (itMarks.hasNext())
{
McUsrAttempt mcUsrAttempt=(McUsrAttempt)itMarks.next();
- logger.debug("mcUsrAttempt mark: " + mcUsrAttempt.getMark());
int currentMark=mcUsrAttempt.getMark().intValue();
- logger.debug("currentMark: " + currentMark);
if (currentMark > highestMark)
highestMark= currentMark;
}
- logger.debug("highestMark : " + highestMark);
return highestMark;
}
@@ -360,27 +371,21 @@
while (itMap.hasNext()) {
compareResult= false;
Map.Entry pairs = (Map.Entry)itMap.next();
- logger.debug("using the pair: " + pairs.getKey() + " = " + pairs.getValue());
-
+
Iterator itCheckedMap = mapGeneralCheckedOptionsContent.entrySet().iterator();
while (itCheckedMap.hasNext())
{
compareResult= false;
Map.Entry checkedPairs = (Map.Entry)itCheckedMap.next();
- logger.debug("using the pair: " + checkedPairs.getKey() + " = " + checkedPairs.getValue());
if (pairs.getKey().toString().equals(checkedPairs.getKey().toString()))
{
- logger.debug("same key found: " + pairs.getKey());
Map mapCorrectOptions=(Map) pairs.getValue();
Map mapCheckedOptions=(Map) checkedPairs.getValue();
boolean isEqual=compareMaps(mapCorrectOptions, mapCheckedOptions);
boolean isEqualCross=compareMapsCross(mapCorrectOptions, mapCheckedOptions);
compareResult= isEqual && isEqualCross;
- logger.debug("compareResult: " +compareResult);
- logger.debug("question index: " + pairs.getKey().toString() + " has isEqual as:" + isEqual + " and " + isEqualCross);
-
mapLeanerAssessmentResults.put(pairs.getKey(), new Boolean(compareResult).toString());
}
}
@@ -400,7 +405,6 @@
while (itMap.hasNext())
{
Map.Entry pairs = (Map.Entry)itMap.next();
- logger.debug("using the pair value: " + pairs.getValue());
boolean optionExists=optionExists(pairs.getValue().toString(), mapCheckedOptions);
if (optionExists == false)
@@ -422,7 +426,6 @@
while (itMap.hasNext())
{
Map.Entry pairs = (Map.Entry)itMap.next();
- logger.debug("using the pair value: " + pairs.getValue());
boolean optionExists=optionExists(pairs.getValue().toString(), mapCorrectOptions);
if (optionExists == false)
@@ -442,7 +445,6 @@
while (itMap.hasNext())
{
Map.Entry pairsChecked = (Map.Entry)itMap.next();
- logger.debug("using the pairsChecked value: " + pairsChecked.getValue());
if (pairsChecked.getValue().equals(optionValue))
return true;
}
@@ -460,26 +462,16 @@
{
IMcService mcService =McUtils.getToolService(request);
Long queUsrId=McUtils.getUserId();
- logger.debug("queUsrId: " + queUsrId);
-
String username=McUtils.getUserName();
- logger.debug("userName: " + username);
-
String fullname=McUtils.getUserFullName();
- logger.debug("fullName: " + fullname);
-
Long toolSessionId=(Long) request.getSession().getAttribute(TOOL_SESSION_ID);
- logger.debug("toolSessionId: " + toolSessionId);
McSession mcSession=mcService.retrieveMcSession(toolSessionId);
- logger.debug("retrieving mcSession: " + mcSession);
-
McQueUsr mcQueUsr= new McQueUsr(queUsrId,
username,
fullname,
mcSession,
new TreeSet());
- logger.debug("created mcQueUsr : " + mcQueUsr);
mcService.createMcQueUsr(mcQueUsr);
logger.debug("created mcQueUsr in the db: " + mcQueUsr);
}
@@ -495,10 +487,7 @@
{
IMcService mcService =McUtils.getToolService(request);
Long queUsrId=McUtils.getUserId();
- logger.debug("queUsrId: " + queUsrId);
-
McQueUsr mcQueUsr=mcService.retrieveMcQueUsr(queUsrId);
- logger.debug("mcQueUsr: " + mcQueUsr);
if (mcQueUsr != null)
return true;
@@ -511,11 +500,7 @@
{
IMcService mcService =McUtils.getToolService(request);
Long queUsrId=McUtils.getUserId();
- logger.debug("queUsrId: " + queUsrId);
-
McQueUsr mcQueUsr=mcService.retrieveMcQueUsr(queUsrId);
- logger.debug("mcQueUsr: " + mcQueUsr);
-
return mcQueUsr;
}
@@ -527,54 +512,39 @@
*
* @param request
*/
- public static void createAttempt(HttpServletRequest request, McQueUsr mcQueUsr, Map mapGeneralCheckedOptionsContent, int mark, boolean passed)
+ public static void createAttempt(HttpServletRequest request, McQueUsr mcQueUsr, Map mapGeneralCheckedOptionsContent, int mark, boolean passed, int highestAttemptOrder)
{
IMcService mcService =McUtils.getToolService(request);
Date attempTime=McUtils.getGMTDateTime();
- logger.debug("attempTime: " + attempTime);
-
String timeZone= McUtils.getCurrentTimeZone();
logger.debug("timeZone: " + timeZone);
-
Long toolContentUID= (Long) request.getSession().getAttribute(TOOL_CONTENT_UID);
- logger.debug("toolContentUID: " + toolContentUID);
Iterator itCheckedMap = mapGeneralCheckedOptionsContent.entrySet().iterator();
while (itCheckedMap.hasNext())
{
Map.Entry checkedPairs = (Map.Entry)itCheckedMap.next();
- logger.debug("using the pair: " + checkedPairs.getKey() + " = " + checkedPairs.getValue());
Map mapCheckedOptions=(Map) checkedPairs.getValue();
- logger.debug("question index:" + checkedPairs.getKey()+ " options: "+ mapCheckedOptions);
Long questionDisplayOrder=new Long(checkedPairs.getKey().toString());
- logger.debug("questionDisplayOrder:" + questionDisplayOrder);
McQueContent mcQueContent=mcService.getQuestionContentByDisplayOrder(questionDisplayOrder, toolContentUID);
- logger.debug("mcQueContent:" + mcQueContent);
- createIndividualOptions(request, mapCheckedOptions, mcQueContent, mcQueUsr, attempTime, timeZone, mark, passed);
+ createIndividualOptions(request, mapCheckedOptions, mcQueContent, mcQueUsr, attempTime, timeZone, mark, passed, new Integer(highestAttemptOrder));
}
}
- public static void createIndividualOptions(HttpServletRequest request, Map mapCheckedOptions, McQueContent mcQueContent, McQueUsr mcQueUsr, Date attempTime, String timeZone, int mark, boolean passed)
+ public static void createIndividualOptions(HttpServletRequest request, Map mapCheckedOptions, McQueContent mcQueContent, McQueUsr mcQueUsr, Date attempTime, String timeZone, int mark, boolean passed, Integer highestAttemptOrder)
{
IMcService mcService =McUtils.getToolService(request);
-
Integer IntegerMark= new Integer(mark);
- logger.debug("IntegerMark: " + IntegerMark);
- logger.debug("passed: " + passed);
-
Iterator itCheckedMap = mapCheckedOptions.entrySet().iterator();
while (itCheckedMap.hasNext())
{
Map.Entry checkedPairs = (Map.Entry)itCheckedMap.next();
- logger.debug("option value :" + checkedPairs.getValue());
McOptsContent mcOptsContent= mcService.getOptionContentByOptionText(checkedPairs.getValue().toString(), mcQueContent.getUid());
- logger.debug("mcOptsContent :" + mcOptsContent);
- McUsrAttempt mcUsrAttempt=new McUsrAttempt(attempTime, timeZone, mcQueContent, mcQueUsr, mcOptsContent, IntegerMark, passed);
- logger.debug("mcUsrAttempt :" + mcUsrAttempt);
+ McUsrAttempt mcUsrAttempt=new McUsrAttempt(attempTime, timeZone, mcQueContent, mcQueUsr, mcOptsContent, IntegerMark, passed, highestAttemptOrder);
mcService.createMcUsrAttempt(mcUsrAttempt);
logger.debug("created mcUsrAttempt in the db :" + mcUsrAttempt);
}
@@ -585,25 +555,20 @@
{
IMcService mcService =McUtils.getToolService(request);
Map mapWeights= new TreeMap(new McComparator());
-
McContent mcContent=mcService.retrieveMc(toolContentId);
- logger.debug("mcContent:" + mcContent);
List questionsContent=mcService.refreshQuestionContent(mcContent.getUid());
- logger.debug("questionsContent:" + questionsContent);
Iterator listIterator=questionsContent.iterator();
Long mapIndex=new Long(1);
while (listIterator.hasNext())
{
McQueContent mcQueContent=(McQueContent)listIterator.next();
- logger.debug("mcQueContent:" + mcQueContent);
mapWeights.put(mapIndex.toString(),mcQueContent.getWeight().toString());
mapIndex=new Long(mapIndex.longValue()+1);
}
return mapWeights;
}
-
}
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McAction.java
===================================================================
diff -u -ra5ed179d80f07ee8130b5e3364700180ddc3c6f2 -r43b99721a0fa18b4ee65f3e94caf81cc7782ce87
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McAction.java (.../McAction.java) (revision a5ed179d80f07ee8130b5e3364700180ddc3c6f2)
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McAction.java (.../McAction.java) (revision 43b99721a0fa18b4ee65f3e94caf81cc7782ce87)
@@ -45,11 +45,13 @@
import org.apache.struts.action.ActionMessages;
import org.apache.struts.actions.DispatchAction;
import org.lamsfoundation.lams.tool.mc.McAppConstants;
+import org.lamsfoundation.lams.tool.mc.McApplicationException;
import org.lamsfoundation.lams.tool.mc.McComparator;
import org.lamsfoundation.lams.tool.mc.McContent;
import org.lamsfoundation.lams.tool.mc.McOptsContent;
import org.lamsfoundation.lams.tool.mc.McQueContent;
import org.lamsfoundation.lams.tool.mc.McQueUsr;
+import org.lamsfoundation.lams.tool.mc.McUsrAttempt;
import org.lamsfoundation.lams.tool.mc.McUtils;
import org.lamsfoundation.lams.tool.mc.service.IMcService;
import org.lamsfoundation.lams.usermanagement.dto.UserDTO;
@@ -2159,9 +2161,17 @@
McQueUsr mcQueUsr=LearningUtil.getUser(request);
logger.debug("mcQueUsr: " + mcQueUsr);
- logger.debug("passed: " + passed);
- LearningUtil.createAttempt(request, mcQueUsr, mapGeneralCheckedOptionsContent, mark, passed);
+
+ String highestAttemptOrder=(String)request.getSession().getAttribute(LEARNER_LAST_ATTEMPT_ORDER);
+ logger.debug("current highestAttemptOrder:" + highestAttemptOrder);
+
+ logger.debug("passed: " + passed);
+ LearningUtil.createAttempt(request, mcQueUsr, mapGeneralCheckedOptionsContent, mark, passed, new Integer(highestAttemptOrder).intValue());
logger.debug("created user attempt in the db");
+
+ int intHighestAttemptOrder=new Integer(highestAttemptOrder).intValue()+ 1 ;
+ logger.debug("updated highestAttemptOrder:" + intHighestAttemptOrder);
+ request.getSession().setAttribute(LEARNER_LAST_ATTEMPT_ORDER, new Integer(intHighestAttemptOrder).toString());
mcLearningForm.resetCommands();
return (mapping.findForward(INDIVIDUAL_REPORT));
@@ -2221,6 +2231,58 @@
mcLearningForm.resetCommands();
return redoQuestions(request, mcLearningForm, mapping);
}
+ else if (mcLearningForm.getViewAnswers() != null)
+ {
+ logger.debug("requested view Answers, listall the answers user has given.");
+ String totalQuestionCount= (String) request.getSession().getAttribute(TOTAL_QUESTION_COUNT);
+ logger.debug("totalQuestionCount: " + totalQuestionCount);
+
+ Long toolContentUID= (Long) request.getSession().getAttribute(TOOL_CONTENT_UID);
+ logger.debug("toolContentUID: " + toolContentUID);
+
+ McQueUsr mcQueUsr=LearningUtil.getUser(request);
+ Long queUsrId=mcQueUsr.getUid();
+ logger.debug("queUsrId: " + queUsrId);
+
+ Map mapQueAttempts= new TreeMap(new McComparator());
+ for (int i=1; i<= new Integer(totalQuestionCount).intValue(); i++)
+ {
+ logger.debug("doing question with display order: " + i);
+ McQueContent mcQueContent=mcService.getQuestionContentByDisplayOrder(new Long(i), toolContentUID);
+ logger.debug("mcQueContent uid: " + mcQueContent.getUid());
+ //List attempts=mcService.getAttemptForQueContent(queUsrId, mcQueContent.getUid());
+ //logger.debug("attempts for question: " + mcQueContent.getUid() + " are: " + attempts);
+
+ Map mapAttemptOrderAttempts= new TreeMap(new McComparator());
+ for (int j=1; j < 11 ; j++ )
+ {
+ List attemptsByAttemptOrder=mcService.getAttemptByAttemptOrder(queUsrId, mcQueContent.getUid(), new Integer(j));
+ logger.debug("attemptsByAttemptOrder: " + j + " is: " + attemptsByAttemptOrder);
+
+ Map mapAttempts= new TreeMap(new McComparator());
+ Iterator attemptIterator=attemptsByAttemptOrder.iterator();
+ Long mapIndex=new Long(1);
+ while (attemptIterator.hasNext())
+ {
+ McUsrAttempt mcUsrAttempt=(McUsrAttempt)attemptIterator.next();
+ mapAttempts.put(mapIndex.toString(),mcUsrAttempt.getMcOptionsContent().getMcQueOptionText());
+
+ logger.debug("added attempt with order: " + mcUsrAttempt.getAttemptOrder() + " , option text is: " + mcUsrAttempt.getMcOptionsContent().getMcQueOptionText());
+ mapIndex=new Long(mapIndex.longValue()+1);
+ }
+ logger.debug("final mapAttempts is: " + mapAttempts);
+ mapAttemptOrderAttempts.put(new Integer(j).toString(), mapAttempts);
+ }
+ logger.debug("final mapAttemptOrderAttempts is: " + mapAttemptOrderAttempts);
+ mapQueAttempts.put(new Integer(i).toString(), mapAttemptOrderAttempts);
+ }
+
+ logger.debug("final mapQueAttempts is: " + mapQueAttempts);
+ request.getSession().setAttribute(MAP_QUE_ATTEMPTS, mapQueAttempts);
+
+ mcLearningForm.resetCommands();
+ return (mapping.findForward(VIEW_ANSWERS));
+ }
else if (mcLearningForm.getViewSummary() != null)
{
logger.debug("requested view summary...");
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McLearningStarterAction.java
===================================================================
diff -u -ra5ed179d80f07ee8130b5e3364700180ddc3c6f2 -r43b99721a0fa18b4ee65f3e94caf81cc7782ce87
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McLearningStarterAction.java (.../McLearningStarterAction.java) (revision a5ed179d80f07ee8130b5e3364700180ddc3c6f2)
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McLearningStarterAction.java (.../McLearningStarterAction.java) (revision 43b99721a0fa18b4ee65f3e94caf81cc7782ce87)
@@ -223,8 +223,6 @@
logger.debug("mcContent has : " + mapQuestionsContent.size() + " entries.");
request.getSession().setAttribute(TOTAL_QUESTION_COUNT, new Long(mapQuestionsContent.size()).toString());
-
-
request.getSession().setAttribute(CURRENT_QUESTION_INDEX, "1");
logger.debug("CURRENT_QUESTION_INDEX: " + request.getSession().getAttribute(CURRENT_QUESTION_INDEX));
logger.debug("final Options Map for the first question: " + request.getSession().getAttribute(MAP_OPTIONS_CONTENT));
@@ -242,16 +240,36 @@
*/
String userID=(String) request.getSession().getAttribute(USER_ID);
logger.debug("userID:" + userID);
- McQueUsr mcQueUsr=mcService.retrieveMcQueUsr(new Long(userID));
+
+ McQueUsr mcQueUsr=mcService.retrieveMcQueUsr(new Long(userID));
logger.debug("mcQueUsr:" + mcQueUsr);
- Long queUsrId=mcQueUsr.getUid();
- logger.debug("queUsrId: " + queUsrId);
-
- int learnerBestMark=LearningUtil.getHighestMark(request, queUsrId);
- logger.debug("learnerBestMark: " + learnerBestMark);
- request.getSession().setAttribute(LEARNER_BEST_MARK,new Integer(learnerBestMark).toString());
+ if (mcQueUsr != null)
+ {
+ logger.debug("mcQueUsr is available in the db:" + mcQueUsr);
+ Long queUsrId=mcQueUsr.getUid();
+ logger.debug("queUsrId: " + queUsrId);
+
+ int highestAttemptOrder=LearningUtil.getHighestAttemptOrder(request, queUsrId);
+ logger.debug("highestAttemptOrder: " + highestAttemptOrder);
+ if (highestAttemptOrder == 0)
+ highestAttemptOrder=1;
+ logger.debug("highestAttemptOrder: " + highestAttemptOrder);
+ request.getSession().setAttribute(LEARNER_LAST_ATTEMPT_ORDER,new Integer(highestAttemptOrder).toString());
+
+ int learnerBestMark=LearningUtil.getHighestMark(request, queUsrId);
+ logger.debug("learnerBestMark: " + learnerBestMark);
+ request.getSession().setAttribute(LEARNER_BEST_MARK,new Integer(learnerBestMark).toString());
+ }
+ else
+ {
+ logger.debug("mcQueUsr is not available in the db:" + mcQueUsr);
+ request.getSession().setAttribute(LEARNER_LAST_ATTEMPT_ORDER,new Integer(1).toString());
+ request.getSession().setAttribute(LEARNER_BEST_MARK,new Integer(0).toString());
+
+ }
+
if (mcQueUsr != null)
{
logger.debug("the learner has already responsed to this content, just generate a read-only report. Use redo questions for this.");
Index: lams_tool_lamc/web/ViewAnswers.jsp
===================================================================
diff -u
--- lams_tool_lamc/web/ViewAnswers.jsp (revision 0)
+++ lams_tool_lamc/web/ViewAnswers.jsp (revision 43b99721a0fa18b4ee65f3e94caf81cc7782ce87)
@@ -0,0 +1,147 @@
+<%@ taglib uri="/WEB-INF/struts-html-el.tld" prefix="html" %>
+<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
+<%@ taglib uri="/WEB-INF/struts-logic-el.tld" prefix="logic-el" %>
+<%@ taglib uri="/WEB-INF/c.tld" prefix="c" %>
+<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %>
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+
+
+
+
+
+
+
+  
+
+ |
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+ |
+
+
+
+
+
+  
+ |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
Index: lams_tool_lamc/web/WEB-INF/struts-config.xml
===================================================================
diff -u -ra5ed179d80f07ee8130b5e3364700180ddc3c6f2 -r43b99721a0fa18b4ee65f3e94caf81cc7782ce87
--- lams_tool_lamc/web/WEB-INF/struts-config.xml (.../struts-config.xml) (revision a5ed179d80f07ee8130b5e3364700180ddc3c6f2)
+++ lams_tool_lamc/web/WEB-INF/struts-config.xml (.../struts-config.xml) (revision 43b99721a0fa18b4ee65f3e94caf81cc7782ce87)
@@ -154,6 +154,12 @@
/>
+
+
+
+
+
+
+
-
+
\ No newline at end of file