From dfd6e792c7899f8749a1876258f98cc5c89e0fe5 Mon Sep 17 00:00:00 2001 From: "Axel C. Lopez" Date: Tue, 26 Mar 2024 20:42:39 -0300 Subject: [PATCH 1/2] Add small sugestions --- src/Graph.js | 1 + src/MapContext.js | 1 + src/User.js | 2 +- src/utils.js | 1 + 4 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Graph.js b/src/Graph.js index c56d5e42..488ebee3 100644 --- a/src/Graph.js +++ b/src/Graph.js @@ -631,6 +631,7 @@ const Graph = (userContext) => { // Despues, las obligatorias const allObligatorias = getters.Obligatorias(); + // aca cambiar obligatorias a obligatoriasAprobadas mepa que quedaria mejor, mas sencillo de entender, que opinas? const obligatorias = getters.ObligatoriasAprobadas(); creditos.push({ ...CREDITOS["Obligatorias"], diff --git a/src/MapContext.js b/src/MapContext.js index 4a4c116c..8e57e4b8 100644 --- a/src/MapContext.js +++ b/src/MapContext.js @@ -8,6 +8,7 @@ export const GraphContext = React.createContext(); export const MapProvider = ({ children }) => { const user = User(); const graph = Graph(user); + return ( {children} diff --git a/src/User.js b/src/User.js index c401d5a7..940e20fe 100644 --- a/src/User.js +++ b/src/User.js @@ -35,7 +35,7 @@ const Login = () => { !!window.localStorage.getItem("padron"), ); - // Loggin in es para cuando la pagina entera esta cargando todos los datos del usuario + // Logging in es para cuando la pagina entera esta cargando todos los datos del usuario const [loggingIn, setLoggingIn] = React.useState(false); // On boot nos fijamos si hay un padron inicial del storage diff --git a/src/utils.js b/src/utils.js index 47b470c6..1de0814a 100644 --- a/src/utils.js +++ b/src/utils.js @@ -6,6 +6,7 @@ export const promediar = (materias) => { return sum ? (sum / materias.length).toFixed(2) : 0; }; +// quiza cambiar estas funciones de accNombre a acreditarNombre o sumNombre?, me parece que serian mas informativos export const accCreditos = (acc, node) => { acc += node.creditos; return acc; From 558e8b9ac5eb296a7f916f0db3ba3e1bfcaf1be3 Mon Sep 17 00:00:00 2001 From: "Axel C. Lopez" Date: Sun, 7 Apr 2024 16:42:46 -0300 Subject: [PATCH 2/2] Add tooltip "y optativas" when user has optativas --- src/Graph.js | 11 ++++++----- src/MapContext.js | 1 - src/User.js | 2 +- src/components/Footer/ProgressBar.js | 5 ++++- src/constants.js | 6 ++++++ src/utils.js | 1 - 6 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/Graph.js b/src/Graph.js index 488ebee3..33869e60 100644 --- a/src/Graph.js +++ b/src/Graph.js @@ -631,27 +631,28 @@ const Graph = (userContext) => { // Despues, las obligatorias const allObligatorias = getters.Obligatorias(); - // aca cambiar obligatorias a obligatoriasAprobadas mepa que quedaria mejor, mas sencillo de entender, que opinas? - const obligatorias = getters.ObligatoriasAprobadas(); + const obligatoriasAprobadas = getters.ObligatoriasAprobadas(); creditos.push({ ...CREDITOS["Obligatorias"], creditosNecesarios: allObligatorias.reduce(accCreditos, 0), - nmaterias: obligatorias.length, + nmaterias: obligatoriasAprobadas.length, totalmaterias: allObligatorias.length, - creditos: obligatorias.reduce(accCreditos, 0), + creditos: obligatoriasAprobadas.reduce(accCreditos, 0), }); // Despues, las electivas, incluyendo las orientaciones no elegidas const electivas = getters.ElectivasAprobadas(); + console.log("getCorrectCreditos linea 645", getCorrectCreditos()); const electivasCreditosNecesarios = isNaN(getCorrectCreditos()?.electivas) ? getCorrectCreditos()?.electivas[user.finDeCarrera?.id] : getCorrectCreditos()?.electivas; creditos.push({ ...CREDITOS["Electivas"], - creditosNecesarios: electivasCreditosNecesarios, nmaterias: electivas.length, + creditosNecesarios: electivasCreditosNecesarios, creditos: electivas.reduce(accCreditos, 0) + optativas.reduce(accCreditos, 0), + creditosOptativas: optativas.reduce(accCreditos, 0), helpText: !electivasCreditosNecesarios && `Elegí ${user.carrera.eligeOrientaciones && !user.orientacion ? "orientación" : ""}${user.carrera.eligeOrientaciones && !user.orientacion && !user.finDeCarrera ? " y " : ""}${!user.finDeCarrera ? "entre tesis y tpp" : ""} en la configuración de usuario para saber cuantos necesitás.`, diff --git a/src/MapContext.js b/src/MapContext.js index 8e57e4b8..4a4c116c 100644 --- a/src/MapContext.js +++ b/src/MapContext.js @@ -8,7 +8,6 @@ export const GraphContext = React.createContext(); export const MapProvider = ({ children }) => { const user = User(); const graph = Graph(user); - return ( {children} diff --git a/src/User.js b/src/User.js index 940e20fe..c401d5a7 100644 --- a/src/User.js +++ b/src/User.js @@ -35,7 +35,7 @@ const Login = () => { !!window.localStorage.getItem("padron"), ); - // Logging in es para cuando la pagina entera esta cargando todos los datos del usuario + // Loggin in es para cuando la pagina entera esta cargando todos los datos del usuario const [loggingIn, setLoggingIn] = React.useState(false); // On boot nos fijamos si hay un padron inicial del storage diff --git a/src/components/Footer/ProgressBar.js b/src/components/Footer/ProgressBar.js index 22da3725..69f7b3f8 100644 --- a/src/components/Footer/ProgressBar.js +++ b/src/components/Footer/ProgressBar.js @@ -28,6 +28,7 @@ import { GraphContext } from "../../MapContext"; // materias aprobadas const ProgressBar = () => { const { creditos, toggleCheckbox } = React.useContext(GraphContext); + console.log("creditos linea 31", creditos); return ( { - {c.nombre} + + {c.nombre} {c.creditosOptativas && "y Optativas"} + {!c.dummy && ( diff --git a/src/constants.js b/src/constants.js index 63b289e3..9c8eccf7 100644 --- a/src/constants.js +++ b/src/constants.js @@ -208,6 +208,12 @@ export const CREDITOS = { color: "electivas", bg: COLORS.electivas[50], }, + Optativas: { + nombrecorto: "Optativas", + nombre: "Materias Optativas", + color: "electivas", + bg: COLORS.electivas[50], + }, "Fin de Carrera": { nombrecorto: "Tesis/TPP", nombre: "Fin de Carrera", diff --git a/src/utils.js b/src/utils.js index 1de0814a..47b470c6 100644 --- a/src/utils.js +++ b/src/utils.js @@ -6,7 +6,6 @@ export const promediar = (materias) => { return sum ? (sum / materias.length).toFixed(2) : 0; }; -// quiza cambiar estas funciones de accNombre a acreditarNombre o sumNombre?, me parece que serian mas informativos export const accCreditos = (acc, node) => { acc += node.creditos; return acc;