Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: hotfix v3 #185

Merged
merged 1 commit into from
Mar 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions apps/api/src/database/initDBConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ export const sequelize = new Sequelize({
pool: {
max: 30,
min: 1,
acquire: 30000, // К-ство миллисекунд, прежде чем выбросить ошибку
idle: 10000 // К-ство миллисекунд, прежде чем освободить "неактивное" соединение (время ожидания)
acquire: 60000, // К-ство миллисекунд, прежде чем выбросить ошибку
idle: 20000 // К-ство миллисекунд, прежде чем освободить "неактивное" соединение (время ожидания)
},
define: {
freezeTableName: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ export const getAttestationFromDB = async (
],
where: {
diaryUserId: authData.localUserId
}
},
required: false
}
],
where: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,16 @@ export const getFinalMarksFromDB = async (
],
where: {
diaryUserId: authData.localUserId
}
},
required: false
}
]
},
TermTypeModel
]
],
where: {
groupId: authData.groupId
}
})

const finalMarks = FinalMarkModel.findAll({
Expand Down
6 changes: 3 additions & 3 deletions apps/api/src/routes/lessons/service/get/getLessons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const getLessonsService = async (
startDate: string,
endDate: string,
authData: ICacheData,
isAwait = false
notGetFromDB = false
): Promise<Day[] | string> => {
const path = `${SERVER_URL}/services/students/${authData.idFromDiary}/lessons/${startDate}/${endDate}`
console.log(path)
Expand All @@ -23,7 +23,7 @@ export const getLessonsService = async (
throw new ApiError(API_ERRORS.USER_NOT_PERMISSION, API_CODES.FORBIDDEN)
}

if (!response.ok) {
if (!response.ok && !notGetFromDB) {
// Получаем из базы
const rawSchedule = await ScheduleGetFromDB(startDate, endDate, authData)
return structurizeResponse(rawSchedule, startDate, endDate, authData)
Expand All @@ -38,7 +38,7 @@ export const getLessonsService = async (
console.error(`Ошибка сохранения расписания: ${err}`)
)

if (isAwait) {
if (notGetFromDB) {
await backgroundProcess()
} else {
backgroundProcess()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const structurizeResponse = (
for (const schedule of subject.schedules) {
// TODO: Очень костыльно убираем чужие подгруппы. Нужно поправить (в будущем)
const subgroups = schedule.scheduleSubgroups
if (subgroups.length) {
if (subgroups.length > 0) {
for (const subgroup of subgroups) {
if (subgroup.diaryUserId === authData.localUserId) {
isIgnored = false
Expand Down Expand Up @@ -89,9 +89,9 @@ export const structurizeResponse = (
}

// Если нет ни опозданий ни оценок, то не добавлем день в выдачу
if (markValues.length || absenceType) {
daysWithMarks.push(dayToSave)
}
// if (markValues.length || absenceType) {
daysWithMarks.push(dayToSave)
// }

// Добавляем дату в monthsWithDays
const num = new Date(day).getMonth() + 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ const groupping = (dates: (string | Date)[]) => {
j--
}
}
console.log(day, endDate)

groupDates.push({
startDate: day,
endDate
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/UI/Mark/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const Mark: FC<IMark> = ({ mark, size = 'l', bottom, color, ...props }) => {

return useMemo(
() => (
<div {...props}>
<div {...props} style='max-width: min-content;'>
<div className='markRoot' style={style}>
{mark}
</div>
Expand Down
5 changes: 3 additions & 2 deletions apps/web/src/views/Achievements/Tabs/FinalMarks/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Group, Header } from '@vkontakte/vkui'
import { Group, Header, Placeholder } from '@vkontakte/vkui'
import type { FunctionalComponent } from 'preact'
import { useEffect, useState } from 'preact/hooks'

Expand Down Expand Up @@ -69,7 +69,8 @@ const FinalMarks: FunctionalComponent<Props> = ({
}

if (!finalMarksData?.subjects?.length) {
return <LoadingData text='Обработка данных...' />
//return <LoadingData text='Обработка данных...' />
return <Placeholder>Данных нет</Placeholder>
}

return (
Expand Down
Loading