Commit 7fd2f4b7 by Harsh Shah

Analysis Engine Changes - weighted score calculation

parent 8610af15
<?xml version="1.0" encoding="UTF-8"?>
<!-- @AutoRun -->
<OBJECTS name="" xmlns:oneit="http://www.1iT.com.au"><NODE name="Script" factory="Vector">
<NODE name="DDL" factory="Participant" class="oneit.sql.transfer.DefineTableOperation">
<tableName factory="String">tl_level_type</tableName>
<column name="object_id" type="Long" nullable="true" length="11"/>
<column name="object_last_updated_date" type="Date" nullable="false" length="22"/>
<column name="object_created_date" type="Date" nullable="false" length="22"/>
<column name="type_flag" type="String" nullable="true" length="200"/>
<column name="level_number" type="Long" length="11" nullable="true"/>
<column name="factor_number" type="Long" length="11" nullable="true"/>
</NODE>
<NODE name="INDEX" factory="Participant" class="oneit.sql.transfer.DefineIndexOperation" tableName="tl_level_type" indexName="idx_tl_level_type_level_number" isUnique="false"><column name="level_number"/></NODE>
<NODE name="INDEX" factory="Participant" class="oneit.sql.transfer.DefineIndexOperation" tableName="tl_level_type" indexName="idx_tl_level_type_factor_number" isUnique="false"><column name="factor_number"/></NODE>
</NODE></OBJECTS>
\ No newline at end of file
...@@ -12,10 +12,13 @@ ...@@ -12,10 +12,13 @@
<column name="is_right_quest" type="Boolean" nullable="true"/> <column name="is_right_quest" type="Boolean" nullable="true"/>
<column name="section_number" type="Long" length="11" nullable="true"/> <column name="section_number" type="Long" length="11" nullable="true"/>
<column name="right_quest_number" type="Long" length="11" nullable="true"/> <column name="right_quest_number" type="Long" length="11" nullable="true"/>
<column name="high_low_factor_id" type="Long" length="11" nullable="true"/>
</NODE> </NODE>
<NODE name="INDEX" factory="Participant" class="oneit.sql.transfer.DefineIndexOperation" tableName="tl_quest_lin" indexName="idx_tl_quest_lin_section_number" isUnique="false"><column name="section_number"/></NODE> <NODE name="INDEX" factory="Participant" class="oneit.sql.transfer.DefineIndexOperation" tableName="tl_quest_lin" indexName="idx_tl_quest_lin_section_number" isUnique="false"><column name="section_number"/></NODE>
<NODE name="INDEX" factory="Participant" class="oneit.sql.transfer.DefineIndexOperation" tableName="tl_quest_lin" indexName="idx_tl_quest_lin_right_quest_number" isUnique="false"><column name="right_quest_number"/></NODE> <NODE name="INDEX" factory="Participant" class="oneit.sql.transfer.DefineIndexOperation" tableName="tl_quest_lin" indexName="idx_tl_quest_lin_right_quest_number" isUnique="false"><column name="right_quest_number"/></NODE>
<NODE name="INDEX" factory="Participant" class="oneit.sql.transfer.DefineIndexOperation" tableName="tl_quest_lin" indexName="idx_tl_quest_lin_high_low_factor_id" isUnique="false"><column name="high_low_factor_id"/></NODE>
</NODE></OBJECTS> </NODE></OBJECTS>
\ No newline at end of file
-- DROP TABLE tl_level_type;
CREATE TABLE tl_level_type (
object_id int NOT NULL ,
object_last_updated_date datetime DEFAULT getdate() NOT NULL ,
object_created_date datetime DEFAULT getdate() NOT NULL
,
type_flag varchar(200) NULL,
level_number numeric(12) NULL,
factor_number numeric(12) NULL
);
ALTER TABLE tl_level_type ADD
CONSTRAINT PK_tl_level_type PRIMARY KEY
(
object_id
) ;
CREATE INDEX idx_tl_level_type_level_number
ON tl_level_type (level_number);
CREATE INDEX idx_tl_level_type_factor_number
ON tl_level_type (factor_number);
...@@ -11,7 +11,8 @@ CREATE TABLE tl_quest_lin ( ...@@ -11,7 +11,8 @@ CREATE TABLE tl_quest_lin (
description varchar(80) NULL, description varchar(80) NULL,
is_right_quest char(1) NULL, is_right_quest char(1) NULL,
section_number numeric(12) NULL, section_number numeric(12) NULL,
right_quest_number numeric(12) NULL right_quest_number numeric(12) NULL,
high_low_factor_id numeric(12) NULL
); );
...@@ -29,3 +30,6 @@ ALTER TABLE tl_quest_lin ADD ...@@ -29,3 +30,6 @@ ALTER TABLE tl_quest_lin ADD
CREATE INDEX idx_tl_quest_lin_right_quest_number CREATE INDEX idx_tl_quest_lin_right_quest_number
ON tl_quest_lin (right_quest_number); ON tl_quest_lin (right_quest_number);
CREATE INDEX idx_tl_quest_lin_high_low_factor_id
ON tl_quest_lin (high_low_factor_id);
-- DROP TABLE tl_level_type;
CREATE TABLE tl_level_type (
object_id number(12) NOT NULL ,
object_last_updated_date date DEFAULT SYSDATE NOT NULL ,
object_created_date date DEFAULT SYSDATE NOT NULL
,
type_flag varchar2(200) NULL,
level_number number(12) NULL,
factor_number number(12) NULL
);
ALTER TABLE tl_level_type ADD
CONSTRAINT PK_tl_level_type PRIMARY KEY
(
object_id
) ;
CREATE INDEX idx_tl_level_type_level_number
ON tl_level_type (level_number);
CREATE INDEX idx_tl_level_type_factor_number
ON tl_level_type (factor_number);
...@@ -12,7 +12,8 @@ CREATE TABLE tl_quest_lin ( ...@@ -12,7 +12,8 @@ CREATE TABLE tl_quest_lin (
description varchar2(80) NULL, description varchar2(80) NULL,
is_right_quest char(1) NULL, is_right_quest char(1) NULL,
section_number number(12) NULL, section_number number(12) NULL,
right_quest_number number(12) NULL right_quest_number number(12) NULL,
high_low_factor_id number(12) NULL
); );
...@@ -30,3 +31,6 @@ ALTER TABLE tl_quest_lin ADD ...@@ -30,3 +31,6 @@ ALTER TABLE tl_quest_lin ADD
CREATE INDEX idx_tl_quest_lin_right_quest_number CREATE INDEX idx_tl_quest_lin_right_quest_number
ON tl_quest_lin (right_quest_number); ON tl_quest_lin (right_quest_number);
CREATE INDEX idx_tl_quest_lin_high_low_factor_id
ON tl_quest_lin (high_low_factor_id);
-- @AutoRun
-- drop table tl_level_type;
CREATE TABLE tl_level_type (
object_id numeric(12) NOT NULL ,
object_last_updated_date timestamp DEFAULT NOW() NOT NULL ,
object_created_date timestamp DEFAULT NOW() NOT NULL
,
type_flag varchar(200) NULL,
level_number numeric(12) NULL,
factor_number numeric(12) NULL
);
ALTER TABLE tl_level_type ADD
CONSTRAINT pk_tl_level_type PRIMARY KEY
(
object_id
) ;
CREATE INDEX idx_tl_level_type_level_number
ON tl_level_type (level_number);
CREATE INDEX idx_tl_level_type_factor_number
ON tl_level_type (factor_number);
...@@ -12,7 +12,8 @@ CREATE TABLE tl_quest_lin ( ...@@ -12,7 +12,8 @@ CREATE TABLE tl_quest_lin (
description varchar(80) NULL, description varchar(80) NULL,
is_right_quest char(1) NULL, is_right_quest char(1) NULL,
section_number numeric(12) NULL, section_number numeric(12) NULL,
right_quest_number numeric(12) NULL right_quest_number numeric(12) NULL,
high_low_factor_id numeric(12) NULL
); );
...@@ -30,3 +31,6 @@ ALTER TABLE tl_quest_lin ADD ...@@ -30,3 +31,6 @@ ALTER TABLE tl_quest_lin ADD
CREATE INDEX idx_tl_quest_lin_right_quest_number CREATE INDEX idx_tl_quest_lin_right_quest_number
ON tl_quest_lin (right_quest_number); ON tl_quest_lin (right_quest_number);
CREATE INDEX idx_tl_quest_lin_high_low_factor_id
ON tl_quest_lin (high_low_factor_id);
...@@ -4,50 +4,62 @@ import oneit.objstore.rdbms.filters.EqualsFilter; ...@@ -4,50 +4,62 @@ import oneit.objstore.rdbms.filters.EqualsFilter;
import oneit.utils.filter.CollectionFilter; import oneit.utils.filter.CollectionFilter;
import oneit.utils.filter.Filter; import oneit.utils.filter.Filter;
import oneit.utils.parsers.FieldException; import oneit.utils.parsers.FieldException;
import performa.orm.types.QuestionType;
public class Answer extends BaseAnswer public class Answer extends BaseAnswer
{ {
private static final long serialVersionUID = 0L; private static final long serialVersionUID = 0L;
private static final Integer MAX_ANSWER_NO = 7;
// This constructor should not be called // This constructor should not be called
public Answer () public Answer ()
{ {
// Do not add any code to this, always put it in initialiseNewObject // Do not add any code to this, always put it in initialiseNewObject
} }
@Override @Override
protected void postAnswerNoChange() throws FieldException public void setAnswerNo(Integer newAnswerNo) throws FieldException
{ {
super.postAnswerNoChange(); super.setAnswerNo(newAnswerNo);
if(getQuestion() != null) if(getAnswerNo() != null)
{ {
Question rightQuestion = getQuestion().getRightQuestion(); if(getQuestion() != null && getQuestion().getQuestionType() == QuestionType.IPSATIVE)
if(rightQuestion != null)
{ {
Filter<Answer> filter = Answer.SearchByAll().andQuestion(new EqualsFilter<>(rightQuestion)); Question rightQuestion = getQuestion().getRightQuestion();
Answer rightAnswer = CollectionFilter.getFirstMatch(getJobApplication().getProfileAssessmentAnswersSet(), filter); if(rightQuestion != null)
if(rightAnswer!=null)
{ {
rightAnswer.setAnswerNo(calculateRightAnswerNo()); Filter<Answer> filter = Answer.SearchByAll().andQuestion(new EqualsFilter<>(rightQuestion));
Answer rightAnswer = CollectionFilter.getFirstMatch(getJobApplication().getProfileAssessmentAnswersSet(), filter);
if(rightAnswer!=null)
{
rightAnswer.setAnswerNo(10 - getAnswerNo()); //Refer below calculation table
}
} }
} }
} }
} }
/**
public Integer calculateRightAnswerNo() *
* Ipsative answer logic as per Apollo:
*
* Submitted Left Answer Final Left Answer Final Right Answer
* 1 9 1
* 2 7 3
* 3 5 5
* 4 3 7
* 5 1 9
*/
public int getFinalAnswerValue(int index)
{ {
if(getAnswerNo()!=null) if(getQuestion() != null && getQuestion().getQuestionType() == QuestionType.IPSATIVE)
{ {
return MAX_ANSWER_NO - getAnswerNo(); return (10 - ((index * 2) - 1));
} }
return null; return index;
} }
} }
\ No newline at end of file
...@@ -4,9 +4,11 @@ ...@@ -4,9 +4,11 @@
<BUSINESSCLASS name="Factor" package="performa.orm"> <BUSINESSCLASS name="Factor" package="performa.orm">
<MULTIPLEREFERENCE name="Levels" type="FactorLevelLink" backreferenceName="Factor" /> <MULTIPLEREFERENCE name="Levels" type="FactorLevelLink" backreferenceName="Factor" />
<MULTIPLEREFERENCE name="Questions" type="FactorQuestionLink" backreferenceName="Factor" /> <MULTIPLEREFERENCE name="Questions" type="FactorQuestionLink" backreferenceName="Factor" />
<MULTIPLEREFERENCE name="Results" type="FactorScoreResult" backreferenceName="Factor" /> <MULTIPLEREFERENCE name="Results" type="FactorScoreResult" backreferenceName="Factor" />
<MULTIPLEREFERENCE name="HighLowQuestions" type="Question" backreferenceName="HighLowFactor" />
<MULTIPLEREFERENCE name="LevelFactorTypes" type="LevelFactorType" backreferenceName="Factor" />
<TABLE name="tl_factor" tablePrefix="object" polymorphic="FALSE"> <TABLE name="tl_factor" tablePrefix="object" polymorphic="FALSE">
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
<MULTIPLEREFERENCE name="Results" type="FactorScoreResult" backreferenceName="Level" /> <MULTIPLEREFERENCE name="Results" type="FactorScoreResult" backreferenceName="Level" />
<MULTIPLEREFERENCE name="Narratives" type="Narrative" backreferenceName="Level" /> <MULTIPLEREFERENCE name="Narratives" type="Narrative" backreferenceName="Level" />
<MULTIPLEREFERENCE name="TestAnalysises" type="TestAnalysis" backreferenceName="Level" /> <MULTIPLEREFERENCE name="TestAnalysises" type="TestAnalysis" backreferenceName="Level" />
<MULTIPLEREFERENCE name="LevelFactorTypes" type="LevelFactorType" backreferenceName="Level" />
<TABLE name="tl_level" tablePrefix="object" polymorphic="FALSE"> <TABLE name="tl_level" tablePrefix="object" polymorphic="FALSE">
......
package performa.orm;
public class LevelFactorType extends BaseLevelFactorType
{
private static final long serialVersionUID = 0L;
// This constructor should not be called
public LevelFactorType ()
{
// Do not add any code to this, always put it in initialiseNewObject
}
@Override
public String getObjectIDSpace()
{
return "LevelFactorType";
}
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<ROOT xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:noNamespaceSchemaLocation='http://www.oneit.com.au/schemas/5.2/BusinessObject.xsd'>
<BUSINESSCLASS name="LevelFactorType" package="performa.orm">
<IMPORT value="performa.orm.types.*"/>
<TABLE name="tl_level_type" tablePrefix="object" polymorphic="FALSE">
<ATTRIB name="TypeFlag" type="TypeFlag" dbcol="type_flag" attribHelper="EnumeratedAttributeHelper"/>
<SINGLEREFERENCE name="Level" type="Level" dbcol="level_number" backreferenceName="LevelFactorTypes" />
<SINGLEREFERENCE name="Factor" type="Factor" dbcol="factor_number" backreferenceName="LevelFactorTypes" />
</TABLE>
<SEARCH type="All" paramFilter="tl_level_type.object_id is not null" orderBy="tl_level_type.object_id"/>
</BUSINESSCLASS>
</ROOT>
\ No newline at end of file
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
<SINGLEREFERENCE name="Section" type="Section" dbcol="section_number" backreferenceName="Questions"/> <SINGLEREFERENCE name="Section" type="Section" dbcol="section_number" backreferenceName="Questions"/>
<SINGLEREFERENCE name="RightQuestion" type="Question" dbcol="right_quest_number" backreferenceName="LeftQuestions"/> <SINGLEREFERENCE name="RightQuestion" type="Question" dbcol="right_quest_number" backreferenceName="LeftQuestions"/>
<SINGLEREFERENCE name="HighLowFactor" type="Factor" dbcol="high_low_factor_id" backreferenceName="HighLowQuestions"/> <!-- Using this to manage special case of Unusually High/Low Factor Calculation -->
</TABLE> </TABLE>
......
...@@ -44,7 +44,7 @@ public class QuestionPersistenceMgr extends ObjectPersistenceMgr ...@@ -44,7 +44,7 @@ public class QuestionPersistenceMgr extends ObjectPersistenceMgr
} }
private String SELECT_COLUMNS = "{PREFIX}tl_quest_lin.object_id as id, {PREFIX}tl_quest_lin.object_LAST_UPDATED_DATE as LAST_UPDATED_DATE, {PREFIX}tl_quest_lin.object_CREATED_DATE as CREATED_DATE, {PREFIX}tl_quest_lin.description, {PREFIX}tl_quest_lin.is_right_quest, {PREFIX}tl_quest_lin.section_number, {PREFIX}tl_quest_lin.right_quest_number, 1 AS commasafe "; private String SELECT_COLUMNS = "{PREFIX}tl_quest_lin.object_id as id, {PREFIX}tl_quest_lin.object_LAST_UPDATED_DATE as LAST_UPDATED_DATE, {PREFIX}tl_quest_lin.object_CREATED_DATE as CREATED_DATE, {PREFIX}tl_quest_lin.description, {PREFIX}tl_quest_lin.is_right_quest, {PREFIX}tl_quest_lin.section_number, {PREFIX}tl_quest_lin.right_quest_number, {PREFIX}tl_quest_lin.high_low_factor_id, 1 AS commasafe ";
private String SELECT_JOINS = ""; private String SELECT_JOINS = "";
public BaseBusinessClass fetchByID(ObjectID id, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException public BaseBusinessClass fetchByID(ObjectID id, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
...@@ -98,7 +98,8 @@ public class QuestionPersistenceMgr extends ObjectPersistenceMgr ...@@ -98,7 +98,8 @@ public class QuestionPersistenceMgr extends ObjectPersistenceMgr
!tl_quest_linPSet.containsAttrib(Question.FIELD_Description)|| !tl_quest_linPSet.containsAttrib(Question.FIELD_Description)||
!tl_quest_linPSet.containsAttrib(Question.FIELD_IsRightQuestion)|| !tl_quest_linPSet.containsAttrib(Question.FIELD_IsRightQuestion)||
!tl_quest_linPSet.containsAttrib(Question.SINGLEREFERENCE_Section)|| !tl_quest_linPSet.containsAttrib(Question.SINGLEREFERENCE_Section)||
!tl_quest_linPSet.containsAttrib(Question.SINGLEREFERENCE_RightQuestion)) !tl_quest_linPSet.containsAttrib(Question.SINGLEREFERENCE_RightQuestion)||
!tl_quest_linPSet.containsAttrib(Question.SINGLEREFERENCE_HighLowFactor))
{ {
// We will need to retrieve it // We will need to retrieve it
idsToFetch.add (id.longValue()); idsToFetch.add (id.longValue());
...@@ -164,6 +165,16 @@ public class QuestionPersistenceMgr extends ObjectPersistenceMgr ...@@ -164,6 +165,16 @@ public class QuestionPersistenceMgr extends ObjectPersistenceMgr
return results; return results;
} }
else if (refName.equals (Question.SINGLEREFERENCE_HighLowFactor))
{
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}tl_quest_lin " +
"WHERE " + SELECT_JOINS + "high_low_factor_id = ?";
BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, new Object[] { _objectID.longID () }, null, false);
return results;
}
else else
{ {
throw new IllegalArgumentException ("Illegal reference type:" + refName); throw new IllegalArgumentException ("Illegal reference type:" + refName);
...@@ -188,10 +199,10 @@ public class QuestionPersistenceMgr extends ObjectPersistenceMgr ...@@ -188,10 +199,10 @@ public class QuestionPersistenceMgr extends ObjectPersistenceMgr
{ {
int rowsUpdated = executeStatement (sqlMgr, int rowsUpdated = executeStatement (sqlMgr,
"UPDATE {PREFIX}tl_quest_lin " + "UPDATE {PREFIX}tl_quest_lin " +
"SET description = ?, is_right_quest = ?, section_number = ? , right_quest_number = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " + "SET description = ?, is_right_quest = ?, section_number = ? , right_quest_number = ? , high_low_factor_id = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " +
"WHERE tl_quest_lin.object_id = ? AND " + getConcurrencyCheck (sqlMgr, "object_LAST_UPDATED_DATE", obj.getObjectLastModified ()) + " ", "WHERE tl_quest_lin.object_id = ? AND " + getConcurrencyCheck (sqlMgr, "object_LAST_UPDATED_DATE", obj.getObjectLastModified ()) + " ",
CollectionUtils.listEntry (HELPER_Description.getForSQL(dummyDescription, tl_quest_linPSet.getAttrib (Question.FIELD_Description))).listEntry (HELPER_IsRightQuestion.getForSQL(dummyIsRightQuestion, tl_quest_linPSet.getAttrib (Question.FIELD_IsRightQuestion))).listEntry (SQLManager.CheckNull((Long)(tl_quest_linPSet.getAttrib (Question.SINGLEREFERENCE_Section)))).listEntry (SQLManager.CheckNull((Long)(tl_quest_linPSet.getAttrib (Question.SINGLEREFERENCE_RightQuestion)))).listEntry (objectID.longID ()).listEntry (obj.getObjectLastModified ()).toList().toArray()); CollectionUtils.listEntry (HELPER_Description.getForSQL(dummyDescription, tl_quest_linPSet.getAttrib (Question.FIELD_Description))).listEntry (HELPER_IsRightQuestion.getForSQL(dummyIsRightQuestion, tl_quest_linPSet.getAttrib (Question.FIELD_IsRightQuestion))).listEntry (SQLManager.CheckNull((Long)(tl_quest_linPSet.getAttrib (Question.SINGLEREFERENCE_Section)))).listEntry (SQLManager.CheckNull((Long)(tl_quest_linPSet.getAttrib (Question.SINGLEREFERENCE_RightQuestion)))).listEntry (SQLManager.CheckNull((Long)(tl_quest_linPSet.getAttrib (Question.SINGLEREFERENCE_HighLowFactor)))).listEntry (objectID.longID ()).listEntry (obj.getObjectLastModified ()).toList().toArray());
if (rowsUpdated != 1) if (rowsUpdated != 1)
{ {
...@@ -452,6 +463,7 @@ public class QuestionPersistenceMgr extends ObjectPersistenceMgr ...@@ -452,6 +463,7 @@ public class QuestionPersistenceMgr extends ObjectPersistenceMgr
tl_quest_linPSet.setAttrib(Question.SINGLEREFERENCE_Section, r.getObject ("section_number")); tl_quest_linPSet.setAttrib(Question.SINGLEREFERENCE_Section, r.getObject ("section_number"));
tl_quest_linPSet.setAttrib(Question.SINGLEREFERENCE_RightQuestion, r.getObject ("right_quest_number")); tl_quest_linPSet.setAttrib(Question.SINGLEREFERENCE_RightQuestion, r.getObject ("right_quest_number"));
tl_quest_linPSet.setAttrib(Question.SINGLEREFERENCE_HighLowFactor, r.getObject ("high_low_factor_id"));
} }
...@@ -468,10 +480,10 @@ public class QuestionPersistenceMgr extends ObjectPersistenceMgr ...@@ -468,10 +480,10 @@ public class QuestionPersistenceMgr extends ObjectPersistenceMgr
{ {
executeStatement (sqlMgr, executeStatement (sqlMgr,
"INSERT INTO {PREFIX}tl_quest_lin " + "INSERT INTO {PREFIX}tl_quest_lin " +
" (description, is_right_quest, section_number, right_quest_number, object_id, object_LAST_UPDATED_DATE, object_CREATED_DATE) " + " (description, is_right_quest, section_number, right_quest_number, high_low_factor_id, object_id, object_LAST_UPDATED_DATE, object_CREATED_DATE) " +
"VALUES " + "VALUES " +
" (?, ?, ?, ?, ?, " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ", " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ")", " (?, ?, ?, ?, ?, ?, " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ", " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ")",
CollectionUtils.listEntry (HELPER_Description.getForSQL(dummyDescription, tl_quest_linPSet.getAttrib (Question.FIELD_Description))).listEntry (HELPER_IsRightQuestion.getForSQL(dummyIsRightQuestion, tl_quest_linPSet.getAttrib (Question.FIELD_IsRightQuestion))) .listEntry (SQLManager.CheckNull((Long)(tl_quest_linPSet.getAttrib (Question.SINGLEREFERENCE_Section)))).listEntry (SQLManager.CheckNull((Long)(tl_quest_linPSet.getAttrib (Question.SINGLEREFERENCE_RightQuestion)))) .listEntry (objectID.longID ()).toList().toArray()); CollectionUtils.listEntry (HELPER_Description.getForSQL(dummyDescription, tl_quest_linPSet.getAttrib (Question.FIELD_Description))).listEntry (HELPER_IsRightQuestion.getForSQL(dummyIsRightQuestion, tl_quest_linPSet.getAttrib (Question.FIELD_IsRightQuestion))) .listEntry (SQLManager.CheckNull((Long)(tl_quest_linPSet.getAttrib (Question.SINGLEREFERENCE_Section)))).listEntry (SQLManager.CheckNull((Long)(tl_quest_linPSet.getAttrib (Question.SINGLEREFERENCE_RightQuestion)))).listEntry (SQLManager.CheckNull((Long)(tl_quest_linPSet.getAttrib (Question.SINGLEREFERENCE_HighLowFactor)))) .listEntry (objectID.longID ()).toList().toArray());
tl_quest_linPSet.setStatus (PersistentSetStatus.PROCESSED); tl_quest_linPSet.setStatus (PersistentSetStatus.PROCESSED);
} }
......
...@@ -35,16 +35,16 @@ public class ColorCode extends AbstractEnumerated ...@@ -35,16 +35,16 @@ public class ColorCode extends AbstractEnumerated
return allColorCodes; return allColorCodes;
} }
private transient Integer Weightage; private transient Integer ColorRank;
private ColorCode (String name, String value, String description, boolean disabled) private ColorCode (String name, String value, String description, boolean disabled)
{ {
super (name, value, description, disabled); super (name, value, description, disabled);
} }
public Integer getWeightage() public Integer getColorRank()
{ {
return Weightage; return ColorRank;
} }
public static final Comparator COMPARE_BY_POSITION = new CompareEnumByPosition (allColorCodes); public static final Comparator COMPARE_BY_POSITION = new CompareEnumByPosition (allColorCodes);
...@@ -114,9 +114,9 @@ public class ColorCode extends AbstractEnumerated ...@@ -114,9 +114,9 @@ public class ColorCode extends AbstractEnumerated
public static void defineAdditionalData () public static void defineAdditionalData ()
{ {
RED.Weightage = 1; RED.ColorRank = 3;
AMBER.Weightage = 5; AMBER.ColorRank = 2;
GREEN.Weightage = 10; GREEN.ColorRank = 1;
} }
...@@ -144,7 +144,7 @@ public class ColorCode extends AbstractEnumerated ...@@ -144,7 +144,7 @@ public class ColorCode extends AbstractEnumerated
{ {
Map attribs = new HashMap (); Map attribs = new HashMap ();
attribs.put ("Weightage", ArrayFormatter.toObject(getWeightage())); attribs.put ("ColorRank", ArrayFormatter.toObject(getColorRank()));
return attribs; return attribs;
} }
......
...@@ -3,11 +3,11 @@ ...@@ -3,11 +3,11 @@
<ROOT> <ROOT>
<CONSTANT package="performa.orm.types" name="ColorCode"> <CONSTANT package="performa.orm.types" name="ColorCode">
<DATA name="Weightage" type="Integer"/> <DATA name="ColorRank" type="Integer"/>
<VALUE name="RED" value="RED" description="Red" Weightage="1"/> <VALUE name="RED" value="RED" description="Red" ColorRank="3"/>
<VALUE name="AMBER" value="AMBER" description="Amber" Weightage="5"/> <VALUE name="AMBER" value="AMBER" description="Amber" ColorRank="2"/>
<VALUE name="GREEN" value="GREEN" description="Green" Weightage="10"/> <VALUE name="GREEN" value="GREEN" description="Green" ColorRank="1"/>
</CONSTANT> </CONSTANT>
</ROOT> </ROOT>
\ No newline at end of file
...@@ -15,44 +15,30 @@ import oneit.utils.*; ...@@ -15,44 +15,30 @@ import oneit.utils.*;
* e.g. constGen C:\...\sql FieldType * e.g. constGen C:\...\sql FieldType
*/ */
public class StateType extends AbstractEnumerated public class TypeFlag extends AbstractEnumerated
{ {
public static final EnumeratedFactory FACTORY_StateType = new StateTypeFactory(); public static final EnumeratedFactory FACTORY_TypeFlag = new TypeFlagFactory();
public static final StateType WA = new StateType ("WA", "WA", "Western Australia", false); public static final TypeFlag PRIMARY = new TypeFlag ("PRIMARY", "PRIMARY", "Primary", false);
public static final StateType NSW = new StateType ("NSW", "NSW", "New South Wales", false); public static final TypeFlag SECONDARY = new TypeFlag ("SECONDARY", "SECONDARY", "Secondary", false);
public static final StateType VIC = new StateType ("VIC", "VIC", "Victoria", false);
public static final StateType TAS = new StateType ("TAS", "TAS", "Tasmania", false);
public static final StateType QLD = new StateType ("QLD", "QLD", "Queensland", false);
public static final StateType SA = new StateType ("SA", "SA", "South Australia", false);
public static final StateType ACT = new StateType ("ACT", "ACT", "Australian Capital Territory", false);
public static final StateType NT = new StateType ("NT", "NT", "Northern Territory", false);
public static final StateType OS = new StateType ("OS", "OS", "Outside Australia", false);
private static final StateType[] allStateTypes = private static final TypeFlag[] allTypeFlags =
new StateType[] { WA,NSW,VIC,TAS,QLD,SA,ACT,NT,OS}; new TypeFlag[] { PRIMARY,SECONDARY};
private static StateType[] getAllStateTypes () private static TypeFlag[] getAllTypeFlags ()
{ {
return allStateTypes; return allTypeFlags;
} }
private StateType (String name, String value, String description, boolean disabled) private TypeFlag (String name, String value, String description, boolean disabled)
{ {
super (name, value, description, disabled); super (name, value, description, disabled);
} }
public static final Comparator COMPARE_BY_POSITION = new CompareEnumByPosition (allStateTypes); public static final Comparator COMPARE_BY_POSITION = new CompareEnumByPosition (allTypeFlags);
...@@ -61,45 +47,45 @@ public class StateType extends AbstractEnumerated ...@@ -61,45 +47,45 @@ public class StateType extends AbstractEnumerated
defineAdditionalData (); defineAdditionalData ();
} }
public boolean isEqual (StateType other) public boolean isEqual (TypeFlag other)
{ {
return this.name.equals (other.name); return this.name.equals (other.name);
} }
public Enumeration getAllInstances () public Enumeration getAllInstances ()
{ {
return StateType.getAll (); return TypeFlag.getAll ();
} }
private Object readResolve() throws java.io.ObjectStreamException private Object readResolve() throws java.io.ObjectStreamException
{ {
return StateType.forName (this.name); return TypeFlag.forName (this.name);
} }
public EnumeratedFactory getFactory () public EnumeratedFactory getFactory ()
{ {
return FACTORY_StateType; return FACTORY_TypeFlag;
} }
public static StateType forName (String name) public static TypeFlag forName (String name)
{ {
if (name == null) { return null; } if (name == null) { return null; }
StateType[] all = getAllStateTypes(); TypeFlag[] all = getAllTypeFlags();
int enumIndex = AbstractEnumerated.getIndexForName (all, name); int enumIndex = AbstractEnumerated.getIndexForName (all, name);
return all[enumIndex]; return all[enumIndex];
} }
public static StateType forValue (String value) public static TypeFlag forValue (String value)
{ {
if (value == null) { return null; } if (value == null) { return null; }
StateType[] all = getAllStateTypes(); TypeFlag[] all = getAllTypeFlags();
int enumIndex = AbstractEnumerated.getIndexForValue (getAllStateTypes (), value); int enumIndex = AbstractEnumerated.getIndexForValue (getAllTypeFlags (), value);
return all[enumIndex]; return all[enumIndex];
} }
...@@ -107,13 +93,13 @@ public class StateType extends AbstractEnumerated ...@@ -107,13 +93,13 @@ public class StateType extends AbstractEnumerated
public static java.util.Enumeration getAll () public static java.util.Enumeration getAll ()
{ {
return AbstractEnumerated.getAll (getAllStateTypes()); return AbstractEnumerated.getAll (getAllTypeFlags());
} }
public static StateType[] getStateTypeArray () public static TypeFlag[] getTypeFlagArray ()
{ {
return (StateType[])getAllStateTypes().clone (); return (TypeFlag[])getAllTypeFlags().clone ();
} }
...@@ -123,21 +109,21 @@ public class StateType extends AbstractEnumerated ...@@ -123,21 +109,21 @@ public class StateType extends AbstractEnumerated
} }
static class StateTypeFactory implements EnumeratedFactory static class TypeFlagFactory implements EnumeratedFactory
{ {
public AbstractEnumerated getForName (String name) public AbstractEnumerated getForName (String name)
{ {
return StateType.forName (name); return TypeFlag.forName (name);
} }
public AbstractEnumerated getForValue (String name) public AbstractEnumerated getForValue (String name)
{ {
return StateType.forValue (name); return TypeFlag.forValue (name);
} }
public Enumeration getAll () public Enumeration getAll ()
{ {
return StateType.getAll (); return TypeFlag.getAll ();
} }
} }
......
<?xml version="1.0" encoding="UTF-8"?>
<ROOT>
<CONSTANT package="performa.orm.types" name="TypeFlag">
<VALUE name="PRIMARY" description="Primary"/>
<VALUE name="SECONDARY" description="Secondary"/>
</CONSTANT>
</ROOT>
\ No newline at end of file
...@@ -4,7 +4,9 @@ import java.util.*; ...@@ -4,7 +4,9 @@ import java.util.*;
import oneit.logging.*; import oneit.logging.*;
import oneit.objstore.*; import oneit.objstore.*;
import oneit.objstore.rdbms.filters.*; import oneit.objstore.rdbms.filters.*;
import oneit.utils.*;
import oneit.utils.filter.Filter; import oneit.utils.filter.Filter;
import oneit.utils.math.Statistics;
import oneit.utils.parsers.FieldException; import oneit.utils.parsers.FieldException;
import performa.orm.*; import performa.orm.*;
import performa.orm.types.*; import performa.orm.types.*;
...@@ -15,6 +17,8 @@ import performa.orm.types.*; ...@@ -15,6 +17,8 @@ import performa.orm.types.*;
*/ */
public class AnalysisEngine public class AnalysisEngine
{ {
private static final Long MAX_VALID_FACTOR_NUMBER = 49L; //Don't consider unusally high/low answer factors i.e 50/51
public static void analyseAnswers(JobApplication jobApplication) throws StorageException, FieldException public static void analyseAnswers(JobApplication jobApplication) throws StorageException, FieldException
{ {
LogMgr.log(JobApplication.LOG, LogLevel.PROCESSING1, "Inside AnalysisEngine --> analyseAnswers"); LogMgr.log(JobApplication.LOG, LogLevel.PROCESSING1, "Inside AnalysisEngine --> analyseAnswers");
...@@ -27,6 +31,7 @@ public class AnalysisEngine ...@@ -27,6 +31,7 @@ public class AnalysisEngine
jobApplication.pipelineJobApplication().toProfileAssessmentAnswers().toQuestion().toSection().uniqueVals(); jobApplication.pipelineJobApplication().toProfileAssessmentAnswers().toQuestion().toSection().uniqueVals();
jobApplication.pipelineJobApplication().toProfileAssessmentAnswers().toQuestion().toFactors().toFactor().uniqueVals(); jobApplication.pipelineJobApplication().toProfileAssessmentAnswers().toQuestion().toFactors().toFactor().uniqueVals();
Factor.pipesFactor(levelFactors).toResults().uniqueVals(); Factor.pipesFactor(levelFactors).toResults().uniqueVals();
Factor.pipesFactor(levelFactors).toLevelFactorTypes().uniqueVals();
LogMgr.log(JobApplication.LOG, LogLevel.PROCESSING1, "Processing Job Application ", jobApplication); LogMgr.log(JobApplication.LOG, LogLevel.PROCESSING1, "Processing Job Application ", jobApplication);
...@@ -40,32 +45,50 @@ public class AnalysisEngine ...@@ -40,32 +45,50 @@ public class AnalysisEngine
{ {
int factorScore = 0; int factorScore = 0;
Factor factor = link.getFactor(); Factor factor = link.getFactor();
if(factorScoreMap.containsKey(factor)) if(factor.getID().longID() <= MAX_VALID_FACTOR_NUMBER) //Don't consider unusally high/low answer factors i.e 50/51
{ {
factorScore = factorScoreMap.get(factor); if(factorScoreMap.containsKey(factor))
} {
factorScore = factorScoreMap.get(factor);
}
if(link.isTrue(link.getReverseScore())) if(link.isTrue(link.getReverseScore()))
{
if(answer.getQuestion().getQuestionType() == QuestionType.IPSATIVE)
{ {
factorScore += (10 - answer.getAnswerNo()); if(answer.getQuestion().getQuestionType() == QuestionType.IPSATIVE)
{
factorScore += (10 - answer.getAnswerNo());
}
else
{
factorScore += (8 - answer.getAnswerNo());
}
} }
else else
{ {
factorScore += (8 - answer.getAnswerNo()); factorScore += StringUtils.subNulls(answer.getAnswerNo(), 0);
} }
factorScoreMap.put(factor, factorScore);
} }
else
{
factorScore += answer.getAnswerNo() != null ? answer.getAnswerNo() : 0;
}
factorScoreMap.put(factor, factorScore);
} }
} }
//Unusually High Answers/Unusually Low Answers
Filter<Question> questFilter = Question.SearchByAll().andHighLowFactor(new IsNotNullFilter());
MultiHashtable<Factor, Answer> highLowAnswersByFactor = new MultiHashtable();
highLowAnswersByFactor.groupValues(jobApplication.getProfileAssessmentAnswersSet(), Answer.pipesAnswer().toQuestion(questFilter).toHighLowFactor());
for(Factor factor : highLowAnswersByFactor.keySet())
{
if(factor != null)
{
double answerTotal = Statistics.sum(Answer.pipesAnswer(highLowAnswersByFactor.getValuesForKeyNN(factor)).toAnswerNo().vals());
factorScoreMap.put(factor, Double.valueOf(answerTotal).intValue());
}
}
TestAnalysis testAnalysis = TestAnalysis.createTestAnalysis(objTran); TestAnalysis testAnalysis = TestAnalysis.createTestAnalysis(objTran);
jobApplication.getJob().getLevel().addToTestAnalysises(testAnalysis); jobApplication.getJob().getLevel().addToTestAnalysises(testAnalysis);
...@@ -93,10 +116,39 @@ public class AnalysisEngine ...@@ -93,10 +116,39 @@ public class AnalysisEngine
factorScore.setFactor(factor); factorScore.setFactor(factor);
factorScore.setLevel(jobApplication.getJob().getLevel()); factorScore.setLevel(jobApplication.getJob().getLevel());
factorScore.setScore(score); factorScore.setScore(score);
factorScore.setWghtdScore(score); //temp fix, to-do change later
factorScore.setColorCode(factorScoreResult.getColorCode()); factorScore.setColorCode(factorScoreResult.getColorCode());
factorScore.setColorRank(factorScoreResult.getColorCode() != null ? factorScoreResult.getColorCode().getWeightage() : 0); factorScore.setColorRank(factorScoreResult.getColorCode() != null ? factorScoreResult.getColorCode().getColorRank() : 0);
factorScore.setNarrative(factorScoreResult.getNarrative()); factorScore.setNarrative(factorScoreResult.getNarrative());
/**
* Weighted Score.
*
* 10 where color rank = 1 and flag = Primary
* 5 where color rank = 1 and flag = Secondary
* 4 where color rank = 2 and flag = Primary
* 2 where color rank = 2 and flag = Secondary
*/
Integer weightedScore = 0;
if(factorScoreResult.getColorCode() == ColorCode.GREEN || factorScoreResult.getColorCode() == ColorCode.AMBER)
{
Filter<LevelFactorType> levelFactorFilter = LevelFactorType.SearchByAll().andLevel(new EqualsFilter(jobApplication.getJob().getLevel()));
LevelFactorType levelFactorType = factor.pipelineFactor().toLevelFactorTypes(levelFactorFilter).val();
if(levelFactorType != null && levelFactorType.getTypeFlag() != null)
{
if(factorScoreResult.getColorCode() == ColorCode.GREEN)//Color Code: Green --> Color Rank = 1
{
weightedScore = (levelFactorType.getTypeFlag() == TypeFlag.PRIMARY) ? 10 : 5;
}
else //Color Code: Amber --> Color Rank = 2
{
weightedScore = (levelFactorType.getTypeFlag() == TypeFlag.PRIMARY) ? 4 : 2;
}
}
}
factorScore.setWghtdScore(weightedScore);
testAnalysis.addToFactorScores(factorScore); testAnalysis.addToFactorScores(factorScore);
jobApplication.getCandidate().addToFactorScores(factorScore); jobApplication.getCandidate().addToFactorScores(factorScore);
......
...@@ -145,7 +145,7 @@ ...@@ -145,7 +145,7 @@
%> %>
<li class="<%= activeStr %>"> <li class="<%= activeStr %>">
<a href="javascript:void(0);"> <a href="javascript:void(0);">
<input type="radio" name="<%= optionKey %>" id="<%= index %>" onchange="gotoNextQuestion();" class="answer_radio" value="<%= index %>" <%= selectedStr %>> <input type="radio" name="<%= optionKey %>" id="<%= index %>" onchange="gotoNextQuestion();" class="answer_radio" value="<%= answer.getFinalAnswerValue(index) %>" <%= selectedStr %>>
<label for="<%= index %>"><%= index %></label> <label for="<%= index %>"><%= index %></label>
</a> </a>
</li> </li>
......
<?xml version="1.0" encoding="UTF-8"?>
<!-- @AutoRun -->
<OBJECTS name="" xmlns:oneit="http://www.1iT.com.au">
<NODE name="Script" factory="Vector">
<NODE name="DDL" factory="Participant" class="oneit.sql.transfer.RedefineTableOperation">
<tableName factory="String">tl_quest_lin</tableName>
<column name="high_low_factor_id" type="Long" length="11" nullable="true"/>
</NODE>
<NODE name="INDEX" factory="Participant" class="oneit.sql.transfer.DefineIndexOperation" tableName="tl_quest_lin" indexName="idx_tl_quest_lin_high_low_factor_id" isUnique="false"><column name="high_low_factor_id"/></NODE>
</NODE>
</OBJECTS>
\ No newline at end of file
update tl_quest_lin set high_low_factor_id = 50 where object_id in (25, 118, 226, 240, 243, 246, 251, 253, 258, 261, 265, 310, 312, 340);
update tl_quest_lin set high_low_factor_id = 51 where object_id in (9, 10, 18, 30,138, 140,203, 207, 208, 224, 237, 264, 275, 280);
<?xml version="1.0" encoding="UTF-8"?>
<!-- @AutoRun -->
<OBJECTS name="" xmlns:oneit="http://www.1iT.com.au"><NODE name="Script" factory="Vector">
<NODE name="DDL" factory="Participant" class="oneit.sql.transfer.DefineTableOperation">
<tableName factory="String">tl_level_type</tableName>
<column name="object_id" type="Long" nullable="true" length="11"/>
<column name="object_last_updated_date" type="Date" nullable="false" length="22"/>
<column name="object_created_date" type="Date" nullable="false" length="22"/>
<column name="type_flag" type="String" nullable="true" length="200"/>
<column name="level_number" type="Long" length="11" nullable="true"/>
<column name="factor_number" type="Long" length="11" nullable="true"/>
</NODE>
<NODE name="INDEX" factory="Participant" class="oneit.sql.transfer.DefineIndexOperation" tableName="tl_level_type" indexName="idx_tl_level_type_level_number" isUnique="false"><column name="level_number"/></NODE>
<NODE name="INDEX" factory="Participant" class="oneit.sql.transfer.DefineIndexOperation" tableName="tl_level_type" indexName="idx_tl_level_type_factor_number" isUnique="false"><column name="factor_number"/></NODE>
</NODE></OBJECTS>
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
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