Commit 604a19b0 by Nilu Committed by Harsh Shah

Question # / Total # of Questions (1/41) counter should be accurate (and begin…

Question # / Total # of Questions (1/41) counter should be accurate (and begin at **1** with a total of **250**
parent 77d5a3b1
......@@ -131,19 +131,12 @@ public class Job extends BaseJob
}
//to get All Profile Assessment Questions
public Collection<Question> getAllProfileAssessmentQuestions()
{
return pipelineJob().toLevel().toFactors().toFactor().toQuestions().toQuestion().uniqueVals();
}
//to get only left Questions
public List<Question> getAllLeftQuestions()
public List<Question> getAllLeftQuestions(List<Question> totalQuestions)
{
Filter filter = Question.SearchByAll().andIsRightQuestion(new EqualsFilter<>(Boolean.FALSE));
return ObjstoreUtils.sort(CollectionFilter.filter(getAllProfileAssessmentQuestions(), filter),
return ObjstoreUtils.sort(CollectionFilter.filter(totalQuestions , filter),
new ObjectTransform[] {Question.pipesQuestion().toSection().toObjectID(), Question.pipesQuestion().toObjectID()},
new Comparator[]{CollectionUtils.DEFAULT_COMPARATOR, CollectionUtils.DEFAULT_COMPARATOR});
}
......
......@@ -218,7 +218,7 @@ public class JobApplication extends BaseJobApplication
public boolean assessmentCompleted()
{
int allAnswersCount = getJob().getAllProfileAssessmentQuestions().size();
int allAnswersCount = getJob().getAllLeftQuestions(Arrays.asList(Question.searchAll(getTransaction()))).size();
if(allAnswersCount > 0)
{
......@@ -232,6 +232,12 @@ public class JobApplication extends BaseJobApplication
}
public int getActualQuestionNumber()
{
return pipelineJobApplication().toProfileAssessmentAnswers().toQuestion().toRightQuestion().uniqueVals().size() + pipelineJobApplication().toProfileAssessmentAnswers().uniqueVals().size() + 1;
}
public boolean isIncludeAssessmentCriteria()
{
return getJob() != null && isTrue(getJob().getIncludeAssessmentCriteria());
......
......@@ -11,12 +11,21 @@
JobApplication jobApplication = (JobApplication) process.getAttribute("JobApplication");
Job job = jobApplication.getJob();
int questionNumber = process.getAttribute("QuestionNumber")!= null ? (int) process.getAttribute("QuestionNumber") : jobApplication.getProfileAssessmentAnswersCount();
int actualNumber = process.getAttribute("ActualNumber")!= null ? (int) process.getAttribute("ActualNumber") : jobApplication.getActualQuestionNumber();
List<Question> totalQuestions = (List<Question>) process.getAttribute("TotalQuestions");
List<Question> allQuestions = (List<Question>) process.getAttribute("AllQuestions");
String exitPage = WebUtils.getArticleLink(request, transaction, WebUtils.APPLY_JOB, "Page") + "&id=" + job.getID() + "&key=" + job.getRandomKey();
if(totalQuestions == null)
{
totalQuestions = Arrays.asList(Question.searchAll(transaction));
process.setAttribute("TotalQuestions", totalQuestions);
}
if(allQuestions == null)
{
allQuestions = job.getAllLeftQuestions();
allQuestions = job.getAllLeftQuestions(totalQuestions);
process.setAttribute("AllQuestions", allQuestions);
}
......@@ -26,6 +35,7 @@
if(toRedirect)
{
process.setAttribute("QuestionNumber", questionNumber);
process.setAttribute("ActualNumber", actualNumber);
%><%@include file="/saferedirect.jsp" %><%
}
......@@ -87,16 +97,16 @@
<%
FormTag applicationForm = FormTag.getActiveFormTag(request);
FormBuilder formBuilder = applicationForm.getFormBuilder();
int totNoOfQuestions = allQuestions.size();
int totNoOfQuestions = totalQuestions.size();
if(questionNumber < totNoOfQuestions)
if(actualNumber <= totNoOfQuestions)
{
Question question = allQuestions.get(questionNumber);
QuestionType questionType = question.getQuestionType();
Answer answer = jobApplication.getAnswerForQuestion(question);
String optionKey = WebUtils.getInputKey(request, answer, Answer.FIELD_AnswerNo);
String formValue = formBuilder.fieldValue (optionKey, answer.getAnswerNo() == null ? "" : String.valueOf(answer.getAnswerNo()));
String numberText = (questionNumber + 1) + "/" + totNoOfQuestions;
String numberText = actualNumber + "/" + totNoOfQuestions;
if(questionType == QuestionType.SCALAR)
{
......@@ -110,6 +120,7 @@
<oneit:toString value="<%= question.getDescription() %>" mode="EscapeHTML"/>
</div>
<%
actualNumber++;
}
else
{
......@@ -119,6 +130,7 @@
<span><oneit:toString value="<%= numberText %>" mode="EscapeHTML"/></span>
</div>
<%
actualNumber +=2;
}
%>
<div class="ratting-box">
......@@ -173,12 +185,12 @@
%>
<div>
<%
if((questionNumber+1) < totNoOfQuestions)
if(actualNumber < totNoOfQuestions)
{
%>
<oneit:button value=" " name="gotoPage" id="nextButton" skin="link"
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", currentPage)
.mapEntry("procParams", CollectionUtils.mapEntry("QuestionNumber", (questionNumber + 1)).toMap())
.mapEntry("procParams", CollectionUtils.mapEntry("QuestionNumber", (questionNumber + 1)).mapEntry("ActualNumber", actualNumber).toMap())
.toMap() %>"/>
<%
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment