Modif affichage stats scoreboard + modif DESC to ASC dans DBService
continuous-integration/drone/push Build is failing Details

pull/104/head^2
Baptiste MARCEL 1 year ago
parent 10edfb1f4f
commit e878d6e281

@ -138,7 +138,7 @@ class DatabaseService {
// Récupérer les 5 meilleurs scores de la journée // Récupérer les 5 meilleurs scores de la journée
this.client.all( this.client.all(
'SELECT pseudo, score FROM users INNER JOIN games ON users.idUser = games.idUser WHERE gameType = ? AND SUBSTR(playedDate, 1, 10) = ? ORDER BY score DESC LIMIT 10', 'SELECT pseudo, score FROM users INNER JOIN games ON users.idUser = games.idUser WHERE gameType = ? AND SUBSTR(playedDate, 1, 10) = ? ORDER BY score ASC LIMIT 10',
"mastermind", "mastermind",
currentDate, currentDate,
(err, result) => { (err, result) => {
@ -157,7 +157,7 @@ class DatabaseService {
const currentDate = new Date().toISOString().slice(0, 10); const currentDate = new Date().toISOString().slice(0, 10);
this.client.all( this.client.all(
'SELECT pseudo, time FROM users INNER JOIN games ON users.idUser = games.idUser WHERE gameType = ? AND SUBSTR(playedDate, 1, 10) = ? ORDER BY time DESC LIMIT 10', 'SELECT pseudo, time FROM users INNER JOIN games ON users.idUser = games.idUser WHERE gameType = ? AND SUBSTR(playedDate, 1, 10) = ? ORDER BY time ASC LIMIT 10',
enigmaLevel, enigmaLevel,
currentDate, currentDate,
(err, result) => { (err, result) => {
@ -176,7 +176,7 @@ class DatabaseService {
const currentDate = new Date().toISOString().slice(0, 10); const currentDate = new Date().toISOString().slice(0, 10);
this.client.all( this.client.all(
'SELECT pseudo, COUNT(*) AS wins FROM users INNER JOIN games ON users.idUser = games.idUser WHERE gameType = ? AND SUBSTR(playedDate, 1, 10) = ? AND win = ? GROUP BY users.idUser ORDER BY wins DESC LIMIT 10', 'SELECT pseudo, COUNT(*) AS wins FROM users INNER JOIN games ON users.idUser = games.idUser WHERE gameType = ? AND SUBSTR(playedDate, 1, 10) = ? AND win = ? GROUP BY users.idUser ORDER BY wins ASC LIMIT 10',
"multijoueur", currentDate, 1, "multijoueur", currentDate, 1,
(err, result) => { (err, result) => {
if (err) { if (err) {
@ -201,7 +201,7 @@ class DatabaseService {
const firstDayOfWeek = new Date(new Date().setDate(new Date().getDate() - currentDay)).toISOString().slice(0, 10); const firstDayOfWeek = new Date(new Date().setDate(new Date().getDate() - currentDay)).toISOString().slice(0, 10);
this.client.all( this.client.all(
'SELECT pseudo, score FROM users INNER JOIN games ON users.idUser = games.idUser WHERE gameType = ? AND SUBSTR(playedDate, 1, 10) BETWEEN ? AND ? ORDER BY score DESC LIMIT 10', 'SELECT pseudo, score FROM users INNER JOIN games ON users.idUser = games.idUser WHERE gameType = ? AND SUBSTR(playedDate, 1, 10) BETWEEN ? AND ? ORDER BY score ASC LIMIT 10',
"mastermind", "mastermind",
firstDayOfWeek, firstDayOfWeek,
currentDate, currentDate,
@ -223,7 +223,7 @@ class DatabaseService {
const firstDayOfWeek = new Date(new Date().setDate(new Date().getDate() - currentDay)).toISOString().slice(0, 10); const firstDayOfWeek = new Date(new Date().setDate(new Date().getDate() - currentDay)).toISOString().slice(0, 10);
this.client.all( this.client.all(
'SELECT pseudo, time FROM users INNER JOIN games ON users.idUser = games.idUser WHERE gameType = ? AND SUBSTR(playedDate, 1, 10) BETWEEN ? AND ? ORDER BY time DESC LIMIT 10', 'SELECT pseudo, time FROM users INNER JOIN games ON users.idUser = games.idUser WHERE gameType = ? AND SUBSTR(playedDate, 1, 10) BETWEEN ? AND ? ORDER BY time ASC LIMIT 10',
enigmaLevel, enigmaLevel,
firstDayOfWeek, firstDayOfWeek,
currentDate, currentDate,
@ -245,7 +245,7 @@ class DatabaseService {
const firstDayOfWeek = new Date(new Date().setDate(new Date().getDate() - currentDay)).toISOString().slice(0, 10); const firstDayOfWeek = new Date(new Date().setDate(new Date().getDate() - currentDay)).toISOString().slice(0, 10);
this.client.all( this.client.all(
'SELECT pseudo, COUNT(*) as wins FROM users INNER JOIN games ON users.idUser = games.idUser WHERE gameType = ? AND SUBSTR(playedDate, 1, 10) BETWEEN ? AND ? AND win = ? ORDER BY wins DESC LIMIT 10', 'SELECT pseudo, COUNT(*) as wins FROM users INNER JOIN games ON users.idUser = games.idUser WHERE gameType = ? AND SUBSTR(playedDate, 1, 10) BETWEEN ? AND ? AND win = ? ORDER BY wins ASC LIMIT 10',
"multijoueur", "multijoueur",
firstDayOfWeek, firstDayOfWeek,
currentDate, currentDate,

@ -187,7 +187,7 @@ const ScoreBoard: React.FC<{ Player: User }> = ({ Player }) => {
<Row>MasterMind :</Row> <Row>MasterMind :</Row>
{dailyMastermindStats !== null ? (dailyMastermindStats.tab.length !== 0 ? dailyMastermindStats.tab.map((stats: any, index: number) => ( {dailyMastermindStats !== null ? (dailyMastermindStats.tab.length !== 0 ? dailyMastermindStats.tab.map((stats: any, index: number) => (
<Row key={index}> <Row key={index}>
<Col sm={10}>{stats.pseudo}</Col> <Col sm={10}>{index+1}.{stats.pseudo}</Col>
<Col className='leftRow'>{stats.score}</Col> <Col className='leftRow'>{stats.score}</Col>
</Row> </Row>
)) : ( )) : (
@ -205,7 +205,7 @@ const ScoreBoard: React.FC<{ Player: User }> = ({ Player }) => {
<Row>Multijoueur :</Row> <Row>Multijoueur :</Row>
{dailyOnlineStats !== null ? (dailyOnlineStats.tab.length !== 0 ? dailyOnlineStats.tab.map((stats: any, index: number) => ( {dailyOnlineStats !== null ? (dailyOnlineStats.tab.length !== 0 ? dailyOnlineStats.tab.map((stats: any, index: number) => (
<Row key={index}> <Row key={index}>
<Col sm={10}>{stats.pseudo}</Col> <Col sm={10}>{index+1}.{stats.pseudo}</Col>
<Col className='leftRow'>{stats.wins}</Col> <Col className='leftRow'>{stats.wins}</Col>
</Row> </Row>
)) : ( )) : (
@ -223,7 +223,7 @@ const ScoreBoard: React.FC<{ Player: User }> = ({ Player }) => {
<Row>Enigme facile :</Row> <Row>Enigme facile :</Row>
{dailyEasyEnigmaStats !== null ? (dailyEasyEnigmaStats.tab.length !== 0 ? dailyEasyEnigmaStats.tab.map((stats: any, index: number) => ( {dailyEasyEnigmaStats !== null ? (dailyEasyEnigmaStats.tab.length !== 0 ? dailyEasyEnigmaStats.tab.map((stats: any, index: number) => (
<Row key={index}> <Row key={index}>
<Col sm={10}>{stats.pseudo}</Col> <Col sm={10}>{index+1}.{stats.pseudo}</Col>
<Col className='leftRow'>{stats.time}</Col> <Col className='leftRow'>{stats.time}</Col>
</Row> </Row>
)) : ( )) : (
@ -249,7 +249,7 @@ const ScoreBoard: React.FC<{ Player: User }> = ({ Player }) => {
<Row>MasterMind :</Row> <Row>MasterMind :</Row>
{weeklyMastermindStats !== null ? (weeklyMastermindStats.tab.length !== 0 ? weeklyMastermindStats.tab.map((stats: any, index: number) => ( {weeklyMastermindStats !== null ? (weeklyMastermindStats.tab.length !== 0 ? weeklyMastermindStats.tab.map((stats: any, index: number) => (
<Row key={index}> <Row key={index}>
<Col sm={10}>{stats.pseudo}</Col> <Col sm={10}>{index+1}.{stats.pseudo}</Col>
<Col className='leftRow'>{stats.score}</Col> <Col className='leftRow'>{stats.score}</Col>
</Row> </Row>
)) : ( )) : (
@ -265,7 +265,7 @@ const ScoreBoard: React.FC<{ Player: User }> = ({ Player }) => {
<Row>Multijoueur :</Row> <Row>Multijoueur :</Row>
{weeklyOnlineStats !== null ? (weeklyOnlineStats.tab.length !== 0 ? weeklyOnlineStats.tab.map((stats: any, index: number) => ( {weeklyOnlineStats !== null ? (weeklyOnlineStats.tab.length !== 0 ? weeklyOnlineStats.tab.map((stats: any, index: number) => (
<Row key={index}> <Row key={index}>
<Col sm={10}>{stats.pseudo}</Col> <Col sm={10}>{index+1}.{stats.pseudo}</Col>
<Col className='leftRow'>{stats.wins}</Col> <Col className='leftRow'>{stats.wins}</Col>
</Row> </Row>
)) : ( )) : (
@ -283,7 +283,7 @@ const ScoreBoard: React.FC<{ Player: User }> = ({ Player }) => {
<Row>Enigme facile :</Row> <Row>Enigme facile :</Row>
{weeklyEasyEnigmaStats !== null ? (weeklyEasyEnigmaStats.tab.length !== 0 ? weeklyEasyEnigmaStats.tab.map((stats: any, index: number) => ( {weeklyEasyEnigmaStats !== null ? (weeklyEasyEnigmaStats.tab.length !== 0 ? weeklyEasyEnigmaStats.tab.map((stats: any, index: number) => (
<Row key={index}> <Row key={index}>
<Col sm={10}>{stats.pseudo}</Col> <Col sm={10}>{index+1}.{stats.pseudo}</Col>
<Col className='leftRow'>{stats.time}</Col> <Col className='leftRow'>{stats.time}</Col>
</Row> </Row>
)) : ( )) : (

Loading…
Cancel
Save