Commit cb6ad5d9 authored by Jiwon Yoon's avatar Jiwon Yoon
Browse files

예매율

parent c6fcbcbe
...@@ -25,7 +25,7 @@ const MovieCard = ({ list }) => { ...@@ -25,7 +25,7 @@ const MovieCard = ({ list }) => {
<div className="card-body text-light"> <div className="card-body text-light">
{movie.adult? <image src="/images/19.png" /> :<></>} {movie.adult? <image src="/images/19.png" /> :<></>}
<div className={`h4 card-title text-center ${styles.title}`}>{movie.title}</div> <div className={`h4 card-title text-center ${styles.title}`}>{movie.title}</div>
<p className={`card-text text-center ${styles.txt}`}>예매율: {movie.ticket_sales}0% | {movie.runtime}</p> <p className={`card-text text-center ${styles.txt}`}>예매율: {Math.round((movie.ticket_sales/movie.totalReservationRate.totalReservationRate)*100)}% | {movie.runtime}</p>
<p className="card-text text-center"><small className="text-muted">{movie.release_date} 개봉</small></p> <p className="card-text text-center"><small className="text-muted">{movie.release_date} 개봉</small></p>
</div> </div>
<Link to={{ <Link to={{
......
...@@ -44,7 +44,7 @@ const MovieComing = () => { ...@@ -44,7 +44,7 @@ const MovieComing = () => {
<div className="card-body text-light"> <div className="card-body text-light">
{movie.adult ? <image src="/images/19.png" /> : <></>} {movie.adult ? <image src="/images/19.png" /> : <></>}
<div className={`h4 card-title text-center ${styles.title}`}>{movie.title}</div> <div className={`h4 card-title text-center ${styles.title}`}>{movie.title}</div>
<p className={`card-text text-center ${styles.txt}`}>예매율: {movie.ticket_sales}0% | {movie.runtime}</p> <p className={`card-text text-center ${styles.txt}`}>{movie.runtime}</p>
<p className="card-text text-center"><small className="text-muted">{movie.release_date} 개봉</small></p> <p className="card-text text-center"><small className="text-muted">{movie.release_date} 개봉</small></p>
</div> </div>
<Link to={{ <Link to={{
......
...@@ -7,6 +7,7 @@ import styles from '../components/SeatTable/seatTable.module.scss' ...@@ -7,6 +7,7 @@ import styles from '../components/SeatTable/seatTable.module.scss'
import axios from 'axios' import axios from 'axios'
import { useAuth } from '../context/auth_context.js' import { useAuth } from '../context/auth_context.js'
import catchErrors from '../utils/catchErrors' import catchErrors from '../utils/catchErrors'
import { right } from '@popperjs/core'
const TicketingSeatPage = ({ location }) => { const TicketingSeatPage = ({ location }) => {
const history = useHistory() const history = useHistory()
...@@ -118,9 +119,9 @@ const TicketingSeatPage = ({ location }) => { ...@@ -118,9 +119,9 @@ const TicketingSeatPage = ({ location }) => {
</div> </div>
</div> </div>
<div className="row justify-content-center my-3"> <div className="row justify-content-center my-3">
<div className="col-sm-6 mb-4 text-center"> <div className="col-sm-4 mb-4">
<div className="row text-end justify-content-sm-end"> <div className="row text-end justify-content-sm-end">
<div className="col-sm-6 me-5"> <div className="col-sm-6 me-5" >
<div> <div>
<span className="my-1">일반</span> <span className="my-1">일반</span>
<span> <span>
...@@ -147,7 +148,7 @@ const TicketingSeatPage = ({ location }) => { ...@@ -147,7 +148,7 @@ const TicketingSeatPage = ({ location }) => {
</div> </div>
</div> </div>
</div> </div>
<div className="col-sm-6 mb-4 p-2 text-center" style={{ backgroundColor: '#252525' }}> <div className="col-sm-5 mb-4 p-2 text-center" style={{ backgroundColor: '#252525' }}>
<div>{ticketInfo.cinema} | {ticketInfo.selectedTheater}</div> <div>{ticketInfo.cinema} | {ticketInfo.selectedTheater}</div>
<div>{ticketInfo.title}</div> <div>{ticketInfo.title}</div>
<div>{ticketInfo.time}</div> <div>{ticketInfo.time}</div>
......
...@@ -6,7 +6,7 @@ const getAll = async (req, res) => { ...@@ -6,7 +6,7 @@ const getAll = async (req, res) => {
where: { id: 1 }, where: { id: 1 },
attributes: ['cinemaName', 'transportation', 'parking', 'address', 'moreFeeInfo'] attributes: ['cinemaName', 'transportation', 'parking', 'address', 'moreFeeInfo']
}) })
console.log("INfo====",info) // console.log("INfo====",info)
return res.json(info) return res.json(info)
} catch (error) { } catch (error) {
return res.status(500).send(error.message || "영화관 정보 가져오는 중 에러 발생") return res.status(500).send(error.message || "영화관 정보 가져오는 중 에러 발생")
......
...@@ -36,7 +36,7 @@ const singleTest = async (req, res) => { ...@@ -36,7 +36,7 @@ const singleTest = async (req, res) => {
}, },
}) })
const resp = response.data const resp = response.data
console.log('resp', resp) // console.log('resp', resp)
res.json({ redirect_url: resp.next_redirect_pc_url }) res.json({ redirect_url: resp.next_redirect_pc_url })
} catch (error) { } catch (error) {
console.log(error) console.log(error)
......
...@@ -81,9 +81,10 @@ const getMovieList = async (req, res) => { ...@@ -81,9 +81,10 @@ const getMovieList = async (req, res) => {
where: { "movieId": movieId }, where: { "movieId": movieId },
attributes: ["ticket_sales", "vote_average"] attributes: ["ticket_sales", "vote_average"]
}) })
const totalReservationRate = Movie.sum('ticket_sales') const totalReservationRate = await Movie.findAll({
const rate = await Promise.all(cols.ticket_sales / totalReservationRate * 100) attributes: [[sequelize.fn('SUM', sequelize.col('ticket_sales')), 'totalReservationRate']]
return { ...movie.data, ticket_sales: rate, vote_average: cols.vote_average } });
return { ...movie.data, ticket_sales: cols.ticket_sales, vote_average: cols.vote_average, totalReservationRate: totalReservationRate[0]}
}) })
) )
......
...@@ -38,7 +38,7 @@ const findOneReservation = async (req, res) => { ...@@ -38,7 +38,7 @@ const findOneReservation = async (req, res) => {
user: user user: user
}, },
}) })
console.log(reservation) // console.log(reservation)
res.json(reservation) res.json(reservation)
} catch (error) { } catch (error) {
res.status(500).send(error.message || "예매 내역을 찾는 중 오류 발생") res.status(500).send(error.message || "예매 내역을 찾는 중 오류 발생")
......
...@@ -375,13 +375,13 @@ const modifyUser = async (req, res) => { ...@@ -375,13 +375,13 @@ const modifyUser = async (req, res) => {
const getUserInfo = async (req, res) => { const getUserInfo = async (req, res) => {
const { id } = req.body const { id } = req.body
console.log(id) // console.log(id)
try { try {
const userInfo = await User.findOne({ const userInfo = await User.findOne({
where: { id: id }, where: { id: id },
attributes: ["id", "userId", "email", "nickname", "birth", "phoneNumber"] attributes: ["id", "userId", "email", "nickname", "birth", "phoneNumber"]
}) })
console.log(userInfo) // console.log(userInfo)
res.json(userInfo) res.json(userInfo)
} catch (error) { } catch (error) {
res.status(500).send("회원정보 불러오기 실패"); res.status(500).send("회원정보 불러오기 실패");
......
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