Skip to content

Commit 9c8693d

Browse files
authored
Merge pull request #775 from buerokratt/v3.3.1
merging v3.3.1 to test
2 parents 8fe6b38 + 6e2c44a commit 9c8693d

55 files changed

Lines changed: 2517 additions & 617 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
-- liquibase formatted sql
2+
-- changeset 1AhmedYasser:1782650769
3+
ALTER TYPE overview_metric ADD VALUE IF NOT EXISTS 'total_chats';
4+
ALTER TYPE overview_metric ADD VALUE IF NOT EXISTS 'avg_waiting_time';
5+
ALTER TYPE overview_metric ADD VALUE IF NOT EXISTS 'avg_rating';
6+
ALTER TYPE overview_metric ADD VALUE IF NOT EXISTS 'burokratt_rate';
7+
ALTER TYPE overview_metric ADD VALUE IF NOT EXISTS 'csa_rate';
8+
ALTER TYPE overview_metric ADD VALUE IF NOT EXISTS 'redirected_rate';
9+
ALTER TYPE overview_metric ADD VALUE IF NOT EXISTS 'left_without_answer_rate';
10+
ALTER TYPE overview_metric ADD VALUE IF NOT EXISTS 'chart';
11+
ALTER TYPE overview_metric ADD VALUE IF NOT EXISTS 'positive_feedback';
12+
ALTER TYPE overview_metric ADD VALUE IF NOT EXISTS 'quality';
13+
ALTER TYPE overview_metric ADD VALUE IF NOT EXISTS 'themes';
14+
ALTER TYPE overview_metric ADD VALUE IF NOT EXISTS 'follow_up';
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
-- liquibase formatted sql
2+
-- changeset 1AhmedYasser:1782650770
3+
INSERT INTO user_overview_metric_preference (user_id_code, metric, ordinality, active)
4+
SELECT
5+
"user".id_code,
6+
new_metric.metric,
7+
100 + ROW_NUMBER() OVER (PARTITION BY "user".id_code ORDER BY new_metric.metric::text),
8+
TRUE
9+
FROM "user"
10+
CROSS JOIN unnest(ARRAY[
11+
'total_chats',
12+
'avg_waiting_time',
13+
'avg_rating',
14+
'burokratt_rate',
15+
'csa_rate',
16+
'redirected_rate',
17+
'left_without_answer_rate',
18+
'chart',
19+
'positive_feedback',
20+
'quality',
21+
'themes',
22+
'follow_up'
23+
]::overview_metric[]) AS new_metric(metric)
24+
WHERE NOT EXISTS (
25+
SELECT 1
26+
FROM user_overview_metric_preference p
27+
WHERE p.user_id_code = "user".id_code
28+
AND p.metric = new_metric.metric
29+
);
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
WITH botname AS (
2+
SELECT "value"
3+
FROM "configuration"
4+
WHERE "key" = 'bot_institution_id'
5+
LIMIT 1
6+
), customer_support_changes AS (
7+
SELECT base_id,
8+
customer_support_id,
9+
updated,
10+
lag(customer_support_id) over (
11+
PARTITION by base_id
12+
ORDER BY updated
13+
) AS prev_support_id,
14+
lag(updated) over (
15+
PARTITION by base_id
16+
ORDER BY updated
17+
) AS prev_updated
18+
FROM chat
19+
WHERE (
20+
array_length(ARRAY[:urls]::text[], 1) IS NULL
21+
OR (array_length(ARRAY[:urls]::text[], 1) = 1 AND (ARRAY[:urls]::text[])[1] = 'none')
22+
OR chat.end_user_url LIKE ANY(ARRAY[:urls]::text[])
23+
)
24+
AND (
25+
:showTest = TRUE
26+
OR chat.test = FALSE
27+
)
28+
AND chat.status = 'ENDED'
29+
AND chat.ended::timestamptz BETWEEN :start::timestamptz AND :end::timestamptz
30+
)
31+
SELECT
32+
COALESCE(
33+
AVG(
34+
extract(
35+
epoch
36+
FROM (updated - prev_updated)
37+
)
38+
) FILTER (
39+
WHERE prev_support_id = ''
40+
AND customer_support_id NOT IN (
41+
(SELECT "value" FROM botname),
42+
''
43+
)
44+
),
45+
0
46+
) AS metric_value
47+
FROM customer_support_changes;
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
WITH rating_config AS (
2+
SELECT value AS is_five_rating_scale
3+
FROM configuration
4+
WHERE key = 'isFiveRatingScale'
5+
AND "domain" IS NULL
6+
AND id IN (SELECT max(id) FROM configuration WHERE key = 'isFiveRatingScale' AND "domain" IS NULL)
7+
AND NOT deleted
8+
),
9+
latest_chats AS (
10+
SELECT DISTINCT ON (base_id)
11+
base_id,
12+
test
13+
FROM chat
14+
ORDER BY base_id, updated DESC
15+
),
16+
rated_chats AS (
17+
SELECT chat.base_id,
18+
CASE
19+
WHEN (SELECT COALESCE(is_five_rating_scale, 'false') = 'true' FROM rating_config)
20+
THEN chat.feedback_rating_five
21+
ELSE chat.feedback_rating
22+
END AS rating
23+
FROM chat
24+
WHERE chat.status = 'ENDED'
25+
AND chat.ended::timestamptz BETWEEN :start::timestamptz AND :end::timestamptz
26+
AND (
27+
array_length(ARRAY[:urls]::TEXT[], 1) IS NULL
28+
OR chat.end_user_url LIKE ANY(ARRAY[:urls]::TEXT[])
29+
)
30+
AND (
31+
COALESCE(:showTest, FALSE) = TRUE
32+
OR EXISTS (
33+
SELECT 1
34+
FROM latest_chats
35+
WHERE latest_chats.base_id = chat.base_id
36+
AND COALESCE(latest_chats.test, FALSE) = FALSE
37+
)
38+
)
39+
)
40+
SELECT ROUND(AVG(rating), 1) AS metric_value
41+
FROM rated_chats
42+
WHERE rating IS NOT NULL;
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
WITH botname AS (
2+
SELECT "value"
3+
FROM "configuration"
4+
WHERE "key" = 'bot_institution_id'
5+
LIMIT 1
6+
),
7+
ended_chats AS (
8+
SELECT DISTINCT ON (c.base_id)
9+
c.base_id,
10+
c.test,
11+
c.end_user_url
12+
FROM chat c
13+
WHERE c.status = 'ENDED'
14+
AND c.ended::timestamptz BETWEEN :start::timestamptz AND :end::timestamptz
15+
ORDER BY c.base_id, c.updated DESC
16+
),
17+
filtered_chats AS (
18+
SELECT base_id
19+
FROM ended_chats ec
20+
WHERE (:showTest = TRUE OR ec.test = FALSE)
21+
AND (
22+
array_length(ARRAY[:urls]::TEXT[], 1) IS NULL
23+
OR (array_length(ARRAY[:urls]::TEXT[], 1) = 1 AND (ARRAY[:urls]::TEXT[])[1] = 'none')
24+
OR ec.end_user_url LIKE ANY(ARRAY[:urls]::TEXT[])
25+
)
26+
),
27+
csa_per_chat AS (
28+
SELECT c.base_id,
29+
COUNT(DISTINCT c.customer_support_id) AS distinct_csa_count
30+
FROM chat c
31+
JOIN filtered_chats fc ON fc.base_id = c.base_id
32+
WHERE c.customer_support_id IS NOT NULL
33+
AND c.customer_support_id <> ''
34+
AND c.customer_support_id NOT IN (SELECT "value" FROM botname)
35+
GROUP BY c.base_id
36+
)
37+
SELECT
38+
COUNT(*) FILTER (WHERE distinct_csa_count > 1) AS multi_csa_chats,
39+
COUNT(*) AS total_csa_chats
40+
FROM csa_per_chat;

‎DSL/Ruuter/analytics/POST/chats/avg-median-waiting-time.yml‎

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ check_median:
8686
empty_median:
8787
assign:
8888
median_result: ${[]}
89-
next: respond
89+
next: check_handoff
9090

9191
median:
9292
call: http.post
@@ -101,8 +101,34 @@ median:
101101
result: results
102102

103103
assign_median:
104-
assign:
104+
assign:
105105
median_result: ${results.response.body}
106+
next: check_handoff
107+
108+
check_handoff:
109+
switch:
110+
- condition: ${options.includes('handoff')}
111+
next: handoff
112+
113+
empty_handoff:
114+
assign:
115+
handoff_result: ${[]}
116+
next: respond
117+
118+
handoff:
119+
call: http.post
120+
args:
121+
url: "[#ANALYTICS_RESQL]/overview-avg-waiting-time-range"
122+
body:
123+
start: ${start}
124+
end: ${end}
125+
urls: ${urls}
126+
showTest: ${showTest}
127+
result: results
128+
129+
assign_handoff:
130+
assign:
131+
handoff_result: ${results.response.body}
106132

107133
respond:
108-
return: ${[avg_result, median_result]}
134+
return: ${[avg_result, median_result, handoff_result]}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
declaration:
2+
call: declare
3+
version: 0.1
4+
description: "Redirected to another CSA overview metric for chat analytics"
5+
method: post
6+
accepts: json
7+
returns: json
8+
namespace: analytics
9+
allowlist:
10+
body:
11+
- field: end_date
12+
type: string
13+
description: "Body field 'end_date'"
14+
- field: start_date
15+
type: string
16+
description: "Body field 'start_date'"
17+
- field: urls
18+
type: array
19+
description: "Body field 'urls'"
20+
- field: showTest
21+
type: boolean
22+
description: "Body field 'showTest'"
23+
24+
check_for_required_parameters:
25+
switch:
26+
- condition: ${incoming.body.start_date == null || incoming.body.end_date == null}
27+
next: return_incorrect_request
28+
next: post_step
29+
30+
post_step:
31+
call: http.post
32+
args:
33+
url: "[#ANALYTICS_RESQL]/overview-redirected-csa-range"
34+
body:
35+
start: ${incoming.body.start_date}
36+
end: ${incoming.body.end_date}
37+
urls: ${incoming.body.urls}
38+
showTest: ${incoming.body.showTest}
39+
result: result
40+
41+
return_value:
42+
return: ${result.response.body}
43+
next: end
44+
45+
return_incorrect_request:
46+
status: 400
47+
return: 'missing parameters'
48+
next: end

‎DSL/Ruuter/analytics/POST/feedbacks/avg.yml‎

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,20 @@ declaration:
2323
- field: showTest
2424
type: boolean
2525
description: "Body field 'showTest'"
26+
- field: combined
27+
type: boolean
28+
description: "Body field 'combined'"
2629

2730
check_for_required_parameters:
2831
switch:
29-
- condition: ${incoming.body == null || incoming.body.metric == null || incoming.body.start_date == null || incoming.body.end_date == null}
32+
- condition: ${incoming.body == null || incoming.body.start_date == null || incoming.body.end_date == null}
3033
next: return_incorrect_request
34+
next: check_combined
35+
36+
check_combined:
37+
switch:
38+
- condition: ${incoming.body.combined == true}
39+
next: post_step_combined
3140
next: post_step
3241

3342
post_step:
@@ -41,6 +50,19 @@ post_step:
4150
urls: ${incoming.body.urls}
4251
showTest: ${incoming.body.showTest}
4352
result: result
53+
next: return_value
54+
55+
post_step_combined:
56+
call: http.post
57+
args:
58+
url: "[#ANALYTICS_RESQL]/overview-feedback-avg-range"
59+
body:
60+
start: ${incoming.body.start_date}
61+
end: ${incoming.body.end_date}
62+
urls: ${incoming.body.urls}
63+
showTest: ${incoming.body.showTest}
64+
result: result
65+
next: return_value
4466

4567
return_value:
4668
return: ${result.response.body}

‎GUI/package.json‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
"private": true,
55
"type": "module",
66
"dependencies": {
7-
"@buerokratt-ria/header": "^0.1.52",
7+
"@buerokratt-ria/header": "^0.1.53",
88
"@buerokratt-ria/menu": "^0.2.15",
99
"@buerokratt-ria/styles": "^0.0.1",
10-
"@buerokratt-ria/common-gui-components": "^0.0.62",
10+
"@buerokratt-ria/common-gui-components": "^0.0.63",
1111
"@fontsource/roboto": "^4.5.8",
1212
"@formkit/auto-animate": "^1.0.0-beta.6",
1313
"@hookform/resolvers": "^2.9.11",
@@ -35,8 +35,6 @@
3535
"react": "^18.2.0",
3636
"react-cookie": "^4.1.1",
3737
"react-datepicker": "^4.10.0",
38-
"react-dnd": "^16.0.1",
39-
"react-dnd-html5-backend": "^16.0.1",
4038
"react-dom": "^18.2.0",
4139
"react-hook-form": "^7.43.1",
4240
"react-i18next": "^12.1.4",

‎GUI/src/components/FormElements/FormDatepicker/index.tsx‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { forwardRef, useId } from 'react';
1+
import React, { forwardRef, useId, ReactNode } from 'react';
22
import ReactDatePicker, { registerLocale } from 'react-datepicker';
33
import clsx from 'clsx';
44
import { et } from 'date-fns/locale';
@@ -21,6 +21,7 @@ type FormDatepickerProps = ControllerRenderProps & {
2121
timePicker?: boolean;
2222
monthPicker?: boolean;
2323
portalId?: string;
24+
trailingIcon?: ReactNode;
2425
}
2526

2627
const FormDatepicker = forwardRef<any, FormDatepickerProps>((
@@ -33,6 +34,7 @@ const FormDatepicker = forwardRef<any, FormDatepickerProps>((
3334
timePicker,
3435
monthPicker,
3536
portalId = 'overlay-root',
37+
trailingIcon,
3638
...rest
3739
},
3840
ref,
@@ -74,11 +76,12 @@ const FormDatepicker = forwardRef<any, FormDatepickerProps>((
7476
onChange={onChange}
7577
/>
7678
<Icon
77-
icon={timePicker
79+
icon={trailingIcon ?? (timePicker
7880
? (<MdOutlineSchedule color='#5D6071' fontSize={20} />)
7981
: (<MdOutlineToday color='#5D6071' fontSize={20} />)
80-
}
81-
size='medium' />
82+
)}
83+
size={trailingIcon ? 'small' : 'medium'}
84+
/>
8285
</div>
8386
</div>
8487
);

0 commit comments

Comments
 (0)