|
1
|
function get_compensation_output(companyId,include,compare,round,general_graphcode,filters,criteria):
|
|
2
|
|
|
3
|
# 1. Extract Data
|
|
4
|
panel_data = loadDataFromDatabase(compagny.id, compangy.include, filters)
|
|
5
|
compagny_data = loadDataFromDatabase(compagny.id)
|
|
6
|
|
|
7
|
# 2. Get datasets for comparison
|
|
8
|
compared_data = buildComparisonDatasets(compare, panel_data, compagny_data)
|
|
9
|
|
|
10
|
# 3. For each criteria, calcul graphs of each criteria
|
|
11
|
criteriaResults = []
|
|
12
|
for( criteria in response.criteria)
|
|
13
|
{
|
|
14
|
result = null
|
|
15
|
result = calcul_sheet_criteria(criteria,compared_data)
|
|
16
|
result = result[result["number_employee_panel"] > result["number_employee_company"]]
|
|
17
|
result = result[result["number_employee_panel"] > 1]
|
|
18
|
result = function calcul_graphs_criteria
|
|
19
|
if(criteria.best_matching = true)
|
|
20
|
result = bestmatching_criteria()
|
|
21
|
criteriaResults.append(result)
|
|
22
|
}
|
|
23
|
# 4. Compute global-level graphs
|
|
24
|
globalGraphs = []
|
|
25
|
if(response.graphs != null)
|
|
26
|
for( graph in response.graphs)
|
|
27
|
if(graph eq graph_gap_general)
|
|
28
|
globalGraphs = calcul_graph_gap_general
|
|
29
|
else if(graph eq general_internal_gap_fixed)
|
|
30
|
globalGraphs = calcul_graph_general_internal_gap_fixed
|
|
31
|
else ;
|
|
32
|
|
|
33
|
# 5. Build final response
|
|
34
|
return {
|
|
35
|
"request": request,
|
|
36
|
"response": {
|
|
37
|
"criteria": criteriaResults,
|
|
38
|
"graphs": globalGraphs
|
|
39
|
}
|
|
40
|
}
|
|
41
|
}
|
|
42
|
|
|
43
|
function loadDataFromDatabase( compagny.id, compangy.include, filters)
|
|
44
|
|
|
45
|
function buildComparisonDatasets(rawData,compare)
|
|
46
|
|
|
47
|
function calcul_sheet_criteria
|
|
48
|
|
|
49
|
function bestmatching_criteria
|
|
50
|
|
|
51
|
function calcul_graphs_criteria
|
|
52
|
|
|
53
|
function calcul_graph_repartition_gap
|
|
54
|
|
|
55
|
function calcul_graph_repartition_data_bf
|
|
56
|
|
|
57
|
function calcul_graph_repartition_data_bt
|
|
58
|
|
|
59
|
function calcul_graph_gap_general
|
|
60
|
|
|
61
|
function calcul_graph_general_internal_gap_fixed
|
|
62
|
|
|
63
|
|
|
64
|
|
|
65
|
|
|
66
|
|
|
67
|
|