Skip to content

Commit

Permalink
SAK-40278 - Something with number of retakes causes ClassCastException (
Browse files Browse the repository at this point in the history
  • Loading branch information
jonespm authored and Miguel Pellicer committed Jul 6, 2018
1 parent 69b3acf commit 31d82cd
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -554,11 +554,11 @@ private void processSortInfo(SelectAssessmentBean bean) {
// agent is authorizaed and filter out the one that does not meet the
// takeable criteria.
// SAK-1464: we also want to filter out assessment released To Anonymous Users
private List getTakeableList(List assessmentList, Map h, List updatedAssessmentNeedResubmitList, List updatedAssessmentList) {
private List getTakeableList(List assessmentList, Map <Long,Integer> h, List updatedAssessmentNeedResubmitList, List updatedAssessmentList) {
List takeableList = new ArrayList();
GradingService gradingService = new GradingService();
Map<Long, StudentGradingSummaryData> numberRetakeHash = gradingService.getNumberRetakeHash(AgentFacade.getAgentString());
Map<Long, Long> actualNumberRetake = gradingService.getActualNumberRetakeHash(AgentFacade.getAgentString());
Map<Long, Integer> actualNumberRetake = gradingService.getActualNumberRetakeHash(AgentFacade.getAgentString());
ExtendedTimeDeliveryService extendedTimeDeliveryService;
for (int i = 0; i < assessmentList.size(); i++) {
PublishedAssessmentFacade f = (PublishedAssessmentFacade)assessmentList.get(i);
Expand All @@ -584,7 +584,7 @@ private List getTakeableList(List assessmentList, Map h, List updatedAssessmentN
return takeableList;
}

public boolean isAvailable(PublishedAssessmentFacade f, Map h, Map numberRetakeHash, Map actualNumberRetakeHash, List updatedAssessmentNeedResubmitList, List updatedAssessmentList) {
public boolean isAvailable(PublishedAssessmentFacade f, Map <Long, Integer> h, Map<Long, StudentGradingSummaryData> numberRetakeHash, Map <Long, Integer> actualNumberRetakeHash, List updatedAssessmentNeedResubmitList, List updatedAssessmentList) {
boolean returnValue = false;
//1. prepare our significant parameters
Integer status = f.getStatus();
Expand Down Expand Up @@ -651,7 +651,7 @@ public boolean isAvailable(PublishedAssessmentFacade f, Map h, Map numberRetakeH
} else {
int actualNumberRetake = 0;
if (actualNumberRetakeHash.get(f.getPublishedAssessmentId()) != null) {
actualNumberRetake = ((Integer) actualNumberRetakeHash.get(f.getPublishedAssessmentId()));
actualNumberRetake = (actualNumberRetakeHash.get(f.getPublishedAssessmentId()));
}
if (actualNumberRetake < numberRetake) {
returnValue = true;
Expand All @@ -664,7 +664,7 @@ public boolean isAvailable(PublishedAssessmentFacade f, Map h, Map numberRetakeH
if (retractDate == null || retractDate.after(currentDate)) {
int actualNumberRetake = 0;
if (actualNumberRetakeHash.get(f.getPublishedAssessmentId()) != null) {
actualNumberRetake = ((Integer) actualNumberRetakeHash.get(f.getPublishedAssessmentId()));
actualNumberRetake = (actualNumberRetakeHash.get(f.getPublishedAssessmentId()));
}
if (actualNumberRetake < numberRetake) {
returnValue = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1802,8 +1802,8 @@ public Map<Long, Map<String, Long>> getSiteActualNumberRetakeHash(final String s
return actualNumberRetakeHash;
}

public Map<Long, Long> getActualNumberRetakeHash(final String agentIdString) {
Map<Long, Long> actualNumberRetakeHash = new HashMap<>();
public Map<Long, Integer> getActualNumberRetakeHash(final String agentIdString) {
Map<Long, Integer> actualNumberRetakeHash = new HashMap<>();
final HibernateCallback<List<Object[]>> hcb = session -> {
Query q = session.createQuery(
"select a.publishedAssessmentId, count(*) from AssessmentGradingData a, StudentGradingSummaryData s " +
Expand All @@ -1817,7 +1817,7 @@ public Map<Long, Long> getActualNumberRetakeHash(final String agentIdString) {
};
List<Object[]> countList = getHibernateTemplate().execute(hcb);
for (Object[] o : countList) {
actualNumberRetakeHash.put((Long) o[0], (Long) o[1]);
actualNumberRetakeHash.put((Long) o[0], (Integer) o[1]);
}
return actualNumberRetakeHash;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ public AssessmentGradingData getHighestSubmittedAssessmentGrading(

public int getActualNumberRetake(Long publishedAssessmentId, String agentIdString);

public Map<Long, Long> getActualNumberRetakeHash(String agentIdString);
public Map<Long, Integer> getActualNumberRetakeHash(String agentIdString);

public Map<Long, Map<String, Long>> getSiteActualNumberRetakeHash(String siteIdString);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2533,15 +2533,15 @@ public int getActualNumberRetake(Long publishedAssessmentId, String agentIdStrin
return actualNumberReatke;
}

public Map<Long, Long> getActualNumberRetakeHash(String agentIdString) {
Map<Long, Long> actualNumberReatkeHash = new HashMap<>();
public Map<Long, Integer> getActualNumberRetakeHash(String agentIdString) {
Map<Long, Integer> actualNumberRetakeHash = new HashMap<>();
try {
actualNumberReatkeHash = PersistenceService.getInstance().
actualNumberRetakeHash = PersistenceService.getInstance().
getAssessmentGradingFacadeQueries().getActualNumberRetakeHash(agentIdString);
} catch (Exception e) {
log.error(e.getMessage(), e);
}
return actualNumberReatkeHash;
return actualNumberRetakeHash;
}

public Map<Long, Map<String, Long>> getSiteActualNumberRetakeHash(String siteIdString) {
Expand Down

0 comments on commit 31d82cd

Please sign in to comment.