Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
Ticket Booking Task
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
ajil.k
Ticket Booking Task
Commits
ef70a1a2
Commit
ef70a1a2
authored
Feb 15, 2023
by
ajil.k
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated the integrated code with all modules
parent
3e0b3640
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
3 deletions
+48
-3
external/booking_from_2023-02-12_to_2023-02-13_.xlsx.json
external/booking_from_2023-02-12_to_2023-02-13_.xlsx.json
+44
-0
scripts/core/handlers/api_functions.py
scripts/core/handlers/api_functions.py
+2
-2
scripts/services/api_call.py
scripts/services/api_call.py
+2
-1
No files found.
external/booking
s
.json
→
external/booking
_from_2023-02-12_to_2023-02-13_.xlsx
.json
View file @
ef70a1a2
...
@@ -10,56 +10,6 @@
...
@@ -10,56 +10,6 @@
"column7"
:
"age"
"column7"
:
"age"
},
},
"body"
:
[
"body"
:
[
{
"booking_id"
:
5
,
"mobile_no"
:
46356754
,
"no_of_tickets"
:
1
,
"date_of_purchase"
:
"2023-02-14"
,
"deleted"
:
true
,
"preferred_class"
:
"silver"
,
"seat_numbers"
:
"40"
,
"age"
:
30
},
{
"booking_id"
:
6
,
"mobile_no"
:
76788655566
,
"no_of_tickets"
:
2
,
"date_of_purchase"
:
"2023-02-14"
,
"deleted"
:
true
,
"preferred_class"
:
"gold"
,
"seat_numbers"
:
"209,210"
,
"age"
:
66
},
{
"booking_id"
:
4
,
"mobile_no"
:
33332233450
,
"no_of_tickets"
:
5
,
"date_of_purchase"
:
"2023-02-14"
,
"deleted"
:
true
,
"preferred_class"
:
"gold"
,
"seat_numbers"
:
"20,21,22,23,24"
,
"age"
:
30
},
{
"booking_id"
:
8
,
"mobile_no"
:
7766554433
,
"no_of_tickets"
:
2
,
"date_of_purchase"
:
"2023-02-14"
,
"deleted"
:
true
,
"preferred_class"
:
"silver"
,
"seat_numbers"
:
"101,100"
,
"age"
:
67
},
{
"booking_id"
:
7
,
"mobile_no"
:
7766554433
,
"no_of_tickets"
:
2
,
"date_of_purchase"
:
"2023-02-14"
,
"deleted"
:
true
,
"preferred_class"
:
"silver"
,
"seat_numbers"
:
"99,98"
,
"age"
:
67
},
{
{
"booking_id"
:
1
,
"booking_id"
:
1
,
"mobile_no"
:
786545676
,
"mobile_no"
:
786545676
,
...
...
scripts/core/handlers/api_functions.py
View file @
ef70a1a2
...
@@ -121,14 +121,14 @@ class Tickets:
...
@@ -121,14 +121,14 @@ class Tickets:
logger
.
error
(
e
)
logger
.
error
(
e
)
@
staticmethod
@
staticmethod
def
json_data
(
dataframe
):
def
json_data
(
filename
,
dataframe
):
try
:
try
:
dataframe
[
"date_of_purchase"
]
=
dataframe
[
"date_of_purchase"
]
.
dt
.
strftime
(
'
%
Y-
%
m-
%
d'
)
dataframe
[
"date_of_purchase"
]
=
dataframe
[
"date_of_purchase"
]
.
dt
.
strftime
(
'
%
Y-
%
m-
%
d'
)
keys
=
[
f
"column{i}"
for
i
in
range
(
len
(
dataframe
.
columns
))]
keys
=
[
f
"column{i}"
for
i
in
range
(
len
(
dataframe
.
columns
))]
header_dict
=
{
'header'
:
dict
(
zip
(
keys
,
dataframe
.
columns
))}
header_dict
=
{
'header'
:
dict
(
zip
(
keys
,
dataframe
.
columns
))}
data
=
{
"body"
:
dataframe
.
to_dict
(
orient
=
'records'
)}
data
=
{
"body"
:
dataframe
.
to_dict
(
orient
=
'records'
)}
json_dict
=
{
**
header_dict
,
**
data
}
json_dict
=
{
**
header_dict
,
**
data
}
with
open
(
"external/bookings
.json"
,
"w"
)
as
json_file
:
with
open
(
f
"external/{filename}
.json"
,
"w"
)
as
json_file
:
json
.
dump
(
json_dict
,
json_file
,
indent
=
4
)
json
.
dump
(
json_dict
,
json_file
,
indent
=
4
)
return
json_dict
return
json_dict
except
Exception
as
e
:
except
Exception
as
e
:
...
...
scripts/services/api_call.py
View file @
ef70a1a2
...
@@ -65,7 +65,8 @@ def generate_seats():
...
@@ -65,7 +65,8 @@ def generate_seats():
async
def
booking_details_json_format
(
file
:
UploadFile
):
async
def
booking_details_json_format
(
file
:
UploadFile
):
try
:
try
:
excel_file
=
pd
.
read_excel
(
await
file
.
read
())
excel_file
=
pd
.
read_excel
(
await
file
.
read
())
message
=
Tickets
()
.
json_data
(
excel_file
)
excel_filename
=
file
.
filename
message
=
Tickets
()
.
json_data
(
excel_filename
,
excel_file
)
return
message
return
message
except
Exception
as
e
:
except
Exception
as
e
:
logger
.
error
(
e
)
logger
.
error
(
e
)
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