Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
students
butter-studio
Commits
2846f9ac
Commit
2846f9ac
authored
Aug 11, 2021
by
Kim, Subin
Browse files
TimeTable-if문 조건 변경&timetableCtrl-partTime수정완료
parent
4ed0613a
Changes
2
Show whitespace changes
Inline
Side-by-side
client/src/components/Admin/TimeTable.js
View file @
2846f9ac
...
...
@@ -62,7 +62,7 @@ const TimeTable = ({ ticketInfo = { movieId: 0 }, setTicketInfo }) => {
timeList
.
map
(
el
=>
<
div
className
=
"
mt-4
"
>
<
h5
className
=
"
mb-0
"
>
{
el
.
theaterName
}
관
/
<
p
className
=
"
d-inline fs-6 mb-0
"
>
{
el
.
theaterTypeName
}
<
/p></
h5
>
{
el
.
timetable
.
map
(
time
=>
{
if
(
ticketInfo
)
if
(
ticketInfo
.
movieId
!==
0
)
return
<
div
className
=
"
d-inline-flex m-2
"
>
<
div
className
=
{
`card text-dark
${
styles
.
cursor
}
`
}
onClick
=
{()
=>
handleClick
(
time
)}
>
<
div
className
=
"
card-body py-1
"
>
{
moment
(
time
.
start_time
).
format
(
'
HH:mm
'
)}
~
{
moment
(
time
.
end_time
).
format
(
'
HH:mm
'
)}
<
/div
>
...
...
server/controllers/timetable.controller.js
View file @
2846f9ac
...
...
@@ -8,7 +8,7 @@ const getAll = async (req, res) => {
const
selectDate
=
new
Date
(
when
)
let
findAll
=
null
const
theaterArr
=
[]
findAll
=
movieId
?
await
TimeTable
.
findAll
({
where
:
{
date
:
selectDate
,
movieId
:
movieId
},
attributes
:
{
exclude
:
[
'
createdAt
'
,
'
updatedAt
'
]
},
order
:
[[
"
theaterId
"
,
"
ASC
"
],
[
"
start_time
"
,
"
ASC
"
]],
include
:
[
Theater
]
})
findAll
=
movieId
!==
"
0
"
?
await
TimeTable
.
findAll
({
where
:
{
date
:
selectDate
,
movieId
:
movieId
},
attributes
:
{
exclude
:
[
'
createdAt
'
,
'
updatedAt
'
]
},
order
:
[[
"
theaterId
"
,
"
ASC
"
],
[
"
start_time
"
,
"
ASC
"
]],
include
:
[
Theater
]
})
:
await
TimeTable
.
findAll
({
where
:
{
date
:
selectDate
},
attributes
:
{
exclude
:
[
'
createdAt
'
,
'
updatedAt
'
]
},
order
:
[[
"
theaterId
"
,
"
ASC
"
],
[
"
start_time
"
,
"
ASC
"
]],
include
:
[
Theater
]
})
findAll
.
forEach
(
async
(
element
)
=>
{
if
(
!
theaterArr
.
includes
(
element
.
theaterId
))
theaterArr
.
push
(
element
.
theaterId
)
...
...
@@ -65,9 +65,13 @@ const submit = async (req, res) => {
await
Promise
.
all
(
theater
.
map
(
async
(
theater
)
=>
{
let
partTime
=
""
if
(
'
06:00
'
<=
theater
.
start
&&
theater
.
start
<
'
10:00
'
)
partTime
=
"
morning
"
else
if
(
'
00:00
'
<=
theater
.
start
<
'
06:00
'
)
partTime
=
"
night
"
else
partTime
=
"
day
"
if
(
'
06:00
'
<=
theater
.
start
&&
theater
.
start
<
'
10:00
'
)
{
partTime
=
"
morning
"
}
else
if
(
'
00:00
'
<=
theater
.
start
&&
theater
.
start
<
'
06:00
'
)
{
partTime
=
"
night
"
}
else
{
partTime
=
"
day
"
}
await
TimeTable
.
create
({
theaterId
:
theater
.
theater
,
movieId
,
title
,
release_date
,
date
:
curDate
,
start_time
:
getTime
(
theater
.
start
),
end_time
:
getTime
(
theater
.
start
,
runtime
),
partTime
:
partTime
,
week
:
(
day
===
0
||
day
===
6
)
?
"
weekend
"
:
"
weekdays
"
})
})
)
...
...
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