Skip to content

Commit

Permalink
SAM-3151 fix Classcast Long Integer after Hibernate 4 error (sakaipro…
Browse files Browse the repository at this point in the history
  • Loading branch information
ottenhoff authored and ern committed Feb 17, 2017
1 parent d836c85 commit a203f26
Showing 1 changed file with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,12 @@ public List getTakeableList(List assessmentList, GradingService gradingService)
PublishedAssessmentFacade f = (PublishedAssessmentFacade) assessmentList1;
f.setTitle(FormattedText.convertFormattedTextToPlaintext(f.getTitle()));
Long publishedAssessmentId = f.getPublishedAssessmentId();
if (isActive(f, (Map) submissionCountHash.get(publishedAssessmentId), (Map) inProgressCountHash.get(publishedAssessmentId),
(Map) numberRetakeHash.get(publishedAssessmentId), (Map) actualNumberRetake.get(publishedAssessmentId), needResubmitList)) {
if (isActive(f,
(Map<String, Integer>) submissionCountHash.get(publishedAssessmentId),
(Map<String, Long>) inProgressCountHash.get(publishedAssessmentId),
(Map<String, Integer>) numberRetakeHash.get(publishedAssessmentId),
(Map<String, Long>) actualNumberRetake.get(publishedAssessmentId),
needResubmitList)) {
f.setActiveStatus(true);
activeList.add(f);
}
Expand All @@ -310,8 +314,8 @@ public List getTakeableList(List assessmentList, GradingService gradingService)
return list;
}

public boolean isActive(PublishedAssessmentFacade f, Map submissionCountHash, Map inProgressCountHash, Map numberRetakeHash,
Map actualNumberRetakeHash, List needResubmitList) {
public boolean isActive(PublishedAssessmentFacade f, Map<String, Integer> submissionCountHash, Map<String, Long> inProgressCountHash, Map<String, Integer> numberRetakeHash,
Map<String, Long> actualNumberRetakeHash, List needResubmitList) {
boolean returnValue = false;
//1. prepare our significant parameters
Integer status = f.getStatus();
Expand Down Expand Up @@ -375,21 +379,21 @@ public boolean isActive(PublishedAssessmentFacade f, Map submissionCountHash, Ma
int submittedCounts = 0;
int inProgressCounts = 0;
if (userIdList != null) {
Iterator iter = userIdList.iterator();
Iterator<String> iter = userIdList.iterator();
String userId;
boolean isStillAvailable;
while(iter.hasNext()) {
userId = (String) iter.next();
int totalSubmitted = 0;
int totalInProgress;
if (submissionCountHash != null && submissionCountHash.get(userId) != null){
totalSubmitted = ( (Integer) submissionCountHash.get(userId));
totalSubmitted = submissionCountHash.get(userId);
if (totalSubmitted > 0) {
submittedCounts++;
}
}
if (inProgressCountHash != null && inProgressCountHash.get(userId) != null){
totalInProgress = ( (Integer) inProgressCountHash.get(userId));
totalInProgress = inProgressCountHash.get(userId).intValue();
if (totalInProgress > 0) {
inProgressCounts++;
}
Expand Down Expand Up @@ -442,7 +446,7 @@ public boolean isActive(PublishedAssessmentFacade f, Map submissionCountHash, Ma
return returnValue;
}

private boolean isStillAvailable(int totalSubmitted, Map numberRetakeHash, Map actualNumberRetakeHash,
private boolean isStillAvailable(int totalSubmitted, Map<String, Integer> numberRetakeHash, Map<String, Long> actualNumberRetakeHash,
String userId, Date currentDate, Date dueDate,
boolean acceptLateSubmission, int maxSubmissionsAllowed) {
boolean isStillAvailable = false;
Expand All @@ -461,7 +465,7 @@ private boolean isStillAvailable(int totalSubmitted, Map numberRetakeHash, Map a
}
int actualNumberRetake = 0;
if (actualNumberRetakeHash != null && actualNumberRetakeHash.get(userId) != null) {
actualNumberRetake = ((Integer) actualNumberRetakeHash.get(userId));
actualNumberRetake = actualNumberRetakeHash.get(userId).intValue();
}
if (actualNumberRetake < numberRetake && acceptLateSubmission) {
isStillAvailable = true;
Expand Down

0 comments on commit a203f26

Please sign in to comment.