Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
support_lens
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
harshavardhan.c
support_lens
Commits
9a208466
Commit
9a208466
authored
Jan 05, 2021
by
harshavardhan.c
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added some enhancements in support lens module
parent
93b0c18b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
128 additions
and
9 deletions
+128
-9
scripts/config/app_constants.py
scripts/config/app_constants.py
+1
-0
scripts/core/handler/supportcase_setup_handler.py
scripts/core/handler/supportcase_setup_handler.py
+114
-9
scripts/core/services/supportcase_setup_configuration.py
scripts/core/services/supportcase_setup_configuration.py
+13
-0
No files found.
scripts/config/app_constants.py
View file @
9a208466
...
@@ -22,6 +22,7 @@ class Endpoints:
...
@@ -22,6 +22,7 @@ class Endpoints:
edit_support_case
=
base_url
+
"/support_case/edit"
edit_support_case
=
base_url
+
"/support_case/edit"
get_support_case_table_details
=
base_url
+
"/support_case/fetch_table"
get_support_case_table_details
=
base_url
+
"/support_case/fetch_table"
get_dashboard_details
=
base_url
+
"/support_case/get_dashboard_details"
get_dashboard_details
=
base_url
+
"/support_case/get_dashboard_details"
get_progress_cases
=
base_url
+
"/support_case/get_progress_cases"
class
DBMapping
:
class
DBMapping
:
...
...
scripts/core/handler/supportcase_setup_handler.py
View file @
9a208466
...
@@ -109,7 +109,7 @@ class TicketSetupHandler:
...
@@ -109,7 +109,7 @@ class TicketSetupHandler:
collection_name
=
DBMapping
.
user
,
collection_name
=
DBMapping
.
user
,
query
=
{
"user_id"
:
user
[
"user_id"
]})
query
=
{
"user_id"
:
user
[
"user_id"
]})
user
=
dict
(
userName
=
user_data
[
"username"
],
user_id
=
user
.
get
(
"user_id"
))
user
=
dict
(
userName
=
user_data
[
"username"
],
user_id
=
user
.
get
(
"user_id"
))
if
input_json
[
"type"
]
==
"
create
"
:
if
input_json
[
"type"
]
==
"
new
"
:
case_id
=
"case_"
+
self
.
new_id
.
get_next_id
(
"case"
)
case_id
=
"case_"
+
self
.
new_id
.
get_next_id
(
"case"
)
else
:
else
:
case_id
=
input_json
[
"case_id"
]
case_id
=
input_json
[
"case_id"
]
...
@@ -122,7 +122,7 @@ class TicketSetupHandler:
...
@@ -122,7 +122,7 @@ class TicketSetupHandler:
continue
continue
response
=
self
.
save_file_details
(
file_data
,
case_id
)
response
=
self
.
save_file_details
(
file_data
,
case_id
)
del
file_data
[
"attachment"
]
del
file_data
[
"attachment"
]
if
input_json
[
"type"
]
.
lower
()
==
"
create
"
:
if
input_json
[
"type"
]
.
lower
()
==
"
new
"
:
insert_json
=
dict
(
CategoryName
=
category_data
[
"CategoryName"
],
insert_json
=
dict
(
CategoryName
=
category_data
[
"CategoryName"
],
ProjectName
=
project_data
[
"customer_project_name"
],
ProjectName
=
project_data
[
"customer_project_name"
],
category_id
=
input_json
[
"category"
],
category_id
=
input_json
[
"category"
],
...
@@ -173,7 +173,7 @@ class TicketSetupHandler:
...
@@ -173,7 +173,7 @@ class TicketSetupHandler:
assigned_to
=
input_json
.
get
(
"assign"
),
assigned_to
=
input_json
.
get
(
"assign"
),
case_status
=
input_json
.
get
(
"status"
),
case_status
=
input_json
.
get
(
"status"
),
emailIds
=
input_json
.
get
(
"email"
),
emailIds
=
input_json
.
get
(
"email"
),
phoneNumbers
=
input_json
[
"phoneNumber"
]
)
phoneNumbers
=
input_json
.
get
(
"phoneNumber"
)
)
self
.
mongo_obj
.
update_one
(
db_name
=
DBMapping
.
support_lens_configuration
,
self
.
mongo_obj
.
update_one
(
db_name
=
DBMapping
.
support_lens_configuration
,
collection_name
=
DBMapping
.
ticket_configuration
,
collection_name
=
DBMapping
.
ticket_configuration
,
set_json
=
case_data
,
query
=
query_json
)
set_json
=
case_data
,
query
=
query_json
)
...
@@ -237,7 +237,8 @@ class TicketSetupHandler:
...
@@ -237,7 +237,8 @@ class TicketSetupHandler:
'subject'
:
"$subject"
,
'subject'
:
"$subject"
,
'fileNameBlock'
:
'$file_details'
,
'fileNameBlock'
:
'$file_details'
,
'description'
:
'$Description'
,
'description'
:
'$Description'
,
'contacts'
:
'$user_details'
,
'tab_type'
:
'$case_status'
,
'contacts'
:
'$user_details'
}
}
if
"model"
in
input_json
:
if
"model"
in
input_json
:
if
input_json
[
"model"
]
.
lower
()
==
"view"
:
if
input_json
[
"model"
]
.
lower
()
==
"view"
:
...
@@ -298,7 +299,7 @@ class TicketSetupHandler:
...
@@ -298,7 +299,7 @@ class TicketSetupHandler:
def
update_case_status
(
case_id
,
status_value
):
def
update_case_status
(
case_id
,
status_value
):
try
:
try
:
query
=
{
"case_id"
:
case_id
}
query
=
{
"case_id"
:
case_id
}
new_values
=
{
"$set"
:
{
"case_status"
:
status_value
}}
new_values
=
{
"$set"
:
{
"case_status"
:
status_value
,
"last_updated_on"
:
time
.
time
()
}}
ConnectionObj
.
mongo_connection_obj
.
update_one
(
db_name
=
DBMapping
.
support_lens_configuration
,
ConnectionObj
.
mongo_connection_obj
.
update_one
(
db_name
=
DBMapping
.
support_lens_configuration
,
collection_name
=
DBMapping
.
ticket_configuration
,
collection_name
=
DBMapping
.
ticket_configuration
,
query
=
query
,
set_json
=
new_values
)
query
=
query
,
set_json
=
new_values
)
...
@@ -319,7 +320,7 @@ class TicketSetupHandler:
...
@@ -319,7 +320,7 @@ class TicketSetupHandler:
{
{
'$match'
:
{
'$match'
:
{
'project_id'
:
input_json
[
"project_id"
],
'project_id'
:
input_json
[
"project_id"
],
'case_status'
:
input_json
[
"tab_name"
]
'case_status'
:
{
"$in"
:
input_json
[
"tab_name"
]}
}
}
},
{
},
{
'$project'
:
{
'$project'
:
{
...
@@ -332,6 +333,11 @@ class TicketSetupHandler:
...
@@ -332,6 +333,11 @@ class TicketSetupHandler:
'created_by'
:
'$created_by'
'created_by'
:
'$created_by'
}
}
},
},
{
'$sort'
:
{
'last_updated_on'
:
-
1
}
},
{
{
'$limit'
:
input_json
[
"records"
]
'$limit'
:
input_json
[
"records"
]
},
},
...
@@ -363,24 +369,44 @@ class TicketSetupHandler:
...
@@ -363,24 +369,44 @@ class TicketSetupHandler:
list_for_aggregation
=
json_data
))
list_for_aggregation
=
json_data
))
users_list
=
list
()
users_list
=
list
()
for
record
in
records
:
for
record
in
records
:
print
()
time_diff
=
datetime
.
fromtimestamp
(
time
.
time
())
-
datetime
.
fromtimestamp
(
record
[
"last_updated_on"
])
days_obj
=
time_diff
.
days
hour_obj
=
time_diff
.
seconds
//
3600
minutes_obj
=
time_diff
.
seconds
//
60
%
60
record
[
"created_by"
]
=
record
[
"created_by"
][
"userName"
]
.
replace
(
"_"
,
" "
)
.
replace
(
"-"
,
" "
)
.
title
()
record
[
"created_by"
]
=
record
[
"created_by"
][
"userName"
]
.
replace
(
"_"
,
" "
)
.
replace
(
"-"
,
" "
)
.
title
()
record
[
"last_updated_on"
]
=
datetime
.
fromtimestamp
(
record
[
"last_updated_on"
])
.
strftime
(
"
%
d
%
b
%
Y,
%
H:
%
M"
)
record
[
"last_updated_on"
]
=
datetime
.
fromtimestamp
(
record
[
"last_updated_on"
])
.
strftime
(
"
%
d
%
b
%
Y,
%
H:
%
M"
)
record
[
"expandData"
]
=
[{
"label"
:
str
(
key
)
.
replace
(
"_"
,
" "
)
.
replace
(
"-"
,
" "
)
.
title
(),
"value"
:
value
}
record
[
"expandData"
]
=
[{
"label"
:
str
(
key
)
.
replace
(
"_"
,
" "
)
.
replace
(
"-"
,
" "
)
.
title
(),
"value"
:
value
}
for
key
,
value
in
record
.
items
()]
for
key
,
value
in
record
.
items
()]
if
record
[
"created_by"
]
not
in
users_list
:
if
record
[
"created_by"
]
not
in
users_list
:
users_list
.
append
(
record
[
"created_by"
])
users_list
.
append
(
record
[
"created_by"
])
if
record
[
"status"
]
.
lower
()
==
"open"
:
record
[
"status"
]
=
record
[
"status"
]
.
title
()
record
[
"svgName"
]
=
"open.svg"
if
days_obj
!=
0
:
record
[
"time"
]
=
f
"{days_obj} days {hour_obj} hour {minutes_obj} minutes ago"
else
:
if
hour_obj
!=
0
:
record
[
"time"
]
=
f
"{hour_obj} hour {minutes_obj} minutes ago"
else
:
record
[
"time"
]
=
f
"{minutes_obj} minutes ago"
users_data
=
deepcopy
(
final_json
[
"data"
][
"tableData"
][
"headerContent"
][
-
2
])
users_data
=
deepcopy
(
final_json
[
"data"
][
"tableData"
][
"headerContent"
][
-
2
])
users_data
[
"options"
]
=
[{
"label"
:
str
(
user
)
.
replace
(
"_"
,
" "
)
.
replace
(
"-"
,
" "
)
.
title
(),
"value"
:
user
}
users_data
[
"options"
]
=
[{
"label"
:
str
(
user
)
.
replace
(
"_"
,
" "
)
.
replace
(
"-"
,
" "
)
.
title
(),
"value"
:
user
}
for
user
in
users_list
]
for
user
in
users_list
]
if
len
(
input_json
[
"tab_name"
]):
if
input_json
[
"tab_name"
][
0
]
in
[
"closed"
,
"deleted"
]:
final_json
[
"data"
][
"tableActions"
]
=
dict
()
final_json
[
"data"
][
"tableData"
][
"headerContent"
][
-
2
]
=
deepcopy
(
users_data
)
final_json
[
"data"
][
"tableData"
][
"headerContent"
][
-
2
]
=
deepcopy
(
users_data
)
final_json
.
update
(
status
=
StatusMessages
.
SUCCESS
,
message
=
StatusMessages
.
SUCCESS
)
final_json
.
update
(
status
=
StatusMessages
.
SUCCESS
,
message
=
StatusMessages
.
SUCCESS
)
final_json
[
"data"
][
"tableData"
]
.
update
(
bodyContent
=
deepcopy
(
records
))
final_json
[
"data"
][
"tableData"
]
.
update
(
bodyContent
=
deepcopy
(
records
))
final_json
[
"data"
][
"total_no"
]
=
len
(
total_records
)
final_json
[
"data"
][
"total_no"
]
=
len
(
total_records
)
if
len
(
total_records
)
>
=
(
int
(
input_json
[
"records"
])
*
int
(
input_json
[
"page"
])):
if
len
(
total_records
)
<
=
(
int
(
input_json
[
"records"
])
*
int
(
input_json
[
"page"
])):
final_json
[
"end_of_records"
]
=
True
final_json
[
"
data"
][
"
end_of_records"
]
=
True
else
:
else
:
final_json
[
"end_of_records"
]
=
False
final_json
[
"
data"
][
"
end_of_records"
]
=
False
if
input_json
[
"enable_tab"
]:
if
input_json
[
"enable_tab"
]:
final_json
[
"tab_count"
]
=
self
.
get_case_count_details
(
input_json
=
input_json
,
final_json
[
"tab_count"
]
=
self
.
get_case_count_details
(
input_json
=
input_json
,
filter_value
=
"support_lens_table_header_content"
)
filter_value
=
"support_lens_table_header_content"
)
...
@@ -455,3 +481,82 @@ class TicketSetupHandler:
...
@@ -455,3 +481,82 @@ class TicketSetupHandler:
except
Exception
as
e
:
except
Exception
as
e
:
logger
.
exception
(
str
(
e
))
logger
.
exception
(
str
(
e
))
return
final_json
[
"data"
]
return
final_json
[
"data"
]
def
get_dashboard_category_details
(
self
,
input_json
):
final_json
=
dict
(
status
=
StatusMessages
.
FAILED
,
message
=
StatusMessages
.
FAILED
,
data
=
dict
())
try
:
record_data
=
list
(
self
.
mongo_obj
.
aggregate
(
db_name
=
DBMapping
.
support_lens_configuration
,
collection_name
=
DBMapping
.
ticket_configuration
,
list_for_aggregation
=
[
{
'$match'
:
{
'project_id'
:
input_json
[
"project_id"
],
'case_status'
:
{
'$in'
:
input_json
[
"tab_name"
]
}
}
}]))
return_json
=
list
()
category_json
=
dict
()
users_json
=
dict
()
for
record
in
record_data
:
if
record
[
"CategoryName"
]
not
in
category_json
:
category_json
.
update
({
record
[
"CategoryName"
]:
0
})
category_json
[
record
[
"CategoryName"
]]
=
category_json
[
record
[
"CategoryName"
]]
+
1
for
record
in
record_data
:
if
"assigned_to"
not
in
record
:
continue
if
record
[
"assigned_to"
]
not
in
users_json
:
users_json
.
update
({
record
[
"assigned_to"
]:
0
})
users_json
[
record
[
"assigned_to"
]]
=
users_json
[
record
[
"assigned_to"
]]
+
1
if
input_json
[
"progress_type"
]
==
"engineerWise"
:
users_data
=
list
(
self
.
mongo_obj
.
aggregate
(
db_name
=
DBMapping
.
ilens_configuration
,
collection_name
=
DBMapping
.
user
,
list_for_aggregation
=
[
{
'$match'
:
{
'user_id'
:
{
"$in"
:
list
(
users_json
.
keys
())}
}
}
]))
users_list
=
dict
()
for
user
in
users_data
:
users_list
.
update
({
user
[
"user_id"
]:
user
[
"username"
]})
for
key
,
value
in
users_json
.
items
():
return_json
.
append
({
"name"
:
users_list
[
key
],
"subTitle"
:
f
"{value} Cases"
,
"bars"
:
[
{
"value"
:
value
*
10
,
"color"
:
"#FFCA28"
,
"label"
:
f
"{value} Cases"
}
]
})
final_json
=
dict
(
status
=
StatusMessages
.
SUCCESS
,
message
=
StatusMessages
.
SUCCESS
,
data
=
dict
(
engineerWise
=
deepcopy
(
return_json
)))
else
:
for
key
,
value
in
category_json
.
items
():
return_json
.
append
({
"name"
:
key
,
"subTitle"
:
f
"{value} Cases"
,
"bars"
:
[
{
"value"
:
value
*
10
,
"color"
:
"#FFCA28"
,
"label"
:
f
"{value} Cases"
}
]
})
final_json
=
dict
(
status
=
StatusMessages
.
SUCCESS
,
message
=
StatusMessages
.
SUCCESS
,
data
=
dict
(
categoryWise
=
deepcopy
(
return_json
)))
except
Exception
as
e
:
logger
.
exception
(
str
(
e
))
return
final_json
scripts/core/services/supportcase_setup_configuration.py
View file @
9a208466
...
@@ -96,3 +96,16 @@ def get_dashboard_details():
...
@@ -96,3 +96,16 @@ def get_dashboard_details():
except
Exception
as
e
:
except
Exception
as
e
:
logger
.
exception
(
"Exception ->
%
s"
%
str
(
e
))
logger
.
exception
(
"Exception ->
%
s"
%
str
(
e
))
return
final_json
return
final_json
@
supportcase_setup_configuration
.
route
(
Endpoints
.
get_progress_cases
,
methods
=
[
'POST'
])
@
apply_encryption
def
get_dashboard_category_details
():
final_json
=
{
"status"
:
StatusMessages
.
FAILED
,
"message"
:
StatusMessages
.
FAILED
}
try
:
input_data
=
request
.
data
# input_data = request.get_json()
final_json
=
handler_obj
.
get_dashboard_category_details
(
input_data
)
except
Exception
as
e
:
logger
.
exception
(
"Exception ->
%
s"
%
str
(
e
))
return
final_json
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment