Skip to content

Commit

Permalink
deleted graphics for now
Browse files Browse the repository at this point in the history
  • Loading branch information
uo276976 committed Apr 3, 2024
1 parent 9d88e2d commit 9a4d088
Showing 1 changed file with 1 addition and 24 deletions.
25 changes: 1 addition & 24 deletions webapp/src/components/Participation.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React, { useState, useEffect, useContext } from 'react';
import { Bar } from 'react-chartjs-2';
import axios from 'axios';
import { SessionContext } from '../SessionContext';

Expand All @@ -25,38 +24,16 @@ export const Participation = ({ goTo }) => {
}
}, [sessionData]);

//Gráfica
const data = {
labels: ['Preguntas Acertadas', 'Preguntas Falladas'],
datasets: [
{
label: 'Número de preguntas',
data: [participationData?.correctAnswers || 0, participationData?.incorrectAnswers || 0],
backgroundColor: ['green', 'red'],
},
],
};

const options = {
scales: {
y: {
beginAtZero: true,
max: Math.max(participationData?.correctAnswers || 0, participationData?.incorrectAnswers || 0) + 1,
},
},
};

return (
<main>
<div>
<h1>Participation</h1>
<h1>Participación</h1>
{participationData !== null ? (
<div>
<p>Número de partidas jugadas: {participationData.totalGames}</p>
<p>Preguntas acertadas: {participationData.correctAnswers}</p>
<p>Preguntas falladas: {participationData.incorrectAnswers}</p>
<p>Tiempo total jugando: {participationData.totalTime} segundos</p>
<Bar data={data} options={options} />
</div>
) : (
<p>Cargando datos de participación...</p>
Expand Down

0 comments on commit 9a4d088

Please sign in to comment.