Commit 56956d46 authored by Frank Bergmann's avatar Frank Bergmann

Initial Import

parent d0622c20
Pipeline #512 failed with stages
...@@ -154,7 +154,6 @@ Ext.onReady(function () { ...@@ -154,7 +154,6 @@ Ext.onReady(function () {
</elseif> </elseif>
<elseif @chart_type@ eq "line_chart"> <elseif @chart_type@ eq "line_chart">
chart = new Ext.chart.Chart({ chart = new Ext.chart.Chart({
renderTo: @diagram_id@, renderTo: @diagram_id@,
width: @diagram_width@, width: @diagram_width@,
......
...@@ -35,13 +35,35 @@ set package_url "/simple-survey" ...@@ -35,13 +35,35 @@ set package_url "/simple-survey"
set report_code_found_p 1 set report_code_found_p 1
if ![info exists return_url] { set return_url "/intranet-trans-project-feedback/dashboard" } if ![info exists return_url] { set return_url "/intranet-trans-project-feedback/dashboard" }
# Set dynamic width
set num_days [db_string get_number_days "select '$end_date'::date - '$start_date'::date" -default 0]
switch $period {
month {
set data_points_horiz [expr $num_days / 30]
}
quarter {
set data_points_horiz [expr $num_days / 120]
}
year {
set data_points_horiz [expr $num_days / 365]
}
default {
set data_points_horiz 0
}
}
set data_points_horiz [format "%.2f" [expr {double(round(100*$data_points_horiz))/100}]]
# Determine size based on number od datapoints found
if { $data_points_horiz < 7 } { set diagram_width 500} else { set diagram_width 1000 }
# Set Report Code # Set Report Code
switch $title { switch $title {
"Non Comformity" { "Non Comformity" {
set store "translationProjectFeedbackNonComformityStore" set store "translationProjectFeedbackNonComformityStore"
set chart_type "column_chart" set chart_type "column_chart"
set diagram_report_code "translation_project_feedback_non_comformity" set diagram_report_code "translation_project_feedback_non_comformity"
if {![info exists diagram_width] || "" == $diagram_width} { set diagram_width 600 }
if {![info exists diagram_height] || "" == $diagram_height } { set diagram_height 350 } if {![info exists diagram_height] || "" == $diagram_height } { set diagram_height 350 }
if {![info exists diagram_font] || "" == $diagram_font} { set diagram_font "10px Helvetica, sans-serif" } if {![info exists diagram_font] || "" == $diagram_font} { set diagram_font "10px Helvetica, sans-serif" }
if {![info exists diagram_theme] || "" == $diagram_theme} { set diagram_theme "Custom" } if {![info exists diagram_theme] || "" == $diagram_theme} { set diagram_theme "Custom" }
...@@ -53,13 +75,17 @@ switch $title { ...@@ -53,13 +75,17 @@ switch $title {
if {![info exists diagram_title] || "" == $diagram_title} { set diagram_title [lang::message::lookup "" intranet-trans-project-feedback.$title $title] } if {![info exists diagram_title] || "" == $diagram_title} { set diagram_title [lang::message::lookup "" intranet-trans-project-feedback.$title $title] }
set diagram_id "translation_project_feedback_non_comformity" set diagram_id "translation_project_feedback_non_comformity"
} }
"Non-Comformity - Proportions" { "Non Comformity - Proportions" {
set store "translationProjectFeedbackNonComformityProportionStore" set store "translationProjectFeedbackNonComformityProportionStore"
set chart_type "pie_chart" set chart_type "pie_chart"
set diagram_report_code "translation_project_feedback_non_comformity_proportions" set diagram_report_code "translation_project_feedback_non_comformity_proportions"
if {![info exists diagram_limit] || "" == $diagram_limit} { set diagram_limit 100 } if {![info exists diagram_limit] || "" == $diagram_limit} { set diagram_limit 100 }
if {![info exists diagram_width] || "" == $diagram_width} { set diagram_width 800 }
if {![info exists diagram_height] || "" == $diagram_height } { set diagram_height 350 } # if {![info exists diagram_width] || "" == $diagram_width} { set diagram_width 350 }
# if {![info exists diagram_height] || "" == $diagram_height } { set diagram_height 350 }
set diagram_width 1000
set diagram_height 300
set diagram_id "translation_project_feedback_non_comformity_proportions" set diagram_id "translation_project_feedback_non_comformity_proportions"
} }
"Conformity vs Non-Comformity" { "Conformity vs Non-Comformity" {
...@@ -68,9 +94,9 @@ switch $title { ...@@ -68,9 +94,9 @@ switch $title {
set chart_type "line_chart" set chart_type "line_chart"
set diagram_report_code "translation_project_feedback_non_comformity" set diagram_report_code "translation_project_feedback_non_comformity"
if {![info exists diagram_limit] || "" == $diagram_limit} { set diagram_limit 100 } if {![info exists diagram_limit] || "" == $diagram_limit} { set diagram_limit 100 }
if {![info exists diagram_width] || "" == $diagram_width} { set diagram_width 600 }
if {![info exists diagram_height] || "" == $diagram_height } { set diagram_height 350 } if {![info exists diagram_height] || "" == $diagram_height } { set diagram_height 350 }
set diagram_id "translation_project_feedback_comformity_vs_non_comformity" set diagram_id "translation_project_feedback_comformity_vs_non_comformity"
} }
default { default {
set report_code_found_p 0 set report_code_found_p 0
......
...@@ -14,8 +14,10 @@ ...@@ -14,8 +14,10 @@
-- --
-- @author klaus.hofeditz@project-open.com -- @author klaus.hofeditz@project-open.com
-- Create table for inquiries
-- --------------------------------------------------------------------------------------------------------------------------
-- Create Survey & Questions
-- --------------------------------------------------------------------------------------------------------------------------
CREATE OR REPLACE FUNCTION inline_0 () CREATE OR REPLACE FUNCTION inline_0 ()
RETURNS INTEGER AS $BODY$ RETURNS INTEGER AS $BODY$
...@@ -52,8 +54,8 @@ end;$BODY$ LANGUAGE 'plpgsql'; ...@@ -52,8 +54,8 @@ end;$BODY$ LANGUAGE 'plpgsql';
SELECT inline_0 (); SELECT inline_0 ();
DROP FUNCTION inline_0 (); DROP FUNCTION inline_0 ();
-- Create Questions
CREATE OR REPLACE FUNCTION inline_0 () CREATE OR REPLACE FUNCTION inline_1 ()
RETURNS INTEGER AS $BODY$ RETURNS INTEGER AS $BODY$
declare declare
...@@ -63,6 +65,17 @@ declare ...@@ -63,6 +65,17 @@ declare
v_question_id integer; v_question_id integer;
begin begin
select count(*) into v_count
from survsimp_question_choices
where
label = 'CC - Client Complaint'
OR label = 'NC - Issue but no client complaint'
OR label = 'YAY - No issue';
IF 3 = v_count THEN
return 0;
END IF;
select survey_id into v_survey_id from survsimp_surveys where name = 'Project Translation Feedback'; select survey_id into v_survey_id from survsimp_surveys where name = 'Project Translation Feedback';
select acs_object__new (null, 'survsimp_question') into v_question_id; select acs_object__new (null, 'survsimp_question') into v_question_id;
...@@ -80,7 +93,6 @@ begin ...@@ -80,7 +93,6 @@ begin
'below' --new__presentation_alignment 'below' --new__presentation_alignment
); );
select survsimp_choice_id_sequence.nextval into v_next_choice_id from dual; select survsimp_choice_id_sequence.nextval into v_next_choice_id from dual;
insert into survsimp_question_choices (choice_id, question_id, label, sort_order) values (v_next_choice_id, v_question_id, 'CC - Client Complaint' ,1); insert into survsimp_question_choices (choice_id, question_id, label, sort_order) values (v_next_choice_id, v_question_id, 'CC - Client Complaint' ,1);
...@@ -93,8 +105,8 @@ begin ...@@ -93,8 +105,8 @@ begin
return 0; return 0;
end;$BODY$ LANGUAGE 'plpgsql'; end;$BODY$ LANGUAGE 'plpgsql';
SELECT inline_0 (); SELECT inline_1 ();
DROP FUNCTION inline_0 (); DROP FUNCTION inline_1 ();
CREATE OR REPLACE FUNCTION inline_0 () CREATE OR REPLACE FUNCTION inline_0 ()
...@@ -107,6 +119,18 @@ declare ...@@ -107,6 +119,18 @@ declare
v_question_id integer; v_question_id integer;
begin begin
select count(*) into v_count
from survsimp_question_choices
where
label = 'TC - Issue with translator delivery resulting in late client delivery'
OR label = 'LIH - Late Inhouse. Late delivery due to inhouse issues'
OR label = 'IHP - Inhouse proofreading issues (typos, numbers, etc.)'
OR label = 'TTI - Translator Terminology inaccurate, text does not read well in target Language';
IF 4 = v_count THEN
return 0;
END IF;
select survey_id into v_survey_id from survsimp_surveys where name = 'Project Translation Feedback'; select survey_id into v_survey_id from survsimp_surveys where name = 'Project Translation Feedback';
select acs_object__new (null, 'survsimp_question') into v_question_id; select acs_object__new (null, 'survsimp_question') into v_question_id;
...@@ -124,7 +148,6 @@ begin ...@@ -124,7 +148,6 @@ begin
'below' --new__presentation_alignment 'below' --new__presentation_alignment
); );
select survsimp_choice_id_sequence.nextval into v_next_choice_id from dual; select survsimp_choice_id_sequence.nextval into v_next_choice_id from dual;
insert into survsimp_question_choices (choice_id, question_id, label, sort_order) values (v_next_choice_id, v_question_id, 'TC - Issue with translator delivery resulting in late client delivery' ,1); insert into survsimp_question_choices (choice_id, question_id, label, sort_order) values (v_next_choice_id, v_question_id, 'TC - Issue with translator delivery resulting in late client delivery' ,1);
...@@ -154,6 +177,15 @@ declare ...@@ -154,6 +177,15 @@ declare
v_question_id integer; v_question_id integer;
begin begin
select count(*) into v_count
from survsimp_questions
where
question_text = 'Corrective Action';
IF 1 = v_count THEN
return 0;
END IF;
select survey_id into v_survey_id from survsimp_surveys where name = 'Project Translation Feedback'; select survey_id into v_survey_id from survsimp_surveys where name = 'Project Translation Feedback';
select acs_object__new (null, 'survsimp_question') into v_question_id; select acs_object__new (null, 'survsimp_question') into v_question_id;
...@@ -186,6 +218,16 @@ declare ...@@ -186,6 +218,16 @@ declare
v_question_id integer; v_question_id integer;
begin begin
select count(*) into v_count
from
survsimp_questions
where
question_text = 'Preventive Action';
IF 1 = v_count THEN
return 0;
END IF;
select survey_id into v_survey_id from survsimp_surveys where name = 'Project Translation Feedback'; select survey_id into v_survey_id from survsimp_surveys where name = 'Project Translation Feedback';
select acs_object__new (null, 'survsimp_question') into v_question_id; select acs_object__new (null, 'survsimp_question') into v_question_id;
...@@ -278,11 +320,11 @@ begin ...@@ -278,11 +320,11 @@ begin
null, -- context_id null, -- context_id
'Non-Comformity', -- plugin_name 'Non-Comformity', -- plugin_name
'intranet-trans-project-feedback', -- package_name 'intranet-trans-project-feedback', -- package_name
'left', -- location 'bottom', -- location
'/intranet-trans-project-feedback/dashboard', -- page_url '/intranet-trans-project-feedback/dashboard', -- page_url
null, -- view_name null, -- view_name
200, -- sort_order 200, -- sort_order
'im_project_translation_graph_panel "Non Comformity" "Column" $start_date $end_date $period', 'im_project_translation_graph_panel "Non Comformity" $start_date $end_date $period',
'lang::message::lookup "" intranet-trans-project-feedback.NonComformity "Non-Comformity"' 'lang::message::lookup "" intranet-trans-project-feedback.NonComformity "Non-Comformity"'
into v_plugin_id); into v_plugin_id);
...@@ -317,12 +359,12 @@ begin ...@@ -317,12 +359,12 @@ begin
null, -- context_id null, -- context_id
'Non-Comformity - Proportions', -- plugin_name 'Non-Comformity - Proportions', -- plugin_name
'intranet-trans-project-feedback', -- package_name 'intranet-trans-project-feedback', -- package_name
'left', -- location 'bottom', -- location
'/intranet-trans-project-feedback/dashboard', -- page_url '/intranet-trans-project-feedback/dashboard', -- page_url
null, -- view_name null, -- view_name
200, -- sort_order 200, -- sort_order
'im_project_translation_graph_panel "Non Comformity - Proportions" $start_date $end_date $period', 'im_project_translation_graph_panel "Non Comformity - Proportions" $start_date $end_date $period',
'lang::message::lookup "" intranet-trans-project-feedback.NonComformityPercentage "Non-Comformity - Percentage"' 'lang::message::lookup "" intranet-trans-project-feedback.NonComformityProportions "Non-Comformity - Proportions"'
into v_plugin_id); into v_plugin_id);
PERFORM im_grant_permission(v_plugin_id, v_employees, 'read'); PERFORM im_grant_permission(v_plugin_id, v_employees, 'read');
...@@ -357,7 +399,7 @@ begin ...@@ -357,7 +399,7 @@ begin
null, -- context_id null, -- context_id
'Non-Comformity - Percentage', -- plugin_name 'Non-Comformity - Percentage', -- plugin_name
'intranet-trans-project-feedback', -- package_name 'intranet-trans-project-feedback', -- package_name
'left', -- location 'bottom', -- location
'/intranet-trans-project-feedback/dashboard', -- page_url '/intranet-trans-project-feedback/dashboard', -- page_url
null, -- view_name null, -- view_name
200, -- sort_order 200, -- sort_order
...@@ -396,12 +438,12 @@ begin ...@@ -396,12 +438,12 @@ begin
null, -- context_id null, -- context_id
'Comformity vs. Non-Comformity', -- plugin_name 'Comformity vs. Non-Comformity', -- plugin_name
'intranet-trans-project-feedback', -- package_name 'intranet-trans-project-feedback', -- package_name
'left', -- location 'bottom', -- location
'/intranet-trans-project-feedback/dashboard', -- page_url '/intranet-trans-project-feedback/dashboard', -- page_url
null, -- view_name null, -- view_name
200, -- sort_order 200, -- sort_order
'im_project_translation_graph_panel "Conformity vs Non-Comformity" $start_date $end_date $period', 'im_project_translation_graph_panel "Conformity vs Non-Comformity" $start_date $end_date $period',
'lang::message::lookup "" intranet-trans-project-feedback.NonComformityType "Non-Comformity - Type"' 'lang::message::lookup "" intranet-trans-project-feedback.ConformityVSNonComformity "Conformity vs Non-Comformity"'
into v_plugin_id); into v_plugin_id);
PERFORM im_grant_permission(v_plugin_id, v_employees, 'read'); PERFORM im_grant_permission(v_plugin_id, v_employees, 'read');
...@@ -472,6 +514,11 @@ BEGIN ...@@ -472,6 +514,11 @@ BEGIN
where where
start_date::date = im_day_enumerator::date start_date::date = im_day_enumerator::date
and parent_id is null and parent_id is null
and project_id in (
select distinct sr.related_object_id
from survsimp_responses sr, survsimp_surveys ss
where ss.name = ''Project Translation Feedback'' and ss.survey_id = sr.survey_id
)
) as number_projects, ) as number_projects,
(select count(*) from ( (select count(*) from (
select distinct on (related_object_id) select distinct on (related_object_id)
...@@ -492,6 +539,11 @@ BEGIN ...@@ -492,6 +539,11 @@ BEGIN
and q.question_id = qr.question_id and q.question_id = qr.question_id
and qr.choice_id is not null and qr.choice_id is not null
and p.start_date::date = im_day_enumerator::date and p.start_date::date = im_day_enumerator::date
and p.project_id in (
select distinct sr.related_object_id
from survsimp_responses sr, survsimp_surveys ss
where ss.name = ''Project Translation Feedback'' and ss.survey_id = sr.survey_id
)
group by group by
r.related_object_id r.related_object_id
) p) as number_projects_non_conform ) p) as number_projects_non_conform
...@@ -500,7 +552,9 @@ BEGIN ...@@ -500,7 +552,9 @@ BEGIN
) s ) s
) t ) t
group by group by
t._%period%; t._%period%
order by
t._%period%;
' '
where where
report_code = 'translation_project_feedback_non_comformity'; report_code = 'translation_project_feedback_non_comformity';
...@@ -569,6 +623,11 @@ BEGIN ...@@ -569,6 +623,11 @@ BEGIN
and qr.choice_id is not null and qr.choice_id is not null
and p.start_date::date between ''%start_date%''::date and ''%end_date%''::date and p.start_date::date between ''%start_date%''::date and ''%end_date%''::date
and p.parent_id is null and p.parent_id is null
and project_id in (
select distinct sr.related_object_id
from survsimp_responses sr, survsimp_surveys ss
where ss.name = ''Project Translation Feedback'' and ss.survey_id = sr.survey_id
)
group by group by
choice_id; choice_id;
......
...@@ -60,3 +60,43 @@ DROP FUNCTION inline_0 (); ...@@ -60,3 +60,43 @@ DROP FUNCTION inline_0 ();
-- Delete REST reports -- Delete REST reports
delete from im_reports where report_code = 'translation-project-feedback-non-comformity'; delete from im_reports where report_code = 'translation-project-feedback-non-comformity';
delete from im_reports where report_code = 'translation_project_feedback_non_comformity_proportions'; delete from im_reports where report_code = 'translation_project_feedback_non_comformity_proportions';
-- delete component
CREATE OR REPLACE FUNCTION inline_0 ()
RETURNS INTEGER AS $BODY$
declare
v_plugin_id integer;
v_employees integer;
foo integer;
begin
select group_id into v_employees from groups where group_name = 'Employees';
select plugin_id into v_plugin_id from im_component_plugins where plugin_name = 'Project Translation Feedback' limit 1;
select im_revoke_permission(v_plugin_id, v_employees, 'read') into foo;
select im_component_plugin__delete(v_plugin_id) into foo;
select plugin_id into v_plugin_id from im_component_plugins where plugin_name = 'Non-Comformity' limit 1;
select im_revoke_permission(v_plugin_id, v_employees, 'read') into foo;
select im_component_plugin__delete(v_plugin_id) into foo;
select plugin_id into v_plugin_id from im_component_plugins where plugin_name = 'Non-Comformity - Proportions' limit 1;
select im_revoke_permission(v_plugin_id, v_employees, 'read') into foo;
select im_component_plugin__delete(v_plugin_id) into foo;
select plugin_id into v_plugin_id from im_component_plugins where plugin_name = 'Non-Comformity - Percentage' limit 1;
select im_revoke_permission(v_plugin_id, v_employees, 'read') into foo;
select im_component_plugin__delete(v_plugin_id) into foo;
select plugin_id into v_plugin_id from im_component_plugins where plugin_name = 'Comformity vs. Non-Comformity' limit 1;
select im_revoke_permission(v_plugin_id, v_employees, 'read') into foo;
select im_component_plugin__delete(v_plugin_id) into foo;
return 0;
end;$BODY$ LANGUAGE 'plpgsql';
SELECT inline_0 ();
DROP FUNCTION inline_0 ();
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