Commit f562b95f by Harsh Shah

Application ranking logic, Role Fit graph issue sorted

parent 5d25e9da
......@@ -14,7 +14,7 @@ import oneit.utils.filter.CollectionFilter;
import oneit.utils.filter.Filter;
import oneit.utils.parsers.FieldException;
import performa.orm.types.*;
import performa.utils.Utils;
import performa.utils.*;
public class Job extends BaseJob
......@@ -92,28 +92,34 @@ public class Job extends BaseJob
return super.getWriteability_JobStatus();
}
public Boolean jobDetailsCompleted()
public void calculateRoleFitForRanking() throws FieldException
{
return getJobTitle() != null && getJobDescription() != null;
}
public Boolean assessmentCompleted()
if(!isTrue(getRankingCompleted()))
{
return Boolean.TRUE;
}
//Preloading data
pipelineJob().toJobApplications().toCandidate().toTestAnalysises().toCandidateClassScores().uniqueVals();
pipelineJob().toJobApplications().toCandidate().toCultureCriteriaAnswers().toSelectedQuestion().toNarratives().toCultureElementRating().uniqueVals();
pipelineJob().toJobApplications().toCandidate().toCultureCriteriaAnswers().toCultureElement().uniqueVals();
pipelineJob().toLevel().toLevelClassCriterias().toFactorClass().uniqueVals();
pipelineJob().toLevel().toClassNormalisations().uniqueVals();
pipelineJob().toLevel().toLevelNormalisations().uniqueVals();
public Boolean cultureCompleted()
List<JobApplication> sortedApplications = ObjstoreUtils.sort(getSubmittedApplications(),
new ObjectTransform[]{JobApplicationRoleFitTransform.INSTANCE, JobApplicationCultureFitTransform.INSTANCE},
new Comparator[]{CollectionUtils.reverse(CollectionUtils.DEFAULT_COMPARATOR), CollectionUtils.reverse(CollectionUtils.DEFAULT_COMPARATOR)});
for(JobApplication jobApplication : getSubmittedApplications())
{
return Boolean.FALSE;
jobApplication.setOverallRank(sortedApplications.indexOf(jobApplication) + 1);
}
}
setRankingCompleted(true);
}
public Boolean jobMatchCompleted()
public Boolean jobDetailsCompleted()
{
return Boolean.TRUE;
return getJobTitle() != null && getJobDescription() != null;
}
......
......@@ -23,6 +23,7 @@
<TRANSIENT name="AssessmentTemplateName" type="String"/>
<TRANSIENT name="CultureTemplateName" type="String"/>
<TRANSIENT name="AppProcessOption" type="AppProcessOption" attribHelper="EnumeratedAttributeHelper"/>
<TRANSIENT name="RankingCompleted" type="Boolean" />
<TRANSIENTSINGLE name="AssessmentTemplate" type="AssessmentCriteriaTemplate" />
<TRANSIENTSINGLE name="CultureTemplate" type="CultureCriteriaTemplate" />
......
package performa.orm;
import java.util.*;
import oneit.logging.LoggingArea;
import oneit.logging.*;
import oneit.objstore.*;
import oneit.objstore.rdbms.filters.EqualsFilter;
import oneit.objstore.rdbms.filters.IsNotNullFilter;
......@@ -237,32 +237,88 @@ public class JobApplication extends BaseJobApplication
return getJob() != null && isTrue(getJob().getIncludeAssessmentCriteria());
}
// TODO: Fix these hard coded values
@Override
public Integer getOverallSuitability()
public Map getRoleFit()
{
if(super.getRoleFit() == null && getCandidate() != null && getJob() != null && getJob().getLevel() != null)
{
return 1;
try
{
setRoleFit(AnalysisEngine.getRoleFitSuitability(getCandidate(), getJob().getLevel()));
}
catch (FieldException ex)
{
LogMgr.log(LOG, LogLevel.PROCESSING1, ex, "Error occured when setting RoleFit for " + this);
}
}
return super.getRoleFit();
}
public Double getJobMatchPercentage() //ROLE
@Override
public Map getCultureFit()
{
return AnalysisEngine.getRoleFitSuitability(getCandidate(), getJob().getLevel()).get(null);
if(super.getCultureFit() == null && getCandidate() != null && getJob() != null && getJob().getLevel() != null)
{
try
{
setCultureFit(AnalysisEngine.getCultureFit(getCandidate().getCultureCriteriaAnswersSet(), getJob()));
}
catch (FieldException ex)
{
LogMgr.log(LOG, LogLevel.PROCESSING1, ex, "Error occured when setting CultureFit for " + this);
}
}
return super.getCultureFit();
}
@Override
public Map getRequirementFit()
{
if(super.getRequirementFit() == null)
{
try
{
setRequirementFit(AnalysisEngine.getRequirementFit(getAssessmentCriteriaAnswersSet()));
}
catch (FieldException ex)
{
LogMgr.log(LOG, LogLevel.PROCESSING1, ex, "Error occured when setting RequirementFit for " + this);
}
}
return super.getRequirementFit();
}
public int getCulturePercentage()
@Override
public Integer getOverallRank()
{
return AnalysisEngine.getCultureFit(getCandidate().getCultureCriteriaAnswersSet(), getJob()).get(null).intValue();
if(getJob() != null)
{
try
{
getJob().calculateRoleFitForRanking();
}
catch (FieldException ex)
{
LogMgr.log(LOG, LogLevel.PROCESSING1, ex, "Error occured when setting OverallRank for " + this);
}
}
return super.getOverallRank();
}
public Double getRoleFitScore()
{
return getRoleFit() != null ? (Double)getRoleFit().get(null) : 0d;
}
public int getCriteriaPercentage () //REQ
public Long getCultureFitScore()
{
return AnalysisEngine.getRequirementFit(getAssessmentCriteriaAnswersSet()).get(null).intValue();
return getCultureFit() != null ? (Long) getCultureFit().get(null) : 0;
}
public Long getRequirementFitScore()
{
return getRequirementFit() != null ? (Long) getRequirementFit().get(null) : 0;
}
public List<AppProcessOption> getValidProcessOptions()
{
......
......@@ -8,7 +8,10 @@
<MULTIPLEREFERENCE name="AssessmentCriteriaAnswers" type="AssessmentCriteriaAnswer" backreferenceName="JobApplication" />
<TRANSIENT name="AppProcessOption" type="AppProcessOption" attribHelper="EnumeratedAttributeHelper"/>
<TRANSIENT name="OverallSuitability" type="Integer"/>
<TRANSIENT name="OverallRank" type="Integer" />
<TRANSIENT name="RoleFit" type="Map" attribHelper="BLOBAttributeHelper" attribHelperInstance="BLOBAttributeHelper.INSTANCE"/>
<TRANSIENT name="RequirementFit" type="Map" attribHelper="BLOBAttributeHelper" attribHelperInstance="BLOBAttributeHelper.INSTANCE"/>
<TRANSIENT name="CultureFit" type="Map" attribHelper="BLOBAttributeHelper" attribHelperInstance="BLOBAttributeHelper.INSTANCE"/>
<TABLE name="tl_job_application" tablePrefix="object" polymorphic="FALSE">
......
package performa.utils;
import oneit.utils.ObjectTransform;
import performa.orm.JobApplication;
/**
*
* @author Harsh
*/
public class JobApplicationCultureFitTransform implements ObjectTransform<JobApplication, Long>
{
public static final JobApplicationCultureFitTransform INSTANCE = new JobApplicationCultureFitTransform();
@Override
public Long transform(JobApplication original)
{
if(original == null)
{
return null;
}
return original.getCultureFitScore();
}
}
\ No newline at end of file
package performa.utils;
import oneit.utils.ObjectTransform;
import performa.orm.JobApplication;
/**
*
* @author Harsh
*/
public class JobApplicationRoleFitTransform implements ObjectTransform<JobApplication, Double>
{
public static final JobApplicationRoleFitTransform INSTANCE = new JobApplicationRoleFitTransform();
@Override
public Double transform(JobApplication original)
{
if(original == null)
{
return null;
}
return original.getRoleFitScore();
}
}
\ No newline at end of file
......@@ -164,17 +164,17 @@ public class Utils
if(appSortOption==AppSortOption.OLDEST)
{
transform = JobApplication.pipesJobApplication().toSubmittedDate();
comparator = CollectionUtils.DEFAULT_COMPARATOR;
comparator = CollectionUtils.DEFAULT_COMPARATOR_NULLS_FIRST;
}
else if(appSortOption==AppSortOption.NEWEST)
{
transform = JobApplication.pipesJobApplication().toSubmittedDate();
comparator = CollectionUtils.reverse(CollectionUtils.DEFAULT_COMPARATOR);
comparator = CollectionUtils.reverse(CollectionUtils.DEFAULT_COMPARATOR_NULLS_FIRST);
}
else if(appSortOption==AppSortOption.RANK)
{
transform = JobApplication.pipesJobApplication().toOverallSuitability();
comparator = CollectionUtils.reverse(CollectionUtils.DEFAULT_COMPARATOR);
transform = JobApplication.pipesJobApplication().toOverallRank();
comparator = CollectionUtils.DEFAULT_COMPARATOR_NULLS_FIRST;
}
else if(appSortOption==AppSortOption.ALPHA_A_Z)
{
......
......@@ -29,9 +29,9 @@
for(JobApplication jobApplication : applications)
{
String jobMatch = FormatUtils.stringify(jobApplication.getJobMatchPercentage(), "TwoDPDouble", "0");
String culture = FormatUtils.stringify(jobApplication.getCulturePercentage(), "PercentageWholeNumber", "0");
String criteria = FormatUtils.stringify(jobApplication.getCriteriaPercentage(), "PercentageWholeNumber", "0");
String roleFit = FormatUtils.stringify(jobApplication.getRoleFitScore(), "PercentageWholeNumber", "0");
String culture = FormatUtils.stringify(jobApplication.getCultureFitScore(), "PercentageWholeNumber", "0");
String criteria = FormatUtils.stringify(jobApplication.getRequirementFitScore(), "PercentageWholeNumber", "0");
String appID = "app-id-" + jobApplication.getID().toString();
%>
<div class="appli-row" id="<%= jobApplication.getID() %>">
......@@ -57,14 +57,14 @@
</div>
<!--TODO: logic needed to be worked out. Added to note that there are three colors-->
<div class="<%= "appli-percent-no " + (j == 0 ? "first green" : (j < 3 ? "blue" : "grey" ))%>">
<oneit:toString value="<%= jobApplication.getOverallSuitability() %>" mode="Integer" />
<oneit:toString value="<%= jobApplication.getOverallRank() %>" mode="Integer" />
</div>
</div>
<div class="appli-jcs appli-l eq-second-height">
<span class="appli-view-bar">
<div class="progress">
<div class="progress-bar" role="progressbar" aria-valuenow="<%= jobMatch %>" aria-valuemin="0" aria-valuemax="100"
style="<%= "width: " + jobMatch %>">
<div class="progress-bar" role="progressbar" aria-valuenow="<%= roleFit %>" aria-valuemin="0" aria-valuemax="100"
style="<%= "width: " + roleFit %>">
</div>
</div>
</span>
......
......@@ -14,7 +14,7 @@
<oneit:dynIncluded>
<%
Map<FactorClass, Double> roleScoreMap = AnalysisEngine.getRoleFitSuitability(candidate, job.getLevel());
Map<FactorClass, Double> roleScoreMap = (Map<FactorClass, Double>)jobApplication.getRoleFit();
%>
<script>
function tabToggle(tab) {
......@@ -74,19 +74,19 @@
<div class="col-sm-4 col-xs-12 text-center" href="#1a" data-toggle="tab" id="progress1" onClick="tabToggle('#tab1')">
<label class="progress-label">role fit</label>
<div class="percent-green fixed-width">
<p style="display:none;"><oneit:toString value="<%= roleScoreMap.get(null) %>" mode="TwoDPDouble" nullValue="0"/></p>
<p style="display:none;"><oneit:toString value="<%= jobApplication.getRoleFitScore() %>" mode="TwoDPDouble" nullValue="0"/></p>
</div>
</div>
<div class="col-sm-4 col-xs-12 text-center" href="#2a" data-toggle="tab" id="progress2" onClick="tabToggle('#tab2')">
<label class="progress-label">culture fit</label>
<div class="percent-green fixed-width">
<p style="display:none;"><oneit:toString value="<%= jobApplication.getCulturePercentage() %>" mode="PercentageWholeNumber" /></p>
<p style="display:none;"><oneit:toString value="<%= jobApplication.getCultureFitScore() %>" mode="PercentageWholeNumber" /></p>
</div>
</div>
<div class="col-sm-4 col-xs-12 text-center" href="#3a" data-toggle="tab" id="progress3" onClick="tabToggle('#tab3')">
<label class="progress-label">requirements</label>
<div class="percent-blue fixed-width">
<p style="display:none;"><oneit:toString value="<%= jobApplication.getCriteriaPercentage() %>" mode="PercentageWholeNumber" /></p>
<p style="display:none;"><oneit:toString value="<%= jobApplication.getRequirementFitScore() %>" mode="PercentageWholeNumber" /></p>
</div>
</div>
</div>
......@@ -163,7 +163,7 @@
</div>
<div class="tab-pane" id="2a">
<%
Map<CultureClass, Long> cultureFitData = AnalysisEngine.getCultureFit(candidate.getCultureCriteriaAnswersSet(), job);
Map<CultureClass, Long> cultureFitData = (Map<CultureClass, Long>)jobApplication.getCultureFit();
for(CultureClass cClass: cultureFitData.keySet())
{
......@@ -236,7 +236,7 @@
</div>
<div class="tab-pane" id="3a">
<%
Map<Importance, Long> requirementFitData = AnalysisEngine.getRequirementFit(jobApplication.getAssessmentCriteriaAnswersSet());
Map<Importance, Long> requirementFitData = (Map<Importance, Long>)jobApplication.getRequirementFit();
for(Importance importance: requirementFitData.keySet())
{
......@@ -317,7 +317,7 @@
<div class="app-right-b">
<div class="overall-suit">overall rank</div>
<div class="big-percentage">
<oneit:toString value="<%= jobApplication.getOverallSuitability() %>" mode="Integer" />
<oneit:toString value="<%= jobApplication.getOverallRank() %>" mode="Integer" />
</div>
</div>
<div class="applicant-contact-info">
......
......@@ -127,7 +127,7 @@
Candidate candidate = jobApplication.getCandidate();
String appID = "app-id-" + jobApplication.getID().toString();
Map<FactorClass, Double> roleScoreMap = AnalysisEngine.getRoleFitSuitability(candidate, job.getLevel());
Map<FactorClass, Double> roleScoreMap = (Map<FactorClass, Double>)jobApplication.getRoleFit();
%>
<div class="<%= "appl-c-box " + (i == 0 ? " cb-one" : "")%> ">
<oneit:button value=" " name="gotoPage" skin="link"
......@@ -148,14 +148,14 @@
<div class="overall-suitablity grid-suitability">
<!--TODO: need to work on the logic. just added to demonstrate that there are 3 different colors for this-->
<div class="<%= "over-all " + (i == 0 ? "f-60 green" : (i < 3 ? "blue" : "gray"))%>">
<oneit:toString value="<%= jobApplication.getOverallSuitability() %>" mode="Integer" />
<oneit:toString value="<%= jobApplication.getOverallRank() %>" mode="Integer" />
</div>
<div class="<%= "overall " + (i == 0 ? "f-60" : "")%>">overall rank</div>
</div>
<div class="jcc-box">
<div class="job-match jcc">
<img src="images/app-job-match-icon.svg"> Role fit
<span><oneit:toString value="<%= jobApplication.getJobMatchPercentage() %>" mode="TwoDPDouble" /></span>
<span><oneit:toString value="<%= jobApplication.getRoleFitScore() %>" mode="TwoDPDouble" /></span>
</div>
<div class="detail-box">
<%
......@@ -181,13 +181,13 @@
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", applicationPage)
.mapEntry("procParams", CollectionUtils.mapEntry("JobApplication", jobApplication).toMap())
.toMap() %>">
<oneit:toString value="<%= jobApplication.getCulturePercentage() %>" mode="PercentageWholeNumber" />
<oneit:toString value="<%= jobApplication.getCultureFitScore() %>" mode="PercentageWholeNumber" />
</oneit:button>
</span>
</div>
<div class="detail-box">
<%
Map<CultureClass, Long> cultureFitData = AnalysisEngine.getCultureFit(candidate.getCultureCriteriaAnswersSet(), job);
Map<CultureClass, Long> cultureFitData = (Map<CultureClass, Long>)jobApplication.getCultureFit();
for(CultureClass cClass: cultureFitData.keySet())
{
......@@ -211,13 +211,13 @@
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", applicationPage)
.mapEntry("procParams", CollectionUtils.mapEntry("JobApplication", jobApplication).toMap())
.toMap() %>">
<oneit:toString value="<%= jobApplication.getCriteriaPercentage() %>" mode="PercentageWholeNumber" />
<oneit:toString value="<%= jobApplication.getRequirementFitScore() %>" mode="PercentageWholeNumber" />
</oneit:button>
</span>
</div>
<div class="detail-box">
<%
Map<Importance, Long> requirementFitData = AnalysisEngine.getRequirementFit(jobApplication.getAssessmentCriteriaAnswersSet());
Map<Importance, Long> requirementFitData = (Map<Importance, Long>)jobApplication.getRequirementFit();
for(Importance importance: requirementFitData.keySet())
{
......
......@@ -140,7 +140,7 @@
<div class="overall-suitablity">
<div class="<%= "overall " + (index == 0 ? "f-60" : "")%>">overall rank</div>
<div class="<%= "over-all " + (index == 0 ? "f-60 green" : (index < 3 ? "blue" : "gray"))%> ">
<oneit:toString value="<%= jobApplication.getOverallSuitability() %>" mode="Integer" />
<oneit:toString value="<%= jobApplication.getOverallRank() %>" mode="Integer" />
</div>
</div>
<div class="jcc-box">
......@@ -151,7 +151,7 @@
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", applicationPage)
.mapEntry("procParams", CollectionUtils.mapEntry("JobApplication", jobApplication).toMap())
.toMap() %>">
<oneit:toString value="<%= jobApplication.getJobMatchPercentage() %>" mode="TwoDPDouble" />
<oneit:toString value="<%= jobApplication.getRoleFitScore() %>" mode="TwoDPDouble" />
</oneit:button>
</span>
</div>
......@@ -162,7 +162,7 @@
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", applicationPage)
.mapEntry("procParams", CollectionUtils.mapEntry("JobApplication", jobApplication).toMap())
.toMap() %>">
<oneit:toString value="<%= jobApplication.getCulturePercentage() %>" mode="PercentageWholeNumber" />
<oneit:toString value="<%= jobApplication.getCultureFitScore() %>" mode="PercentageWholeNumber" />
</oneit:button>
</span>
</div>
......@@ -173,7 +173,7 @@
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", applicationPage)
.mapEntry("procParams", CollectionUtils.mapEntry("JobApplication", jobApplication).toMap())
.toMap() %>">
<oneit:toString value="<%= jobApplication.getCriteriaPercentage() %>" mode="PercentageWholeNumber" />
<oneit:toString value="<%= jobApplication.getRequirementFitScore() %>" mode="PercentageWholeNumber" />
</oneit:button>
</span>
</div>
......
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