Skip to content

Commit

Permalink
Add tooltip "y optativas" when user has optativas
Browse files Browse the repository at this point in the history
  • Loading branch information
lopezac committed Apr 7, 2024
1 parent dfd6e79 commit a4842d8
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 9 deletions.
18 changes: 13 additions & 5 deletions src/Graph.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.`,
Expand Down Expand Up @@ -998,6 +999,13 @@ const Graph = (userContext) => {
fields: ["creditos"],
})
: [],
Optativas: () =>
nodes
? nodes.get({
filter: (n) => n.categoria === "Optativa",
fields: ["creditos"],
})
: [],
ElectivasAprobadas: () =>
nodes
? nodes.get({
Expand Down
1 change: 0 additions & 1 deletion src/MapContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ export const GraphContext = React.createContext();
export const MapProvider = ({ children }) => {
const user = User();
const graph = Graph(user);

return (
<UserContext.Provider value={user}>
<GraphContext.Provider value={graph}>{children}</GraphContext.Provider>
Expand Down
2 changes: 1 addition & 1 deletion src/User.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion src/components/Footer/ProgressBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<Grid
Expand Down Expand Up @@ -102,7 +103,9 @@ const ProgressBar = () => {
<PopoverHeader border="none">
<Stat size="sm">
<StatLabel>
<strong>{c.nombre}</strong>
<strong>
{c.nombre} {c.creditosOptativas && "y Optativas"}
</strong>
</StatLabel>
{!c.dummy && (
<StatNumber fontWeight="normal" fontSize="larger">
Expand Down
6 changes: 6 additions & 0 deletions src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 0 additions & 1 deletion src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit a4842d8

Please sign in to comment.