-
+
Index: lams_tool_lamc/db/sql/create_lams_tool_mc.sql
===================================================================
diff -u -r7e58118a02164b69f28068177656576f32aaeddd -rf931ace3d9f38ea25225bd0cd55adfdcb3dfc376
--- lams_tool_lamc/db/sql/create_lams_tool_mc.sql (.../create_lams_tool_mc.sql) (revision 7e58118a02164b69f28068177656576f32aaeddd)
+++ lams_tool_lamc/db/sql/create_lams_tool_mc.sql (.../create_lams_tool_mc.sql) (revision f931ace3d9f38ea25225bd0cd55adfdcb3dfc376)
@@ -89,6 +89,7 @@
, mark VARCHAR(255)
, passed TINYINT(1) NOT NULL DEFAULT 0
, attemptOrder INTEGER NOT NULL DEFAULT 1
+ , totalWeight INTEGER DEFAULT 0
, PRIMARY KEY (uid)
, INDEX (mc_que_content_id)
, CONSTRAINT FK_tl_lamc11_usr_attempt_2 FOREIGN KEY (mc_que_content_id)
@@ -113,9 +114,11 @@
REFERENCES tl_lamc11_content (uid)
)TYPE=InnoDB;
-INSERT INTO tl_lamc11_content(uid, content_id , title , instructions , creation_date , questions_sequenced , username_visible , created_by , monitoring_report_title , report_title , run_offline , define_later, synch_in_monitor, offline_instructions, online_instructions, end_learning_message, content_in_use, retries, show_feedback, show_report) VALUES (1, ${default_content_id} ,'Mc Title','Mc Instructions', NOW(), 0, 0,1,'Monitoring Report','Report', 0, 0, 0,'offline instructions','online instructions','Finished Activity...', 0, 0, 0, 0);
+INSERT INTO tl_lamc11_content(uid, content_id , title , instructions , creation_date , questions_sequenced , username_visible , created_by , monitoring_report_title , report_title , run_offline , define_later, synch_in_monitor, offline_instructions, online_instructions, end_learning_message, content_in_use, retries, show_feedback, show_report, pass_mark) VALUES (1, ${default_content_id} ,'MCQ Title','MCQ Instructions', NOW(), 0, 0,1,'Monitoring Report','Report', 0, 0, 0,'offline instructions','online instructions','Finished Activity...', 0, 0, 0, 0, 50);
-INSERT INTO tl_lamc11_que_content (uid,question, weight, disabled, display_order, mc_content_id) VALUES (1, 'a sample question', 0, 1, 1, 1);
+INSERT INTO tl_lamc11_que_content (uid,question, weight, disabled, display_order, mc_content_id, feedbackIncorrect, feedbackCorrect) VALUES (1, 'A Sample question?', 100, 0, 1,1, 'Your answer is incorrect', 'Correct');
-INSERT INTO tl_lamc11_options_content (uid, correct_option, mc_que_content_id, mc_que_option_text) VALUES (1, 0, 1,'sample answer 1');
+INSERT INTO tl_lamc11_options_content (uid, correct_option, mc_que_content_id, mc_que_option_text) VALUES (1, 0, 1,'Candidate Answer 1');
+INSERT INTO tl_lamc11_options_content (uid, correct_option, mc_que_content_id, mc_que_option_text) VALUES (2, 1, 1,'Candidate Answer 2');
+
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McAppConstants.java
===================================================================
diff -u -rf536379d9c4072abeffb63d0cd140b819122cb8e -rf931ace3d9f38ea25225bd0cd55adfdcb3dfc376
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McAppConstants.java (.../McAppConstants.java) (revision f536379d9c4072abeffb63d0cd140b819122cb8e)
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McAppConstants.java (.../McAppConstants.java) (revision f931ace3d9f38ea25225bd0cd55adfdcb3dfc376)
@@ -120,6 +120,7 @@
public static final String MAP_WEIGHTS ="mapWeights";
public static final String MAP_CHECKBOX_STATES ="mapCheckBoxStates";
public static final String MAP_SELECTED_OPTIONS ="mapSelectedOptions";
+ public static final String DEFAULT_SELECTED_OPTION ="Candidate Answer 2";
public static final String MAP_FEEDBACK_INCORRECT ="mapFeedbackIncorrect";
public static final String MAP_INCORRECT_FEEDBACK ="mapIncorrectFeedback";
@@ -135,6 +136,9 @@
public static final String SELECTED_QUESTION_INDEX ="selectedQuestionIndex";
public static final String DEFAULT_QUESTION_UID ="defaultQuestionUid";
+ public static final String DEFAULT_FEEDBACK_INCORRECT ="Your answer is incorrect";
+ public static final String DEFAULT_FEEDBACK_CORRECT ="Correct";
+
public static final String TITLE ="title";
public static final String INSTRUCTIONS ="instructions";
public static final String CREATION_DATE ="creationDate";
@@ -246,6 +250,7 @@
public static final String CURRENT_MONITORED_TOOL_SESSION ="currentMonitoredToolSession";
public static final String SELECTION_CASE ="selectionCase";
public static final String LIST_MONITORED_ANSWERS_CONTAINER_DTO ="listMonitoredAnswersContainerDto";
+ public static final String LIST_MONITORED_MARKS_CONTAINER_DTO ="listMonitoredMarksContainerDto";
public static final String TIMEZONE ="timeZone";
public static final String QUESTION_LISTING_MODE ="questionListingMode";
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McMonitoredUserDTO.java
===================================================================
diff -u -rc9531327d15636b54f293077ee1cd9f60195381b -rf931ace3d9f38ea25225bd0cd55adfdcb3dfc376
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McMonitoredUserDTO.java (.../McMonitoredUserDTO.java) (revision c9531327d15636b54f293077ee1cd9f60195381b)
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McMonitoredUserDTO.java (.../McMonitoredUserDTO.java) (revision f931ace3d9f38ea25225bd0cd55adfdcb3dfc376)
@@ -47,6 +47,8 @@
private String isCorrect;
+ private String mark;
+
private String response;
private String sessionId;
@@ -191,4 +193,16 @@
public void setQuestionUid(String questionUid) {
this.questionUid = questionUid;
}
+ /**
+ * @return Returns the mark.
+ */
+ public String getMark() {
+ return mark;
+ }
+ /**
+ * @param mark The mark to set.
+ */
+ public void setMark(String mark) {
+ this.mark = mark;
+ }
}
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McUtils.java
===================================================================
diff -u -rc9531327d15636b54f293077ee1cd9f60195381b -rf931ace3d9f38ea25225bd0cd55adfdcb3dfc376
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McUtils.java (.../McUtils.java) (revision c9531327d15636b54f293077ee1cd9f60195381b)
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McUtils.java (.../McUtils.java) (revision f931ace3d9f38ea25225bd0cd55adfdcb3dfc376)
@@ -246,6 +246,10 @@
{
request.getSession().setAttribute(RICHTEXT_INCORRECT_FEEDBACK,richTextIncorrectFeedback);
}
+ else
+ {
+ request.getSession().setAttribute(RICHTEXT_INCORRECT_FEEDBACK,DEFAULT_FEEDBACK_INCORRECT);
+ }
String richTextCorrectFeedback=request.getParameter(RICHTEXT_CORRECT_FEEDBACK);
@@ -255,6 +259,10 @@
{
request.getSession().setAttribute(RICHTEXT_CORRECT_FEEDBACK,richTextCorrectFeedback);
}
+ else
+ {
+ request.getSession().setAttribute(RICHTEXT_CORRECT_FEEDBACK,DEFAULT_FEEDBACK_CORRECT);
+ }
String richTextReportTitle=request.getParameter(RICHTEXT_REPORT_TITLE);
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcUsrAttemptDAO.java
===================================================================
diff -u -rc9531327d15636b54f293077ee1cd9f60195381b -rf931ace3d9f38ea25225bd0cd55adfdcb3dfc376
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcUsrAttemptDAO.java (.../IMcUsrAttemptDAO.java) (revision c9531327d15636b54f293077ee1cd9f60195381b)
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcUsrAttemptDAO.java (.../IMcUsrAttemptDAO.java) (revision f931ace3d9f38ea25225bd0cd55adfdcb3dfc376)
@@ -35,7 +35,8 @@
*/
public interface IMcUsrAttemptDAO
{
- /**
+
+ /**
* * Return the persistent instance of a McUsrAttempt
* with the given identifier uid
, returns null if not found.
*
@@ -129,6 +130,8 @@
public List getAttemptsForUserAndQuestionContent(final Long queUsrId, final Long mcQueContentId);
+ public List getUserAttemptsForQuestionContentAndSessionUid(final Long queUsrUid, final Long mcQueContentId, final Long mcSessionUid);
+
public List getMarks();
}
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McQueContentDAO.java
===================================================================
diff -u -rc9531327d15636b54f293077ee1cd9f60195381b -rf931ace3d9f38ea25225bd0cd55adfdcb3dfc376
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McQueContentDAO.java (.../McQueContentDAO.java) (revision c9531327d15636b54f293077ee1cd9f60195381b)
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McQueContentDAO.java (.../McQueContentDAO.java) (revision f931ace3d9f38ea25225bd0cd55adfdcb3dfc376)
@@ -45,9 +45,9 @@
private static final String CLEAN_QUESTION_CONTENT_BY_CONTENT_ID_SIMPLE = "from mcQueContent in class McQueContent where mcQueContent.mcContentId=:mcContentId";
- private static final String CLEAN_QUESTION_CONTENT_BY_CONTENT_ID = "from mcQueContent in class McQueContent where mcQueContent.mcContentId=:mcContentId and mcQueContent.disabled=true";
+ private static final String CLEAN_QUESTION_CONTENT_BY_CONTENT_ID = "from mcQueContent in class McQueContent where mcQueContent.mcContentId=:mcContentId";
- private static final String REFRESH_QUESTION_CONTENT = "from mcQueContent in class McQueContent where mcQueContent.mcContentId=:mcContentId and mcQueContent.disabled=false order by mcQueContent.displayOrder";
+ private static final String REFRESH_QUESTION_CONTENT = "from mcQueContent in class McQueContent where mcQueContent.mcContentId=:mcContentId order by mcQueContent.displayOrder";
private static final String LOAD_QUESTION_CONTENT_BY_QUESTION_TEXT = "from mcQueContent in class McQueContent where mcQueContent.question=:question and mcQueContent.mcContentId=:mcContentUid";
@@ -163,7 +163,6 @@
while (listIterator.hasNext())
{
McQueContent mcQueContent=(McQueContent)listIterator.next();
- mcQueContent.setDisabled(true);
this.getSession().setFlushMode(FlushMode.AUTO);
templ.update(mcQueContent);
}
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McUsrAttemptDAO.java
===================================================================
diff -u -rc9531327d15636b54f293077ee1cd9f60195381b -rf931ace3d9f38ea25225bd0cd55adfdcb3dfc376
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McUsrAttemptDAO.java (.../McUsrAttemptDAO.java) (revision c9531327d15636b54f293077ee1cd9f60195381b)
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McUsrAttemptDAO.java (.../McUsrAttemptDAO.java) (revision f931ace3d9f38ea25225bd0cd55adfdcb3dfc376)
@@ -22,6 +22,8 @@
/* $$Id$$ */
package org.lamsfoundation.lams.tool.mc.dao.hibernate;
+import java.util.ArrayList;
+import java.util.Iterator;
import java.util.List;
import org.apache.log4j.Logger;
@@ -50,6 +52,8 @@
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";
+ private static final String LOAD_ATTEMPT_FOR_QUESTION_CONTENT = "from mcUsrAttempt in class McUsrAttempt where mcUsrAttempt.mcQueContentId=:mcQueContentId";
+
private static final String LOAD_MARK = "from mcUsrAttempt in class McUsrAttempt";
private static final String LOAD_HIGHEST_MARK = "from mcUsrAttempt in class McUsrAttempt";
@@ -115,7 +119,44 @@
return list;
}
+ public List getUserAttemptsForQuestionContentAndSessionUid(final Long queUsrUid, final Long mcQueContentId, final Long mcSessionUid)
+ {
+ logger.debug("doing getUserAttemptsForQuestionContentAndSessionUid:");
+ logger.debug("queUsrUid:" + queUsrUid);
+ logger.debug("mcQueContentId:" + mcQueContentId);
+ logger.debug("mcSessionUid:" + mcSessionUid);
+
+ HibernateTemplate templ = this.getHibernateTemplate();
+ List list = getSession().createQuery(LOAD_ATTEMPT_FOR_QUESTION_CONTENT)
+ .setLong("mcQueContentId", mcQueContentId.longValue())
+ .list();
+
+ List userEntries= new ArrayList();
+ if(list != null && list.size() > 0){
+ Iterator listIterator=list.iterator();
+ while (listIterator.hasNext())
+ {
+ McUsrAttempt attempt=(McUsrAttempt)listIterator.next();
+ logger.debug("attempt:" + attempt);
+
+ if (attempt.getMcQueUsr().getUid().toString().equals(queUsrUid.toString()))
+ {
+ logger.debug("queUsrUid equal:" + queUsrUid);
+ if (attempt.getMcQueUsr().getMcSession().getUid().toString().equals(mcSessionUid.toString()))
+ {
+ logger.debug("user belong to this session:" + mcSessionUid);
+ userEntries.add(attempt);
+ }
+
+ }
+ }
+ }
+ logger.debug("userEntries:" + userEntries);
+ return userEntries;
+ }
+
+
public List getAttemptForQueContent(final Long queUsrId, final Long mcQueContentId)
{
HibernateTemplate templ = this.getHibernateTemplate();
@@ -140,6 +181,7 @@
public void updateMcUsrAttempt(McUsrAttempt mcUsrAttempt)
{
+ this.getSession().setFlushMode(FlushMode.AUTO);
this.getHibernateTemplate().update(mcUsrAttempt);
}
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/pojos/McQueContent.java
===================================================================
diff -u -rc9531327d15636b54f293077ee1cd9f60195381b -rf931ace3d9f38ea25225bd0cd55adfdcb3dfc376
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/pojos/McQueContent.java (.../McQueContent.java) (revision c9531327d15636b54f293077ee1cd9f60195381b)
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/pojos/McQueContent.java (.../McQueContent.java) (revision f931ace3d9f38ea25225bd0cd55adfdcb3dfc376)
@@ -58,9 +58,6 @@
/** nullable persistent field */
private Integer weight;
- /** persistent field */
- private boolean disabled;
-
private String feedbackCorrect;
private String feedbackIncorrect;
@@ -96,21 +93,19 @@
this.mcOptionsContents = mcOptionsContents;
}
- public McQueContent(String question, Integer displayOrder, Integer weight, boolean disabled, McContent mcContent, Set mcUsrAttempts, Set mcOptionsContents) {
+ public McQueContent(String question, Integer displayOrder, Integer weight, McContent mcContent, Set mcUsrAttempts, Set mcOptionsContents) {
this.question = question;
this.displayOrder = displayOrder;
this.weight = weight;
- this.disabled = disabled;
this.mcContent=mcContent;
this.mcUsrAttempts = mcUsrAttempts;
this.mcOptionsContents = mcOptionsContents;
}
- public McQueContent(String question, Integer displayOrder, Integer weight, boolean disabled, String feedbackIncorrect, String feedbackCorrect, McContent mcContent, Set mcUsrAttempts, Set mcOptionsContents) {
+ public McQueContent(String question, Integer displayOrder, Integer weight, String feedbackIncorrect, String feedbackCorrect, McContent mcContent, Set mcUsrAttempts, Set mcOptionsContents) {
this.question = question;
this.displayOrder = displayOrder;
this.weight = weight;
- this.disabled = disabled;
this.feedbackIncorrect = feedbackIncorrect;
this.feedbackCorrect = feedbackCorrect;
this.mcContent=mcContent;
@@ -119,19 +114,6 @@
}
- public McQueContent(String question, Integer displayOrder, Integer weight, String feedbackCorrect, String feedbackIncorrect, boolean disabled, McContent mcContent, Set mcUsrAttempts, Set mcOptionsContents) {
- this.question = question;
- this.displayOrder = displayOrder;
- this.weight = weight;
- this.disabled = disabled;
- this.feedbackCorrect=feedbackCorrect;
- this.feedbackIncorrect=feedbackIncorrect;
- this.mcContent=mcContent;
- this.mcUsrAttempts = mcUsrAttempts;
- this.mcOptionsContents = mcOptionsContents;
- }
-
-
public McQueContent(Long mcQueContentId, String question, Integer displayOrder, Set mcUsrAttempts, Set mcOptionsContents) {
this.mcQueContentId = mcQueContentId;
this.question = question;
@@ -188,7 +170,6 @@
McQueContent newQueContent = new McQueContent(queContent.getQuestion(),
queContent.getDisplayOrder(),
queContent.getWeight(),
- queContent.isDisabled(),
queContent.getFeedbackIncorrect(),
queContent.getFeedbackCorrect(),
newMcContent,
@@ -297,19 +278,8 @@
public void setMcContentId(Long mcContentId) {
this.mcContentId = mcContentId;
}
+
/**
- * @return Returns the disabled.
- */
- public boolean isDisabled() {
- return disabled;
- }
- /**
- * @param disabled The disabled to set.
- */
- public void setDisabled(boolean disabled) {
- this.disabled = disabled;
- }
- /**
* @return Returns the weight.
*/
public Integer getWeight() {
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/pojos/McUsrAttempt.java
===================================================================
diff -u -rc9531327d15636b54f293077ee1cd9f60195381b -rf931ace3d9f38ea25225bd0cd55adfdcb3dfc376
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/pojos/McUsrAttempt.java (.../McUsrAttempt.java) (revision c9531327d15636b54f293077ee1cd9f60195381b)
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/pojos/McUsrAttempt.java (.../McUsrAttempt.java) (revision f931ace3d9f38ea25225bd0cd55adfdcb3dfc376)
@@ -52,6 +52,8 @@
private Integer mark;
+ private Integer totalWeight;
+
private boolean attemptCorrect;
private boolean passed;
@@ -275,4 +277,18 @@
public void setAttemptCorrect(boolean attemptCorrect) {
this.attemptCorrect = attemptCorrect;
}
+
+ /**
+ * @return Returns the totalWeight.
+ */
+ public Integer getTotalWeight() {
+ return totalWeight;
+ }
+ /**
+ * @param totalWeight The totalWeight to set.
+ */
+ public void setTotalWeight(Integer totalWeight) {
+ this.totalWeight = totalWeight;
+ }
+
}
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/IMcService.java
===================================================================
diff -u -rcaa7d3d855db20f8bb1b534ce5dc75a1d28474ea -rf931ace3d9f38ea25225bd0cd55adfdcb3dfc376
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/IMcService.java (.../IMcService.java) (revision caa7d3d855db20f8bb1b534ce5dc75a1d28474ea)
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/IMcService.java (.../IMcService.java) (revision f931ace3d9f38ea25225bd0cd55adfdcb3dfc376)
@@ -159,6 +159,8 @@
public boolean studentActivityOccurredGlobal(McContent mcContent) throws McApplicationException;
+ public List getUserAttemptsForQuestionContentAndSessionUid(final Long queUsrUid, final Long mcQueContentId, final Long mcSessionUid) throws McApplicationException;
+
public int countIncompleteSession(McContent mc) throws McApplicationException;
public boolean studentActivityOccurred(McContent mc) throws McApplicationException;
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/McServicePOJO.java
===================================================================
diff -u -rcaa7d3d855db20f8bb1b534ce5dc75a1d28474ea -rf931ace3d9f38ea25225bd0cd55adfdcb3dfc376
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/McServicePOJO.java (.../McServicePOJO.java) (revision caa7d3d855db20f8bb1b534ce5dc75a1d28474ea)
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/McServicePOJO.java (.../McServicePOJO.java) (revision f931ace3d9f38ea25225bd0cd55adfdcb3dfc376)
@@ -861,6 +861,19 @@
}
}
+ public List getUserAttemptsForQuestionContentAndSessionUid(final Long queUsrUid, final Long mcQueContentId, final Long mcSessionUid)
+ {
+ try
+ {
+ return mcUsrAttemptDAO.getUserAttemptsForQuestionContentAndSessionUid(queUsrUid, mcQueContentId, mcSessionUid);
+ }
+ catch(DataAccessException e)
+ {
+ throw new McApplicationException("Exception occured when lams is getting marks based on userid, sessionid and que content id "
+ + e.getMessage(),e);
+ }
+ }
+
public void deleteMcQueUsr(McQueUsr mcQueUsr) throws McApplicationException
{
try
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/AuthoringUtil.java
===================================================================
diff -u -r66bdcbf0aa30e2806a09754ffb940f2b53126a01 -rf931ace3d9f38ea25225bd0cd55adfdcb3dfc376
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/AuthoringUtil.java (.../AuthoringUtil.java) (revision 66bdcbf0aa30e2806a09754ffb940f2b53126a01)
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/AuthoringUtil.java (.../AuthoringUtil.java) (revision f931ace3d9f38ea25225bd0cd55adfdcb3dfc376)
@@ -1755,7 +1755,6 @@
IMcService mcService =McUtils.getToolService(request);
mcQueContent.setDisplayOrder(new Integer(displayOrder));
- mcQueContent.setDisabled(false);
mcQueContent.setWeight(new Integer(weight));
if ((incorrectFeedback != null) && !(incorrectFeedback.equals("")))
@@ -2212,7 +2211,6 @@
McQueContent mcQueContent= new McQueContent(question,
new Integer(displayOrder),
new Integer(weight),
- false,
incorrectFeedback,
correctFeedback,
mcContent,
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/LearningUtil.java
===================================================================
diff -u -r7e58118a02164b69f28068177656576f32aaeddd -rf931ace3d9f38ea25225bd0cd55adfdcb3dfc376
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/LearningUtil.java (.../LearningUtil.java) (revision 7e58118a02164b69f28068177656576f32aaeddd)
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/LearningUtil.java (.../LearningUtil.java) (revision f931ace3d9f38ea25225bd0cd55adfdcb3dfc376)
@@ -682,6 +682,7 @@
McQueContent mcQueContent=mcService.getQuestionContentByDisplayOrder(questionDisplayOrder, toolContentUID);
logger.debug("mcQueContent: " + mcQueContent);
+
if (mcQueContent != null)
{
createIndividualOptions(request, mapCheckedOptions, mcQueContent, mcQueUsr, attempTime, timeZone, mark, passed, new Integer(highestAttemptOrder), isAttemptCorrect);
@@ -700,6 +701,7 @@
logger.debug("mcQueContent: " + mcQueContent);
logger.debug("mapCheckedOptions: " + mapCheckedOptions);
+
if (mcQueContent != null)
{
if (mapCheckedOptions != null)
@@ -713,8 +715,8 @@
if (mcOptsContent != null)
{
McUsrAttempt mcUsrAttempt=new McUsrAttempt(attempTime, timeZone, mcQueContent, mcQueUsr, mcOptsContent, IntegerMark, passed, highestAttemptOrder, new Boolean(isAttemptCorrect).booleanValue());
- mcService.createMcUsrAttempt(mcUsrAttempt);
- logger.debug("created mcUsrAttempt in the db :" + mcUsrAttempt);
+ mcService.createMcUsrAttempt(mcUsrAttempt);
+ logger.debug("created mcUsrAttempt in the db :" + mcUsrAttempt);
}
}
}
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McAction.java
===================================================================
diff -u -r66bdcbf0aa30e2806a09754ffb940f2b53126a01 -rf931ace3d9f38ea25225bd0cd55adfdcb3dfc376
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McAction.java (.../McAction.java) (revision 66bdcbf0aa30e2806a09754ffb940f2b53126a01)
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McAction.java (.../McAction.java) (revision f931ace3d9f38ea25225bd0cd55adfdcb3dfc376)
@@ -454,6 +454,24 @@
return (mapping.findForward(destination));
}
+
+ public ActionForward editOptions(ActionMapping mapping,
+ ActionForm form,
+ HttpServletRequest request,
+ HttpServletResponse response) throws IOException,
+ ServletException
+ {
+ /* determine whether the request is from Monitoring url Edit Activity*/
+ String sourceMcStarter = (String) request.getAttribute(SOURCE_MC_STARTER);
+ logger.debug("sourceMcStarter: " + sourceMcStarter);
+ String destination=McUtils.getDestination(sourceMcStarter);
+ logger.debug("destination: " + destination);
+
+ boolean performEditOptions=performEditOptions(mapping, form, request, response, false);
+ logger.debug("performEditOptions: " + performEditOptions);
+
+ return (mapping.findForward(destination));
+ }
/**
* prepares the UI so that candidate answers for a question can be edited
@@ -467,14 +485,15 @@
* @param mapping
* @return ActionForward
*/
- public ActionForward editOptions(ActionMapping mapping,
+ public boolean performEditOptions(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
- HttpServletResponse response) throws IOException,
+ HttpServletResponse response, boolean defaultStarter) throws IOException,
ServletException
{
McUtils.cleanUpUserExceptions(request);
- logger.debug("dispatching editOptions...");
+ logger.debug("starting performEditOptions...");
+ logger.debug("defaultStarter:" + defaultStarter);
McUtils.debugMaps(request);
request.getSession().setAttribute(SUBMIT_SUCCESS, new Integer(0));
@@ -495,26 +514,38 @@
mcAuthoringForm.setEditOptionsMode(new Integer(1).toString());
request.getSession().setAttribute(EDIT_OPTIONS_MODE, new Integer(1));
logger.debug("setting EDIT_OPTIONS_MODE to 1");
-
- Map mapQuestionsContent=AuthoringUtil.repopulateMap(request, "questionContent");
+
+ Map mapQuestionsContent= new TreeMap(new McComparator());
+ Map mapWeights= new TreeMap(new McComparator());
+ if (!defaultStarter)
+ {
+ mapQuestionsContent=AuthoringUtil.repopulateMap(request, "questionContent");
+ mapWeights= AuthoringUtil.repopulateMap(request, "questionWeight");
+ }
+ else
+ {
+ mapQuestionsContent= (Map)request.getSession().getAttribute(MAP_QUESTIONS_CONTENT);
+ mapWeights=(Map)request.getSession().getAttribute(MAP_WEIGHTS);
+ }
+ logger.debug("mapWeights: " + mapWeights);
logger.debug("mapQuestionsContent after shrinking: " + mapQuestionsContent);
logger.debug("mapQuestionsContent size after shrinking: " + mapQuestionsContent.size());
-
- Map mapWeights= AuthoringUtil.repopulateMap(request, "questionWeight");
+
logger.debug("MAP_WEIGHTS:" + request.getSession().getAttribute(MAP_WEIGHTS));
String questionIndex =mcAuthoringForm.getQuestionIndex();
logger.debug("questionIndex:" + questionIndex);
+
+ if (defaultStarter)
+ {
+ logger.debug("since the request is from default content set question index to 1:");
+ questionIndex="1";
+ }
+
request.getSession().setAttribute(SELECTED_QUESTION_INDEX, questionIndex);
logger.debug("set SELECTED_QUESTION_INDEX to:" + questionIndex);
- /*presenting incorrect feedback data*/
- //Map mapIncorrectFeedback=(Map)request.getSession().getAttribute(MAP_INCORRECT_FEEDBACK);
- //logger.debug("mapIncorrectFeedback:" + mapIncorrectFeedback);
-
- /*get existing feedback maps*/
-
Long toolContentId=(Long)request.getSession().getAttribute(TOOL_CONTENT_ID);
logger.debug("toolContentId:" + toolContentId);
@@ -524,29 +555,13 @@
Map mapIncorrectFeedback=new TreeMap(new McComparator());
Map mapCorrectFeedback=new TreeMap(new McComparator());
- //if (mcContent == null)
- //{
- logger.debug("getting feedback maps from cache:");
- mapIncorrectFeedback=(Map)request.getSession().getAttribute(MAP_INCORRECT_FEEDBACK);
- logger.debug("mapIncorrectFeedback:" + mapIncorrectFeedback);
- mapCorrectFeedback=(Map)request.getSession().getAttribute(MAP_CORRECT_FEEDBACK);
- logger.debug("mapCorrectFeedback:" + mapCorrectFeedback);
- //}
- /*
- else
- {
- logger.debug("getting feedback maps from db:");
- mapIncorrectFeedback = AuthoringUtil.rebuildIncorrectFeedbackMapfromDB(request, toolContentId);
- logger.debug("existing mapIncorrectFeedback:" + mapIncorrectFeedback);
- request.getSession().setAttribute(MAP_INCORRECT_FEEDBACK, mapIncorrectFeedback);
+ logger.debug("getting feedback maps from cache:");
+ mapIncorrectFeedback=(Map)request.getSession().getAttribute(MAP_INCORRECT_FEEDBACK);
+ logger.debug("mapIncorrectFeedback:" + mapIncorrectFeedback);
+ mapCorrectFeedback=(Map)request.getSession().getAttribute(MAP_CORRECT_FEEDBACK);
+ logger.debug("mapCorrectFeedback:" + mapCorrectFeedback);
- mapCorrectFeedback = AuthoringUtil.rebuildCorrectFeedbackMapfromDB(request, toolContentId);
- logger.debug("existing mapCorrectFeedback:" + mapCorrectFeedback);
- request.getSession().setAttribute(MAP_CORRECT_FEEDBACK, mapCorrectFeedback);
- }
- */
-
if (mapIncorrectFeedback != null)
{
String incorrectFeedback="";
@@ -575,44 +590,48 @@
String editableQuestionEntry=(String)mapQuestionsContent.get(questionIndex);
logger.debug("editableQuestionEntry:" + editableQuestionEntry);
request.getSession().setAttribute(SELECTED_QUESTION, editableQuestionEntry);
-
- if ((editableQuestionEntry == null) || (editableQuestionEntry.equals("")))
- {
- ActionMessages errors= new ActionMessages();
- errors.add(Globals.ERROR_KEY,new ActionMessage("error.emptyQuestion"));
- request.getSession().setAttribute(USER_EXCEPTION_QUESTION_EMPTY, new Boolean(true).toString());
- logger.debug("add error.emptyQuestion to ActionMessages");
- saveErrors(request,errors);
- mcAuthoringForm.resetUserAction();
- logger.debug("return to destination to fix error.");
-
- mcAuthoringForm.setEditOptionsMode(new Integer(0).toString());
- request.getSession().setAttribute(EDIT_OPTIONS_MODE, new Integer(0));
- logger.debug("setting EDIT_OPTIONS_MODE to 0");
-
- McUtils.debugMaps(request);
- return (mapping.findForward(destination));
- }
-
+
String editableQuestionWeight=(String)mapWeights.get(questionIndex);
logger.debug("editableQuestionWeight:" + editableQuestionWeight);
-
- if ((editableQuestionWeight == null) || (editableQuestionWeight.equals("")))
+
+ if (!defaultStarter)
{
- ActionMessages errors= new ActionMessages();
- errors.add(Globals.ERROR_KEY,new ActionMessage("error.emptyWeight"));
- request.getSession().setAttribute(USER_EXCEPTION_WEIGHT_EMPTY, new Boolean(true).toString());
- logger.debug("add error.emptyWeight to ActionMessages");
- saveErrors(request,errors);
- mcAuthoringForm.resetUserAction();
- logger.debug("return to destination to fix error.");
-
- mcAuthoringForm.setEditOptionsMode(new Integer(0).toString());
- request.getSession().setAttribute(EDIT_OPTIONS_MODE, new Integer(0));
- logger.debug("setting EDIT_OPTIONS_MODE to 0");
-
- McUtils.debugMaps(request);
- return (mapping.findForward(destination));
+ logger.debug("since the request is from within the class do the check:");
+ if ((editableQuestionEntry == null) || (editableQuestionEntry.equals("")))
+ {
+ ActionMessages errors= new ActionMessages();
+ errors.add(Globals.ERROR_KEY,new ActionMessage("error.emptyQuestion"));
+ request.getSession().setAttribute(USER_EXCEPTION_QUESTION_EMPTY, new Boolean(true).toString());
+ logger.debug("add error.emptyQuestion to ActionMessages");
+ saveErrors(request,errors);
+ mcAuthoringForm.resetUserAction();
+ logger.debug("return to destination to fix error.");
+
+ mcAuthoringForm.setEditOptionsMode(new Integer(0).toString());
+ request.getSession().setAttribute(EDIT_OPTIONS_MODE, new Integer(0));
+ logger.debug("setting EDIT_OPTIONS_MODE to 0");
+
+ McUtils.debugMaps(request);
+ return false;
+ }
+
+ if ((editableQuestionWeight == null) || (editableQuestionWeight.equals("")))
+ {
+ ActionMessages errors= new ActionMessages();
+ errors.add(Globals.ERROR_KEY,new ActionMessage("error.emptyWeight"));
+ request.getSession().setAttribute(USER_EXCEPTION_WEIGHT_EMPTY, new Boolean(true).toString());
+ logger.debug("add error.emptyWeight to ActionMessages");
+ saveErrors(request,errors);
+ mcAuthoringForm.resetUserAction();
+ logger.debug("return to destination to fix error.");
+
+ mcAuthoringForm.setEditOptionsMode(new Integer(0).toString());
+ request.getSession().setAttribute(EDIT_OPTIONS_MODE, new Integer(0));
+ logger.debug("setting EDIT_OPTIONS_MODE to 0");
+
+ McUtils.debugMaps(request);
+ return false;
+ }
}
/*persist valid question and weights maps into session*/
@@ -721,7 +740,7 @@
logger.debug("MAP_OPTIONS_CONTENT reconstructed from db" );
- /* we have to assume that some of the optons are selected as this is forced in the ui.
+ /* we have to assume that some of the options are selected as this is forced in the ui.
* retrieve and present the selected options from the db
* */
List listSelectedOptions=mcService.getPersistedSelectedOptions(mcQueContent.getUid());
@@ -811,6 +830,7 @@
request.getSession().setAttribute(MAP_OPTIONS_CONTENT, mapOptionsContent);
logger.debug("MAP_OPTIONS_CONTENT reconstructed from default option content" );
+ mapSelectedOptions.put("1",DEFAULT_SELECTED_OPTION);
request.getSession().setAttribute(MAP_SELECTED_OPTIONS, mapSelectedOptions);
logger.debug("MAP_SELECTED_OPTIONS set as empty list :" + mapSelectedOptions);
}
@@ -857,7 +877,7 @@
McUtils.debugMaps(request);
logger.debug("final EDIT_OPTIONS_MODE: " + request.getSession().getAttribute(EDIT_OPTIONS_MODE));
- return (mapping.findForward(destination));
+ return true;
}
@@ -1391,6 +1411,24 @@
return (mapping.findForward(destination));
}
+ public ActionForward doneOptions(ActionMapping mapping,
+ ActionForm form,
+ HttpServletRequest request,
+ HttpServletResponse response) throws IOException,
+ ServletException
+ {
+ logger.debug("dispatching doneOptions...");
+ /* determine whether the request is from Monitoring url Edit Activity*/
+ String sourceMcStarter = (String) request.getAttribute(SOURCE_MC_STARTER);
+ logger.debug("sourceMcStarter: " + sourceMcStarter);
+ String destination=McUtils.getDestination(sourceMcStarter);
+ logger.debug("destination: " + destination);
+
+ boolean performDoneOptions=performDoneOptions(mapping, form, request, response, false);
+ logger.debug("performDoneOptions: " + performDoneOptions);
+
+ return (mapping.findForward(destination));
+ }
/**
* completes the candidate options screen
@@ -1404,14 +1442,15 @@
* @param mapping
* @return ActionForward
*/
- public ActionForward doneOptions(ActionMapping mapping,
+ public boolean performDoneOptions(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
- HttpServletResponse response) throws IOException,
+ HttpServletResponse response, boolean defaultStarter) throws IOException,
ServletException
{
+ logger.debug("starting doneOptions...");
+ logger.debug("using defaultStarter: " + defaultStarter);
McUtils.cleanUpUserExceptions(request);
- logger.debug("dispatching doneOptions...");
request.getSession().setAttribute(SUBMIT_SUCCESS, new Integer(0));
McUtils.debugMaps(request);
@@ -1429,58 +1468,76 @@
mcAuthoringForm.setEditOptionsMode(new Integer(0).toString());
request.getSession().setAttribute(EDIT_OPTIONS_MODE, new Integer(0));
logger.debug("setting EDIT_OPTIONS_MODE to 0");
-
- boolean validateOptions=AuthoringUtil.validateOptions(request);
- logger.debug("validateOptions:" + validateOptions);
-
- if (validateOptions == false)
- {
- ActionMessages errors= new ActionMessages();
- request.getSession().setAttribute(USER_EXCEPTION_CHKBOXES_EMPTY, new Boolean(true).toString());
- errors.add(Globals.ERROR_KEY,new ActionMessage("error.checkBoxes.empty"));
- logger.debug("add error.checkBoxes.empty to ActionMessages");
- saveErrors(request,errors);
- mcAuthoringForm.resetUserAction();
- logger.debug("return to destination to fix error.");
-
- mcAuthoringForm.setEditOptionsMode(new Integer(1).toString());
- request.getSession().setAttribute(EDIT_OPTIONS_MODE, new Integer(1));
- logger.debug("setting EDIT_OPTIONS_MODE to 1");
-
- McUtils.debugMaps(request);
- return (mapping.findForward(destination));
- }
-
- Map mapOptionsContent=AuthoringUtil.repopulateMap(request, "optionContent");
- logger.debug("mapOptionsContent after shrinking: " + mapOptionsContent);
+
+ Map mapOptionsContent= new TreeMap(new McStringComparator());
+ if (!defaultStarter)
+ {
+ mapOptionsContent=AuthoringUtil.repopulateMap(request, "optionContent");
+ logger.debug("mapOptionsContent after shrinking: " + mapOptionsContent);
+
+ logger.debug("since defaultStarter is false the call is from within the class, do the checks");
+ boolean validateOptions=AuthoringUtil.validateOptions(request);
+ logger.debug("validateOptions:" + validateOptions);
+
+ if (validateOptions == false)
+ {
+ ActionMessages errors= new ActionMessages();
+ request.getSession().setAttribute(USER_EXCEPTION_CHKBOXES_EMPTY, new Boolean(true).toString());
+ errors.add(Globals.ERROR_KEY,new ActionMessage("error.checkBoxes.empty"));
+ logger.debug("add error.checkBoxes.empty to ActionMessages");
+ saveErrors(request,errors);
+ mcAuthoringForm.resetUserAction();
+ logger.debug("return to destination to fix error.");
+
+ mcAuthoringForm.setEditOptionsMode(new Integer(1).toString());
+ request.getSession().setAttribute(EDIT_OPTIONS_MODE, new Integer(1));
+ logger.debug("setting EDIT_OPTIONS_MODE to 1");
+
+ McUtils.debugMaps(request);
+ return false;
+ }
+
+
+ if (mapOptionsContent.size() == 1)
+ {
+ logger.debug("mapOptionsContent size is 1)");
+ ActionMessages errors= new ActionMessages();
+ request.getSession().setAttribute(USER_EXCEPTION_SINGLE_OPTION, new Boolean(true).toString());
+ errors.add(Globals.ERROR_KEY,new ActionMessage("error.singleOption"));
+ logger.debug("add error.singleOption to ActionMessages");
+ saveErrors(request,errors);
+ mcAuthoringForm.resetUserAction();
+ logger.debug("return to destination to fix error.");
+
+ mcAuthoringForm.setEditOptionsMode(new Integer(1).toString());
+ request.getSession().setAttribute(EDIT_OPTIONS_MODE, new Integer(1));
+ logger.debug("setting EDIT_OPTIONS_MODE to 1");
+
+ McUtils.debugMaps(request);
+ return false;
+ }
+ }//end of checks
+ else
+ {
+ mapOptionsContent=(Map)request.getSession().getAttribute(MAP_OPTIONS_CONTENT);
+ logger.debug("mapOptionsContent: " + mapOptionsContent);
+
+ }
- if (mapOptionsContent.size() == 1)
- {
- logger.debug("mapOptionsContent size is 1)");
- ActionMessages errors= new ActionMessages();
- request.getSession().setAttribute(USER_EXCEPTION_SINGLE_OPTION, new Boolean(true).toString());
- errors.add(Globals.ERROR_KEY,new ActionMessage("error.singleOption"));
- logger.debug("add error.singleOption to ActionMessages");
- saveErrors(request,errors);
- mcAuthoringForm.resetUserAction();
- logger.debug("return to destination to fix error.");
-
- mcAuthoringForm.setEditOptionsMode(new Integer(1).toString());
- request.getSession().setAttribute(EDIT_OPTIONS_MODE, new Integer(1));
- logger.debug("setting EDIT_OPTIONS_MODE to 1");
-
- McUtils.debugMaps(request);
- return (mapping.findForward(destination));
- }
-
-
request.getSession().setAttribute(MAP_OPTIONS_CONTENT, mapOptionsContent);
logger.debug("final done MAP_OPTIONS_CONTENT: " + mapOptionsContent);
String selectedQuestionIndex=(String) request.getSession().getAttribute(SELECTED_QUESTION_INDEX);
logger.debug("retrieved SELECTED_QUESTION_INDEX to:" + selectedQuestionIndex);
+ if (defaultStarter)
+ {
+ logger.debug("since the request is from default content set question index to 1:");
+ selectedQuestionIndex="1";
+ }
+
+
/** update the questions Map with the new question*/
Map mapQuestionsContent=(Map) request.getSession().getAttribute(MAP_QUESTIONS_CONTENT);
logger.debug("mapQuestionsContent: " + mapQuestionsContent);
@@ -1491,11 +1548,17 @@
request.getSession().setAttribute(MAP_QUESTIONS_CONTENT, mapQuestionsContent);
logger.debug("updated MAP_QUESTIONS_CONTENT:" + mapQuestionsContent);
-
- Map mapSelectedOptions= (Map) request.getSession().getAttribute(MAP_SELECTED_OPTIONS);
- mapSelectedOptions.clear();
- mapSelectedOptions = AuthoringUtil.repopulateCurrentCheckBoxStatesMap(request);
- logger.debug("after add mapSelectedOptions: " + mapSelectedOptions);
+ Map mapSelectedOptions= new TreeMap(new McComparator());
+ if (defaultStarter)
+ {
+ logger.debug("defaultStarter is on, getting MAP_SELECTED_OPTIONS from session: ");
+ mapSelectedOptions= (Map) request.getSession().getAttribute(MAP_SELECTED_OPTIONS);
+ }
+ else
+ {
+ mapSelectedOptions = AuthoringUtil.repopulateCurrentCheckBoxStatesMap(request);
+ logger.debug("after add mapSelectedOptions: " + mapSelectedOptions);
+ }
request.getSession().setAttribute(MAP_SELECTED_OPTIONS, mapSelectedOptions);
Map mapGeneralSelectedOptionsContent=(Map)request.getSession().getAttribute(MAP_GENERAL_SELECTED_OPTIONS_CONTENT);
@@ -1505,8 +1568,6 @@
logger.debug("updated MAP_GENERAL_SELECTED_OPTIONS_CONTENT after add: " + mapGeneralSelectedOptionsContent);
-
- /*new code*/
Map mapIncorrectFeedback=(Map)request.getSession().getAttribute(MAP_INCORRECT_FEEDBACK);
logger.debug("mapIncorrectFeedback:" + mapIncorrectFeedback);
@@ -1560,7 +1621,7 @@
McUtils.debugMaps(request);
logger.debug("final EDIT_OPTIONS_MODE: " + request.getSession().getAttribute(EDIT_OPTIONS_MODE));
- return (mapping.findForward(destination));
+ return true;
}
@@ -2119,8 +2180,8 @@
McUtils.debugMaps(request);
- //because button (and javascript) will display in LamsTag tab, so put it into session instead of request
- //it will be remove immediately in clearSessionAction.
+ /*because button (and javascript) will display in LamsTag tab, so put it into session instead of request
+ it will be remove immediately in clearSessionAction.*/
request.getSession().setAttribute(AuthoringConstants.LAMS_AUTHORING_SUCCESS_FLAG,Boolean.TRUE);
logger.debug("final EDIT_OPTIONS_MODE: " + request.getSession().getAttribute(EDIT_OPTIONS_MODE));
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McLearningAction.java
===================================================================
diff -u -r29f3aacca489abf02e7d05620daf773e0af9776d -rf931ace3d9f38ea25225bd0cd55adfdcb3dfc376
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McLearningAction.java (.../McLearningAction.java) (revision 29f3aacca489abf02e7d05620daf773e0af9776d)
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McLearningAction.java (.../McLearningAction.java) (revision f931ace3d9f38ea25225bd0cd55adfdcb3dfc376)
@@ -383,16 +383,19 @@
Long toolContentId=(Long) request.getSession().getAttribute(TOOL_CONTENT_ID);
logger.debug("toolContentId: " + toolContentId);
+
+ McContent mcContent=mcService.retrieveMc(toolContentId);
+ logger.debug("mcContent: " + mcContent);
logger.debug("will assess");
Integer passMark=(Integer) request.getSession().getAttribute(PASSMARK);
logger.debug("passMark: " + passMark);
- Map mapLeanerAssessmentResults=LearningUtil.assess(request, mapGeneralCheckedOptionsContent, toolContentId);
- logger.debug("mapLeanerAssessmentResults: " + mapLeanerAssessmentResults);
+ Map mapLearnerAssessmentResults=LearningUtil.assess(request, mapGeneralCheckedOptionsContent, toolContentId);
+ logger.debug("mapLearnerAssessmentResults: " + mapLearnerAssessmentResults);
logger.debug("assesment complete");
- int mark=LearningUtil.getMark(mapLeanerAssessmentResults);
+ int mark=LearningUtil.getMark(mapLearnerAssessmentResults);
logger.debug("mark: " + mark);
request.getSession().setAttribute(LEARNER_MARK, new Integer(mark).toString());
@@ -405,7 +408,7 @@
if ((passMark != null))
{
mcLearningForm.setPassMarkApplicable(new Boolean(true).toString());
- int totalUserWeight=LearningUtil.calculateWeights(mapLeanerAssessmentResults, mapQuestionWeights);
+ int totalUserWeight=LearningUtil.calculateWeights(mapLearnerAssessmentResults, mapQuestionWeights);
logger.debug("totalUserWeight: " + totalUserWeight);
if (totalUserWeight < passMark.intValue())
@@ -421,12 +424,20 @@
mcLearningForm.setUserOverPassMark(new Boolean(true).toString());
}
}
+
if (passMark == null)
{
mcLearningForm.setPassMarkApplicable(new Boolean(false).toString());
}
+ /*
+ if (!mcContent.isRetries())
+ {
+ logger.debug("content is not isRetries. set passed to true");
+ passed=true;
+ }
+ */
Long toolSessionId=(Long)request.getSession().getAttribute(TOOL_SESSION_ID);
logger.debug("toolSessionId: " + toolSessionId);
@@ -470,7 +481,7 @@
highestAttemptOrder="0";
logger.debug("passed: " + passed);
- LearningUtil.createAttempt(request, mcQueUsr, mapGeneralCheckedOptionsContent, mark, passed, new Integer(highestAttemptOrder).intValue(), mapLeanerAssessmentResults);
+ LearningUtil.createAttempt(request, mcQueUsr, mapGeneralCheckedOptionsContent, mark, passed, new Integer(highestAttemptOrder).intValue(), mapLearnerAssessmentResults);
logger.debug("created user attempt in the db");
int intHighestAttemptOrder=new Integer(highestAttemptOrder).intValue()+ 1 ;
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McMonitoringStarterAction.java
===================================================================
diff -u -r66bdcbf0aa30e2806a09754ffb940f2b53126a01 -rf931ace3d9f38ea25225bd0cd55adfdcb3dfc376
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McMonitoringStarterAction.java (.../McMonitoringStarterAction.java) (revision 66bdcbf0aa30e2806a09754ffb940f2b53126a01)
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McMonitoringStarterAction.java (.../McMonitoringStarterAction.java) (revision f931ace3d9f38ea25225bd0cd55adfdcb3dfc376)
@@ -345,9 +345,9 @@
logger.debug("CURRENT_MONITORED_TOOL_SESSION: " + request.getSession().getAttribute(CURRENT_MONITORED_TOOL_SESSION));
List listMonitoredAnswersContainerDTO=MonitoringUtil.buildGroupsQuestionData(request, mcContent);
-
request.getSession().setAttribute(LIST_MONITORED_ANSWERS_CONTAINER_DTO, listMonitoredAnswersContainerDTO);
logger.debug("LIST_MONITORED_ANSWERS_CONTAINER_DTO: " + request.getSession().getAttribute(LIST_MONITORED_ANSWERS_CONTAINER_DTO));
+
/* ends here*/
/* this section is related to instructions tab. Starts here. */
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McStarterAction.java
===================================================================
diff -u -r1dff7467ea5dbd5ca46d957a89ce42b1eb8b64c1 -rf931ace3d9f38ea25225bd0cd55adfdcb3dfc376
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McStarterAction.java (.../McStarterAction.java) (revision 1dff7467ea5dbd5ca46d957a89ce42b1eb8b64c1)
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McStarterAction.java (.../McStarterAction.java) (revision f931ace3d9f38ea25225bd0cd55adfdcb3dfc376)
@@ -153,7 +153,6 @@
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;
import org.apache.struts.action.ActionMessages;
-import org.lamsfoundation.lams.tool.exception.ToolException;
import org.lamsfoundation.lams.tool.mc.McAppConstants;
import org.lamsfoundation.lams.tool.mc.McApplicationException;
import org.lamsfoundation.lams.tool.mc.McComparator;
@@ -283,99 +282,6 @@
return (mapping.findForward(ERROR_LIST));
}
-
- /* note: copyToolContent and removeToolContent code is redundant for production.
- * test whether the authoring level tool contract:
- public void copyToolContent(Long fromContentId, Long toContentId) throws ToolException;
- * is working or not
- *
- * test code starts from here...
- */
- String copyToolContent= (String) request.getParameter(COPY_TOOL_CONTENT);
- logger.debug("copyToolContent: " + copyToolContent);
-
- if ((copyToolContent != null) && (copyToolContent.equals("1")))
- {
- logger.debug("user request to copy the content");
- Long fromContentId=new Long(strToolContentId);
- logger.debug("fromContentId: " + fromContentId);
-
- Long toContentId=new Long(9876);
- logger.debug("toContentId: " + toContentId);
-
- try
- {
- mcService.copyToolContent(fromContentId, toContentId);
- }
- catch(ToolException e)
- {
- McUtils.cleanUpSessionAbsolute(request);
- logger.debug("error copying the content: " + e);
- }
- }
-
- String removeToolContent= (String) request.getParameter(REMOVE_TOOL_CONTENT);
- logger.debug("removeToolContent: " + removeToolContent);
-
- if ((removeToolContent != null) && (removeToolContent.equals("1")))
- {
- logger.debug("user request to remove the content");
- Long fromContentId=new Long(strToolContentId);
- logger.debug("fromContentId: " + fromContentId);
-
- try
- {
- mcService.removeToolContent(fromContentId, true);
- }
- catch(ToolException e)
- {
- McUtils.cleanUpSessionAbsolute(request);
- logger.debug("error removing the content: " + e);
- }
- }
-
- String setDefineLater= (String) request.getParameter("setDefineLater");
- logger.debug("setDefineLater: " + setDefineLater);
-
- if ((setDefineLater != null) && (setDefineLater.equals("1")))
- {
- logger.debug("user request to set content as define later");
- Long fromContentId=new Long(strToolContentId);
- logger.debug("fromContentId: " + fromContentId);
-
- try
- {
- mcService.setAsDefineLater(fromContentId);
- }
- catch(ToolException e)
- {
- McUtils.cleanUpSessionAbsolute(request);
- logger.debug("error setting the define later on the content: " + e);
- }
- }
-
-
- String strSetRunoffline= (String) request.getParameter("strSetRunoffline");
- logger.debug("strSetRunoffline: " + strSetRunoffline);
-
- if ((setDefineLater != null) && (setDefineLater.equals("1")))
- {
- logger.debug("user request to set content as run offline");
- Long fromContentId=new Long(strToolContentId);
- logger.debug("fromContentId: " + fromContentId);
-
- try
- {
- mcService.setAsRunOffline(fromContentId);
- }
- catch(ToolException e)
- {
- McUtils.cleanUpSessionAbsolute(request);
- logger.debug("error setting the run offline on the content: " + e);
- }
- }
- /* ...testing code ends here*/
-
/*
* find out if the passed tool content id exists in the db
* present user either a first timer screen with default content data or fetch the existing content.
@@ -389,6 +295,11 @@
{
logger.debug("retrieving default content");
retrieveDefaultContent(request, mcAuthoringForm);
+ McAction mcAction= new McAction();
+ boolean performEditOptions=mcAction.performEditOptions(mapping, form, request, response, true);
+ logger.debug("performEditOptions: " + performEditOptions);
+ boolean performDoneOptions=mcAction.performDoneOptions(mapping, form, request, response, true);
+ logger.debug("performDoneOptions: " + performDoneOptions);
}
else
{
@@ -793,13 +704,8 @@
logger.debug("starter initialized the Default Options Map: " + request.getSession().getAttribute(MAP_DEFAULTOPTIONS_CONTENT));
Map mapWeights= new TreeMap(new McComparator());
- /* reset all the weights to 0*/
- long mapCounter=0;
- for (long i=1; i <= MAX_QUESTION_COUNT ; i++)
- {
- mapCounter++;
- mapWeights.put(new Long(mapCounter).toString(), new Integer(0));
- }
+ long mapCounter=1;
+ mapWeights.put(new Long(mapCounter).toString(), new Integer(100).toString());
request.getSession().setAttribute(MAP_WEIGHTS, mapWeights);
logger.debug("MAP_WEIGHTS:" + request.getSession().getAttribute(MAP_WEIGHTS));
}
@@ -856,6 +762,7 @@
request.getSession().setAttribute(MAP_CHECKBOX_STATES, mapCheckBoxStates);
Map mapSelectedOptions= new TreeMap(new McComparator());
+ mapSelectedOptions.put("1",DEFAULT_SELECTED_OPTION);
request.getSession().setAttribute(MAP_SELECTED_OPTIONS, mapSelectedOptions);
Map mapIncorrectFeedback= new TreeMap(new McComparator());
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/MonitoringUtil.java
===================================================================
diff -u -rcaa7d3d855db20f8bb1b534ce5dc75a1d28474ea -rf931ace3d9f38ea25225bd0cd55adfdcb3dfc376
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/MonitoringUtil.java (.../MonitoringUtil.java) (revision caa7d3d855db20f8bb1b534ce5dc75a1d28474ea)
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/MonitoringUtil.java (.../MonitoringUtil.java) (revision f931ace3d9f38ea25225bd0cd55adfdcb3dfc376)
@@ -105,7 +105,7 @@
logger.debug("listQuestions:..." + listQuestions);
List listMonitoredAnswersContainerDTO= new LinkedList();
-
+
Iterator itListQuestions = listQuestions.iterator();
while (itListQuestions.hasNext())
{
@@ -127,8 +127,7 @@
logger.debug("listCandidateAnswersDTO:..." + listCandidateAnswersDTO);
mcMonitoredAnswersDTO.setCandidateAnswersCorrect(listCandidateAnswersDTO);
-
- Map questionAttemptData= buildGroupsAttemptData(request, mcContent, mcQueContent, mcQueContent.getUid().toString());
+ Map questionAttemptData= buildGroupsAttemptData(request, mcContent, mcQueContent, mcQueContent.getUid().toString(), mcService);
logger.debug("questionAttemptData:..." + questionAttemptData);
mcMonitoredAnswersDTO.setQuestionAttempts(questionAttemptData);
listMonitoredAnswersContainerDTO.add(mcMonitoredAnswersDTO);
@@ -138,8 +137,9 @@
logger.debug("final listMonitoredAnswersContainerDTO:..." + listMonitoredAnswersContainerDTO);
return listMonitoredAnswersContainerDTO;
}
-
+
+
public static List buildSessionQuestionData(HttpServletRequest request, McContent mcContent, Long sessionId, Long userID)
{
logger.debug("doing buildSessionQuestionData with sessionId: " + sessionId);
@@ -189,10 +189,9 @@
* @param mcQueContent
* @return Map
*/
- public static Map buildGroupsAttemptData(HttpServletRequest request, McContent mcContent, McQueContent mcQueContent, String questionUid)
+ public static Map buildGroupsAttemptData(HttpServletRequest request, McContent mcContent, McQueContent mcQueContent, String questionUid, IMcService mcService)
{
logger.debug("will be building groups attempt data for mcQueContent:..." + mcQueContent + " questionUid:" + questionUid);
- IMcService mcService =McUtils.getToolService(request);
Map mapMonitoredAttemptsContainerDTO= new TreeMap(new McStringComparator());
List listMonitoredAttemptsContainerDTO= new LinkedList();
@@ -214,8 +213,10 @@
{
List listMcUsers=mcService.getMcUserBySessionOnly(mcSession);
logger.debug("listMcUsers for session id:" + mcSession.getMcSessionId() + " = " + listMcUsers);
- Map sessionUsersAttempts=populateSessionUsersAttempts(request,mcSession.getMcSessionId(), listMcUsers, questionUid, null);
+ Map sessionUsersAttempts=populateSessionUsersAttempts(request,mcSession.getMcSessionId(), listMcUsers, questionUid, null, mcService);
+ Map sessionUsersMarks=populateSessionUsersMarks(request,mcSession.getMcSessionId(), listMcUsers, questionUid, null, mcService);
+
listMonitoredAttemptsContainerDTO.add(sessionUsersAttempts);
}
}
@@ -244,7 +245,7 @@
{
List listMcUsers=mcService.getMcUserBySessionOnly(mcSession);
logger.debug("listMcUsers for session id:" + mcSession.getMcSessionId() + " = " + listMcUsers);
- Map sessionUsersAttempts=populateSessionUsersAttempts(request,mcSession.getMcSessionId(), listMcUsers, questionUid, userID);
+ Map sessionUsersAttempts=populateSessionUsersAttempts(request,mcSession.getMcSessionId(), listMcUsers, questionUid, userID, mcService);
listMonitoredAttemptsContainerDTO.add(sessionUsersAttempts);
logger.debug("final listMonitoredAttemptsContainerDTO:..." + listMonitoredAttemptsContainerDTO);
@@ -279,18 +280,20 @@
* @param listMcUsers
* @return List
*/
- public static Map populateSessionUsersAttempts(HttpServletRequest request,Long sessionId, List listMcUsers, String questionUid, Long userID)
+ public static Map populateSessionUsersAttempts(HttpServletRequest request,Long sessionId, List listMcUsers, String questionUid, Long userID, IMcService mcService)
{
logger.debug("will be populating users attempt history for session id: " + sessionId);
- logger.debug("userID: " + userID);
- IMcService mcService =McUtils.getToolService(request);
-
+ McSession mcSession=mcService.retrieveMcSession(sessionId);
+ logger.debug("retrieving mcSession: " + mcSession);
+
+ logger.debug("userID: " + userID);
Map mapMonitoredUserContainerDTO= new TreeMap(new McStringComparator());
List listMonitoredUserContainerDTO= new LinkedList();
if (userID == null)
{
+ logger.debug("generating standard summary page");
Iterator itUsers=listMcUsers.iterator();
while (itUsers.hasNext())
{
@@ -300,10 +303,107 @@
if (mcQueUsr != null)
{
logger.debug("getting listUserAttempts for user id: " + mcQueUsr.getUid() + " and que content id: " + questionUid);
- List listUserAttempts=mcService.getAttemptsForUserAndQuestionContent(mcQueUsr.getUid(), new Long(questionUid));
+ List listUserAttempts=mcService.getUserAttemptsForQuestionContentAndSessionUid(mcQueUsr.getUid(), new Long(questionUid), mcSession.getUid());
logger.debug("listUserAttempts: " + listUserAttempts);
Iterator itAttempts=listUserAttempts.iterator();
+
+ if (!mcSession.getMcContent().isRetries())
+ {
+ logger.debug("retries is OFF.");
+ boolean attemptCorrect=false;
+ McUsrAttempt mcUsrAttemptUser=null;
+
+ while (itAttempts.hasNext())
+ {
+ McUsrAttempt mcUsrAttempt=(McUsrAttempt)itAttempts.next();
+ logger.debug("mcUsrAttempt: " + mcUsrAttempt);
+ mcUsrAttemptUser=mcUsrAttempt;
+
+ if (mcUsrAttempt != null)
+ {
+ if (mcUsrAttempt.isAttemptCorrect())
+ {
+ attemptCorrect=true;
+ }
+ }
+ }
+ logger.debug("final attemptCorrect: " + attemptCorrect);
+ McMonitoredUserDTO mcMonitoredUserDTO = new McMonitoredUserDTO();
+ int extraWeight=0;
+ if (attemptCorrect)
+ {
+ mcMonitoredUserDTO.setMark(mcUsrAttemptUser.getMcQueContent().getWeight().toString());
+ extraWeight=mcUsrAttemptUser.getMcQueContent().getWeight().intValue();
+ }
+ else
+ {
+ mcMonitoredUserDTO.setMark("0");
+ extraWeight=0;
+ }
+
+ /*
+ logger.debug("start updating user's weight records with extraWeight: " + extraWeight);
+ Iterator itAttemptsLocal=listUserAttempts.iterator();
+ while (itAttemptsLocal.hasNext())
+ {
+ McUsrAttempt mcUsrAttempt=(McUsrAttempt)itAttemptsLocal.next();
+ logger.debug("mcUsrAttempt: " + mcUsrAttempt);
+
+ int currentTotalWeight =mcUsrAttempt.getTotalWeight().intValue();
+ mcUsrAttempt.setTotalWeight(new Integer(currentTotalWeight + extraWeight));
+ logger.debug("updated total user weight to: " + mcUsrAttempt.getTotalWeight());
+ mcService.updateMcUsrAttempt(mcUsrAttempt);
+ }
+ */
+
+ mcMonitoredUserDTO.setUid(mcUsrAttemptUser.getUid().toString());
+ mcMonitoredUserDTO.setUserName(mcQueUsr.getFullname());
+ mcMonitoredUserDTO.setSessionId(sessionId.toString());
+ mcMonitoredUserDTO.setQuestionUid(questionUid);
+
+ logger.debug("final constructed mcMonitoredUserDTO: " + mcMonitoredUserDTO);
+ listMonitoredUserContainerDTO.add(mcMonitoredUserDTO);
+ }
+ else
+ {
+ logger.debug("retries is ON. User had to PASS. Print the final attempt's data");
+ McUsrAttempt mcUsrAttempt=getAttemptWithHighestOrder(listUserAttempts);
+ logger.debug("attempt with highest attempt order, mcUsrAttempt: " + mcUsrAttempt);
+
+ McMonitoredUserDTO mcMonitoredUserDTO = new McMonitoredUserDTO();
+ mcMonitoredUserDTO.setMark(mcUsrAttempt.getMcQueContent().getWeight().toString());
+ mcMonitoredUserDTO.setUserName(mcQueUsr.getFullname());
+
+ logger.debug("final constructed mcMonitoredUserDTO: " + mcMonitoredUserDTO);
+ listMonitoredUserContainerDTO.add(mcMonitoredUserDTO);
+ }
+ }
+ }
+ logger.debug("final listMonitoredUserContainerDTO: " + listMonitoredUserContainerDTO);
+ mapMonitoredUserContainerDTO=convertToMcMonitoredUserDTOMap(listMonitoredUserContainerDTO);
+ logger.debug("final mapMonitoredUserContainerDTO:..." + mapMonitoredUserContainerDTO);
+ return mapMonitoredUserContainerDTO;
+ }
+ else
+ {
+ logger.debug("request is for learner export portfolio: " + userID);
+ Iterator itUsers=listMcUsers.iterator();
+ while (itUsers.hasNext())
+ {
+ McQueUsr mcQueUsr=(McQueUsr)itUsers.next();
+ logger.debug("mcQueUsr: " + mcQueUsr);
+ logger.debug("local mcQueUsr userID: " + mcQueUsr.getQueUsrId());
+ logger.debug("mcQueUsr.getQueUsrId().toString versus userID.toString(): " + mcQueUsr.getQueUsrId().toString() + " versus " + userID.toString());
+ if ((mcQueUsr != null) && (mcQueUsr.getQueUsrId().toString().equals(userID.toString())))
+ {
+ logger.debug("the user in question is found: " + mcQueUsr.getQueUsrId());
+ logger.debug("getting listUserAttempts for user id: " + mcQueUsr.getUid() + " and que content id: " + questionUid);
+ //List listUserAttempts=mcService.getAttemptsForUserAndQuestionContent(mcQueUsr.getUid(), new Long(questionUid));
+ List listUserAttempts=mcService.getUserAttemptsForQuestionContentAndSessionUid(mcQueUsr.getUid(), new Long(questionUid), mcSession.getUid());
+ logger.debug("listUserAttempts: " + listUserAttempts);
+
+ Iterator itAttempts=listUserAttempts.iterator();
while (itAttempts.hasNext())
{
McUsrAttempt mcUsrAttempt=(McUsrAttempt)itAttempts.next();
@@ -329,6 +429,116 @@
logger.debug("final listMonitoredUserContainerDTO: " + listMonitoredUserContainerDTO);
mapMonitoredUserContainerDTO=convertToMcMonitoredUserDTOMap(listMonitoredUserContainerDTO);
logger.debug("final mapMonitoredUserContainerDTO:..." + mapMonitoredUserContainerDTO);
+ return mapMonitoredUserContainerDTO;
+
+ }
+
+ }
+
+
+ public static Map populateSessionUsersMarks(HttpServletRequest request,Long sessionId, List listMcUsers, String questionUid, Long userID, IMcService mcService)
+ {
+ logger.debug("will be populating users marks for session id: " + sessionId);
+
+ McSession mcSession=mcService.retrieveMcSession(sessionId);
+ logger.debug("retrieving mcSession: " + mcSession);
+
+ logger.debug("userID: " + userID);
+ Map mapMonitoredUserContainerDTO= new TreeMap(new McStringComparator());
+ List listMonitoredUserContainerDTO= new LinkedList();
+
+ if (userID == null)
+ {
+ logger.debug("generating standard summary page");
+ Iterator itUsers=listMcUsers.iterator();
+ while (itUsers.hasNext())
+ {
+ McQueUsr mcQueUsr=(McQueUsr)itUsers.next();
+ logger.debug("mcQueUsr: " + mcQueUsr);
+
+ if (mcQueUsr != null)
+ {
+ logger.debug("getting listUserAttempts for user id: " + mcQueUsr.getUid() + " and que content id: " + questionUid);
+ List listUserAttempts=mcService.getUserAttemptsForQuestionContentAndSessionUid(mcQueUsr.getUid(), new Long(questionUid), mcSession.getUid());
+ logger.debug("listUserAttempts: " + listUserAttempts);
+
+ Iterator itAttempts=listUserAttempts.iterator();
+
+ if (!mcSession.getMcContent().isRetries())
+ {
+ logger.debug("retries is OFF.");
+ boolean attemptCorrect=false;
+ McUsrAttempt mcUsrAttemptUser=null;
+
+ while (itAttempts.hasNext())
+ {
+ McUsrAttempt mcUsrAttempt=(McUsrAttempt)itAttempts.next();
+ logger.debug("mcUsrAttempt: " + mcUsrAttempt);
+ mcUsrAttemptUser=mcUsrAttempt;
+
+ if (mcUsrAttempt != null)
+ {
+ if (mcUsrAttempt.isAttemptCorrect())
+ {
+ attemptCorrect=true;
+ }
+ }
+ }
+ logger.debug("final attemptCorrect: " + attemptCorrect);
+ McMonitoredUserDTO mcMonitoredUserDTO = new McMonitoredUserDTO();
+ int extraWeight=0;
+ if (attemptCorrect)
+ {
+ mcMonitoredUserDTO.setMark(mcUsrAttemptUser.getMcQueContent().getWeight().toString());
+ extraWeight=mcUsrAttemptUser.getMcQueContent().getWeight().intValue();
+ }
+ else
+ {
+ mcMonitoredUserDTO.setMark("0");
+ extraWeight=0;
+ }
+
+ /*
+ logger.debug("start updating user's weight records with extraWeight: " + extraWeight);
+ Iterator itAttemptsLocal=listUserAttempts.iterator();
+ while (itAttemptsLocal.hasNext())
+ {
+ McUsrAttempt mcUsrAttempt=(McUsrAttempt)itAttemptsLocal.next();
+ logger.debug("mcUsrAttempt: " + mcUsrAttempt);
+
+ int currentTotalWeight =mcUsrAttempt.getTotalWeight().intValue();
+ mcUsrAttempt.setTotalWeight(new Integer(currentTotalWeight + extraWeight));
+ logger.debug("updated total user weight to: " + mcUsrAttempt.getTotalWeight());
+ mcService.updateMcUsrAttempt(mcUsrAttempt);
+ }
+ */
+
+ mcMonitoredUserDTO.setUid(mcUsrAttemptUser.getUid().toString());
+ mcMonitoredUserDTO.setUserName(mcQueUsr.getFullname());
+ mcMonitoredUserDTO.setSessionId(sessionId.toString());
+ mcMonitoredUserDTO.setQuestionUid(questionUid);
+
+ logger.debug("final constructed mcMonitoredUserDTO: " + mcMonitoredUserDTO);
+ listMonitoredUserContainerDTO.add(mcMonitoredUserDTO);
+ }
+ else
+ {
+ logger.debug("retries is ON. User had to PASS. Print the final attempt's data");
+ McUsrAttempt mcUsrAttempt=getAttemptWithHighestOrder(listUserAttempts);
+ logger.debug("attempt with highest attempt order, mcUsrAttempt: " + mcUsrAttempt);
+
+ McMonitoredUserDTO mcMonitoredUserDTO = new McMonitoredUserDTO();
+ mcMonitoredUserDTO.setMark(mcUsrAttempt.getMcQueContent().getWeight().toString());
+ mcMonitoredUserDTO.setUserName(mcQueUsr.getFullname());
+
+ logger.debug("final constructed mcMonitoredUserDTO: " + mcMonitoredUserDTO);
+ listMonitoredUserContainerDTO.add(mcMonitoredUserDTO);
+ }
+ }
+ }
+ logger.debug("final listMonitoredUserContainerDTO: " + listMonitoredUserContainerDTO);
+ mapMonitoredUserContainerDTO=convertToMcMonitoredUserDTOMap(listMonitoredUserContainerDTO);
+ logger.debug("final mapMonitoredUserContainerDTO:..." + mapMonitoredUserContainerDTO);
return mapMonitoredUserContainerDTO;
}
else
@@ -345,7 +555,8 @@
{
logger.debug("the user in question is found: " + mcQueUsr.getQueUsrId());
logger.debug("getting listUserAttempts for user id: " + mcQueUsr.getUid() + " and que content id: " + questionUid);
- List listUserAttempts=mcService.getAttemptsForUserAndQuestionContent(mcQueUsr.getUid(), new Long(questionUid));
+ //List listUserAttempts=mcService.getAttemptsForUserAndQuestionContent(mcQueUsr.getUid(), new Long(questionUid));
+ List listUserAttempts=mcService.getUserAttemptsForQuestionContentAndSessionUid(mcQueUsr.getUid(), new Long(questionUid), mcSession.getUid());
logger.debug("listUserAttempts: " + listUserAttempts);
Iterator itAttempts=listUserAttempts.iterator();
@@ -379,7 +590,32 @@
}
}
+
+ public static McUsrAttempt getAttemptWithHighestOrder(List listUserAttempts)
+ {
+ logger.debug("starting getAttemptWithHighestOrder: " + listUserAttempts);
+ Iterator itAttempts=listUserAttempts.iterator();
+ int highestOrder=0;
+ McUsrAttempt mcHighestUsrAttempt=null;
+
+ while (itAttempts.hasNext())
+ {
+ McUsrAttempt mcUsrAttempt=(McUsrAttempt)itAttempts.next();
+ logger.debug("mcUsrAttempt: " + mcUsrAttempt);
+ int currentOrder=mcUsrAttempt.getAttemptOrder().intValue();
+
+ if (currentOrder > highestOrder)
+ {
+ mcHighestUsrAttempt=mcUsrAttempt;
+ }
+ }
+
+ logger.debug("returning mcHighestUsrAttempt: " + mcHighestUsrAttempt);
+ return mcHighestUsrAttempt;
+ }
+
+
public static Map populateToolSessionsId(HttpServletRequest request, McContent mcContent, IMcService mcService)
{
List sessionsList=mcService.getSessionsFromContent(mcContent);
Index: lams_tool_lamc/web/monitoring/Summary.jsp
===================================================================
diff -u -rcaa7d3d855db20f8bb1b534ce5dc75a1d28474ea -rf931ace3d9f38ea25225bd0cd55adfdcb3dfc376
--- lams_tool_lamc/web/monitoring/Summary.jsp (.../Summary.jsp) (revision caa7d3d855db20f8bb1b534ce5dc75a1d28474ea)
+++ lams_tool_lamc/web/monitoring/Summary.jsp (.../Summary.jsp) (revision f931ace3d9f38ea25225bd0cd55adfdcb3dfc376)
@@ -86,6 +86,12 @@
+
+
+ |
+
+
+
@@ -125,10 +131,96 @@
-
+
|