2 Commits

Author SHA1 Message Date
99c95d0706 2.4.1
All checks were successful
platform/bro/pipeline/head This commit looks good
2024-04-09 22:56:02 +03:00
0bdae7fc23 bugfix sorting & grouping
All checks were successful
platform/bro/pipeline/head This commit looks good
2024-04-09 22:53:51 +03:00
3 changed files with 8 additions and 7 deletions

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "journal.pl",
"version": "2.4.0",
"version": "2.4.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "journal.pl",
"version": "2.4.0",
"version": "2.4.1",
"license": "MIT",
"dependencies": {
"@chakra-ui/icons": "^2.1.1",

View File

@@ -1,6 +1,6 @@
{
"name": "journal.pl",
"version": "2.4.0",
"version": "2.4.1",
"description": "inno-js platform journal ui repo",
"main": "./src/index.tsx",
"scripts": {

View File

@@ -194,12 +194,13 @@ const LessonList = () => {
const toastRef = useRef(null)
const createdLessonRef = useRef(null)
const [editLesson, setEditLesson] = useState<Lesson>(null)
const sorted = useMemo(() => [...(data?.body || [])]?.sort((a, b) => a.date < b.date ? 1 : -1), [data, data?.body])
const lessonCalc = useMemo(() => {
if (!isSuccess) {
return []
}
const sorted = [...data?.body].sort((a, b) => a.date > b.date ? 1 : -1)
if (!groupByDate) {
return [{ date: '', data: sorted }]
@@ -223,7 +224,7 @@ const LessonList = () => {
}
return lessonsData
}, [groupByDate, isSuccess])
}, [groupByDate, isSuccess, sorted])
const onSubmit = (lessonData) => {
toastRef.current = toast({
@@ -404,10 +405,10 @@ const LessonList = () => {
)}
</Box>
)}
{barFeature && (
{barFeature && sorted?.length && (
<Box height="300">
<Bar
data={data?.body.map((lesson, index) => ({
data={sorted.map((lesson, index) => ({
lessonIndex: `#${index + 1}`,
count: lesson.students.length,
}))}