From 93aabb97c5dda722c05e59744e37131365f1d274 Mon Sep 17 00:00:00 2001 From: Riku Rauhala Date: Wed, 19 Jun 2024 10:39:11 +0300 Subject: [PATCH] [Courses tab] Include Hyv. grades in Excel --- services/frontend/src/common/hooks.js | 2 +- .../StudentTable/CoursesTab/index.jsx | 10 ++++------ .../src/components/SortableTable/FigureContainer.jsx | 10 +++++----- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/services/frontend/src/common/hooks.js b/services/frontend/src/common/hooks.js index ae778c40ed..ab9f84fca3 100644 --- a/services/frontend/src/common/hooks.js +++ b/services/frontend/src/common/hooks.js @@ -1,6 +1,6 @@ import { isEqual } from 'lodash' import qs from 'query-string' -import { useCallback, useState, useEffect, useRef } from 'react' +import { useCallback, useEffect, useRef, useState } from 'react' import { SEARCH_HISTORY_VERSION } from '@/constants' diff --git a/services/frontend/src/components/PopulationStudents/StudentTable/CoursesTab/index.jsx b/services/frontend/src/components/PopulationStudents/StudentTable/CoursesTab/index.jsx index 946b7227c3..bdfa39d104 100644 --- a/services/frontend/src/components/PopulationStudents/StudentTable/CoursesTab/index.jsx +++ b/services/frontend/src/components/PopulationStudents/StudentTable/CoursesTab/index.jsx @@ -218,13 +218,11 @@ const CoursesTable = ({ curriculum, includeSubstitutions, populationCourses, stu const getTotalRowVal = (total, code) => total[code] const getNumericGrade = grade => { - if (grade === 'Hyl.') { - return 0 + const numericGrade = parseInt(grade, 10) + if (Number.isInteger(numericGrade)) { + return numericGrade } - if (['1', '2', '3', '4', '5'].includes(grade)) { - return parseInt(grade, 10) - } - return null + return grade } const hasActiveEnrollments = (student, code) => { diff --git a/services/frontend/src/components/SortableTable/FigureContainer.jsx b/services/frontend/src/components/SortableTable/FigureContainer.jsx index f16a6682c6..ab2ad671fc 100644 --- a/services/frontend/src/components/SortableTable/FigureContainer.jsx +++ b/services/frontend/src/components/SortableTable/FigureContainer.jsx @@ -1,5 +1,5 @@ import { createContext, useContext, useState, useEffect } from 'react' -import { Icon, Card, Portal, Popup, Button } from 'semantic-ui-react' +import { Button, Card, Icon, Popup, Portal } from 'semantic-ui-react' import './style.css' @@ -9,8 +9,8 @@ const Header = ({ children, actions, onClickExport }) => { const { isFullscreen, setFullscreen } = useContext(FigureContext) return ( - -
{children}
+ +
{children}
{actions}