Skip to content
Snippets Groups Projects
Commit 94e8154f authored by Sebastian Listl's avatar Sebastian Listl :speech_balloon:
Browse files

merged origin/1071004_ClassificationRefreshSpecificDataset into 2021.0.0

parents b2ada29d 53ce0a9f
No related branches found
No related tags found
No related merge requests found
......@@ -155,6 +155,19 @@
<entityField>
<name>DISPLAYVALUE</name>
</entityField>
<entityActionGroup>
<name>fitlerviewActionGroup</name>
<title>Action</title>
<children>
<entityActionField>
<name>refreshClassificationsOfThisDataset</name>
<title>refresh classifications</title>
<onActionProcess>%aditoprj%/entity/Classification_entity/entityfields/fitlerviewactiongroup/children/refreshclassificationsofthisdataset/onActionProcess.js</onActionProcess>
<isObjectAction v="false" />
<iconId>VAADIN:REFRESH</iconId>
</entityActionField>
</children>
</entityActionGroup>
</entityFields>
<recordContainers>
<jDitoRecordContainer>
......
import("system.process");
import("system.util");
import("system.vars");
var params = {
"refreshSingleRecord_param" : true,
"ObjectRowid_param" : vars.get("$param.ObjectRowid_param"),
"ObjectType_param" : vars.get("$param.ObjectType_param")}
var processConfig = process.createStartAsyncConfig()
.setName("updateClassifications_serverProcess")
.setUser( vars.get("$sys.user"))
.setThreadPriority(process.THREADPRIORITY_LOW)
.setTimerType(process.TIMERTYPE_SERVER)
.setLocalVariables(params);
process.startAsync(processConfig);
\ No newline at end of file
......@@ -10596,6 +10596,10 @@ Bitte Datumseingabe prüfen</value>
<key>Sorting by</key>
<value>Sortieren nach</value>
</entry>
<entry>
<key>refresh classifications</key>
<value>Klassifizierungen neuberechnen</value>
</entry>
</keyValueMap>
<font name="Dialog" style="0" size="11" />
</language>
......@@ -7350,6 +7350,36 @@
<entry>
<key>Probability in %</key>
</entry>
<entry>
<key>Created from</key>
</entry>
<entry>
<key>12 Months</key>
</entry>
<entry>
<key>6 Months</key>
</entry>
<entry>
<key>1 Month</key>
</entry>
<entry>
<key>2 Weeks</key>
</entry>
<entry>
<key>Calendar week</key>
</entry>
<entry>
<key>Weekplan already exists!</key>
</entry>
<entry>
<key>Weekplan Info</key>
</entry>
<entry>
<key>requested</key>
</entry>
<entry>
<key>Status Appointment</key>
</entry>
<entry>
<key>Standard City</key>
</entry>
......@@ -7680,105 +7710,12 @@
<entry>
<key>Filter set</key>
</entry>
<entry>
<key>Marketing Workflow</key>
</entry>
<entry>
<key>Traits</key>
</entry>
<entry>
<key>Salesproject Phase</key>
</entry>
<entry>
<key>Document template</key>
</entry>
<entry>
<key>Kontext</key>
</entry>
<entry>
<key>Checklist</key>
</entry>
<entry>
<key>Trait</key>
</entry>
<entry>
<key>Salesproject phase</key>
</entry>
<entry>
<key>Status: \"won\"</key>
</entry>
<entry>
<key>Project team roles</key>
</entry>
<entry>
<key>Offer sent</key>
</entry>
<entry>
<key>Classification fields</key>
</entry>
<entry>
<key>Project start within next 12 months</key>
</entry>
<entry>
<key>Project team: \"Internal distribution\"</key>
</entry>
<entry>
<key>Probablity: 100%</key>
</entry>
<entry>
<key>Project team: \"Project manager\"</key>
</entry>
<entry>
<key>Offer exists</key>
</entry>
<entry>
<key>Its not allowed to step over some salesproject phases.</key>
</entry>
<entry>
<key>Salesproject phases</key>
</entry>
<entry>
<key>Not all prerequisites are fulfilled.</key>
</entry>
<entry>
<key>To skip a salesproject phase isn't allowed.</key>
</entry>
<entry>
<key>The team must have at least one owner</key>
</entry>
<entry>
<key>Delete this Function</key>
</entry>
<entry>
<key>Automatically</key>
</entry>
<entry>
<key>Checklist entries</key>
</entry>
<entry>
<key>Communication strategy designed</key>
</entry>
<entry>
<key>Probability checked and eventually readjusted</key>
</entry>
<entry>
<key>Contract have been signed</key>
</entry>
<entry>
<key>Communication strategy introduced</key>
</entry>
<entry>
<key>Workshop for project-realization planned</key>
</entry>
<entry>
<key>Risk audit performed</key>
</entry>
<entry>
<key>Appointment for offer-agreement occured</key>
</entry>
<entry>
<key>Follow-up appointment(s) exists (e.g.: for workshops..)</key>
</entry>
<entry>
<key>Subtotal</key>
</entry>
......@@ -7798,13 +7735,13 @@
<key>The selected Contact doesn't have an address set.</key>
</entry>
<entry>
<key>Set completed</key>
<key>Sent offers</key>
</entry>
<entry>
<key>without Vat</key>
<key>Salesproject phases</key>
</entry>
<entry>
<key>Checklist entry</key>
<key>without Vat</key>
</entry>
<entry>
<key>Object Filter</key>
......
......@@ -10,9 +10,9 @@
<children>
<treeTableViewTemplate>
<name>ClassificationTreeTable</name>
<hideActions v="true" />
<showChildrenCount v="false" />
<entityField>#ENTITY</entityField>
<favoriteActionGroup1>fitlerviewActionGroup</favoriteActionGroup1>
<linkedColumns />
<defaultGroupFields>
<element>CLASSIFICATIONGROUP</element>
......
import("system.vars");
import("Context_lib");
import("system.util");
import("Util_lib");
......@@ -50,12 +51,26 @@ achievedScoresStmt, position, bestPossibleScoreStmt, storedClassificationFlag, d
var table = "CLASSIFICATIONSTORAGE";
var column = ["CLASSIFICATIONVALUE"];
var runUpdating = 0;
var singleRefresh = false;
if(vars.exists("$local.refreshSingleRecord_param") && vars.get("$local.refreshSingleRecord_param"))
{
singleRefresh = vars.get("$local.refreshSingleRecord_param");
}
//all classificationgroups and their object_type that have atleast one classificationtype with the outdated flag set
outdatedGroupsAndObjectTypes = newSelect("CLASSIFICATIONTYPE.OBJECT_TYPE, CLASSIFICATIONTYPE.CLASSIFICATIONGROUP_ID, CLASSIFICATIONTYPE.CLASSIFICATIONTYPEID, CLASSIFICATIONTYPE.FILTER")
if(!singleRefresh)
{
outdatedGroupsAndObjectTypes = newSelect("CLASSIFICATIONTYPE.OBJECT_TYPE, CLASSIFICATIONTYPE.CLASSIFICATIONGROUP_ID, CLASSIFICATIONTYPE.CLASSIFICATIONTYPEID, CLASSIFICATIONTYPE.FILTER")
.from("CLASSIFICATIONTYPE")
.where("CLASSIFICATIONTYPE.OUTDATED", 1)
.table();
}
else
{
outdatedGroupsAndObjectTypes = newSelect("CLASSIFICATIONTYPE.OBJECT_TYPE, CLASSIFICATIONTYPE.CLASSIFICATIONGROUP_ID, CLASSIFICATIONTYPE.CLASSIFICATIONTYPEID, CLASSIFICATIONTYPE.FILTER")
.from("CLASSIFICATIONTYPE")
.where("CLASSIFICATIONTYPE.OBJECT_TYPE", vars.get("$local.ObjectType_param"))
.table();
}
objectTypesThatNeedUpdate = [];
for (i = 0; i < outdatedGroupsAndObjectTypes.length; i++)
......@@ -95,41 +110,42 @@ for (i = 0; i < outdatedGroupsAndObjectTypes.length; i++)
helperObject[classificationTypeId] = "";
}
}
//object_type, object_rowId, classificationstorageId and the classificationstring (e.g. "ACB") of the classificationStorage datasets that habe the outdated flag set
outdatedStoredClassifications = newSelect("CLASSIFICATIONSTORAGE.OBJECT_TYPE, CLASSIFICATIONSTORAGE.OBJECT_ROWID, \n\
CLASSIFICATIONSTORAGE.CLASSIFICATIONSTORAGEID, CLASSIFICATIONSTORAGE.CLASSIFICATIONVALUE")
.from("CLASSIFICATIONSTORAGE")
.where("CLASSIFICATIONSTORAGE.OUTDATED", 1)
.orderBy("OBJECT_TYPE")
.table();
helperObject = {};
if(outdatedStoredClassifications)
if(!singleRefresh)
{
//build classificationStorageObject out of outdatedStoredClassifications
for (i = 0; i < outdatedStoredClassifications.length; i++)
//object_type, object_rowId, classificationstorageId and the classificationstring (e.g. "ACB") of the classificationStorage datasets that habe the outdated flag set
outdatedStoredClassifications = newSelect("CLASSIFICATIONSTORAGE.OBJECT_TYPE, CLASSIFICATIONSTORAGE.OBJECT_ROWID, \n\
CLASSIFICATIONSTORAGE.CLASSIFICATIONSTORAGEID, CLASSIFICATIONSTORAGE.CLASSIFICATIONVALUE")
.from("CLASSIFICATIONSTORAGE")
.where("CLASSIFICATIONSTORAGE.OUTDATED", 1)
.orderBy("OBJECT_TYPE")
.table();
helperObject = {};
if(outdatedStoredClassifications)
{
for (ii = 0; ii < outdatedStoredClassifications[i].length; ii++)
//build classificationStorageObject out of outdatedStoredClassifications
for (i = 0; i < outdatedStoredClassifications.length; i++)
{
[object_type, object_rowId, classificationStorageId, classificationScore] = outdatedStoredClassifications[i];
if(!helperObject.hasOwnProperty(object_type)) //objectType
for (ii = 0; ii < outdatedStoredClassifications[i].length; ii++)
{
classificationStorageObject[object_type] = {}; //puts objectType in classificationStorageObject and already initializes the object that later get's filled with the groups and their types
helperObject[object_type] = "";
objectTypes.push(object_type); //also push all the objectTypes in an Array for later (the updating happens one objectType at a time)
[object_type, object_rowId, classificationStorageId, classificationScore] = outdatedStoredClassifications[i];
}
if(!helperObject.hasOwnProperty(object_rowId)) //objectRowId
{
classificationStorageObject[object_type][object_rowId] = [classificationStorageId, classificationScore]; //same logic as before
helperObject[object_rowId] = "";
objectRowIdArray.push(object_rowId); //also push all the objectTypes in an Array for later
if(!helperObject.hasOwnProperty(object_type)) //objectType
{
classificationStorageObject[object_type] = {}; //puts objectType in classificationStorageObject and already initializes the object that later get's filled with the groups and their types
helperObject[object_type] = "";
objectTypes.push(object_type); //also push all the objectTypes in an Array for later (the updating happens one objectType at a time)
}
if(!helperObject.hasOwnProperty(object_rowId)) //objectRowId
{
classificationStorageObject[object_type][object_rowId] = [classificationStorageId, classificationScore]; //same logic as before
helperObject[object_rowId] = "";
objectRowIdArray.push(object_rowId); //also push all the objectTypes in an Array for later
}
}
}
}
}
}
if(outdatedStoredClassifications.length > 0)
{ storedClassificationFlag = true; //this variable can easily be checked to see what we are updating
......@@ -225,8 +241,14 @@ for (xyz = 0; xyz < runUpdating; xyz++)
}
if(!storedClassificationFlag) // we already habe the classificationStorageObject if we are updating for the outdated classificationStorage
{
let condIfSingle;
if(vars.exists("$local.ObjectRowid_param") && vars.get("$local.ObjectRowid_param"))
{
condIfSingle = newWhere("CLASSIFICATIONSTORAGE.OBJECT_ROWID", vars.get("$local.ObjectRowid_param"));
}
classificationStorageArray = newSelect("OBJECT_TYPE, OBJECT_ROWID, CLASSIFICATIONSTORAGEID, CLASSIFICATIONVALUE")
.from("CLASSIFICATIONSTORAGE")
.whereIfSet(condIfSingle)
.orderBy("OBJECT_TYPE")
.table();
helperObject = {}; //resets the helper object
......@@ -479,14 +501,17 @@ for (xyz = 0; xyz < runUpdating; xyz++)
}
}
}
if(!storedClassificationFlag)
if(singleRefresh)
{
correctCondition = newWhere("CLASSIFICATIONTYPE.CLASSIFICATIONGROUP_ID", groupsThatNeedUpdate, SqlBuilder.IN())
correctCondition = newWhere(currentObjectColumn, vars.get("$local.ObjectRowid_param"));
}
else if(!storedClassificationFlag)
{
correctCondition = newWhere("CLASSIFICATIONTYPE.CLASSIFICATIONGROUP_ID", groupsThatNeedUpdate, SqlBuilder.IN());
}
else
{
correctCondition = newWhere(currentObjectColumn, objectRowIdArray, SqlBuilder.IN())
correctCondition = newWhere(currentObjectColumn, objectRowIdArray, SqlBuilder.IN());
}
achievedScoresStmt = newSelect(currentObjectColumn + ", CLASSIFICATIONTYPE.CLASSIFICATIONGROUP_ID, \n\
......@@ -632,7 +657,7 @@ for (xyz = 0; xyz < runUpdating; xyz++)
}
}
if(!storedClassificationFlag)
if(!storedClassificationFlag && !singleRefresh)
{ for (i = 0; i < scoreArray.length; i++)
{
let cond = newWhere("CLASSIFICATIONTYPE.CLASSIFICATIONTYPEID", scoreArray[i][2]);
......@@ -809,10 +834,18 @@ function _buildBestPossibleScoresGroupObjFn(pBatchData, pBatchNum)
function _insertPersistendClassificationDataIfNeeded()
{
var objectsWithClassification = newSelect("distinct CLASSIFICATION.OBJECT_ROWID")
var objectsWithClassification;
if(singleRefresh)
{
objectsWithClassification = [vars.get("$local.ObjectRowid_param")];
}
else
{
objectsWithClassification = newSelect("distinct CLASSIFICATION.OBJECT_ROWID")
.from("CLASSIFICATION")
.where("CLASSIFICATION.OBJECT_TYPE", objectTypes[i])
.arrayColumn();
}
for (z = 0; z < objectsWithClassification.length; z++) {
uid = objectsWithClassification[z];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment