Пред-деплой

This commit is contained in:
2024-09-12 21:40:57 +04:00
parent 8fb9214246
commit 6d77476a57
12 changed files with 152 additions and 53 deletions

View File

@@ -25,10 +25,7 @@ export class ScheduleParseResult {
export class ScheduleParser {
private lastResult: ScheduleParseResult | null = null;
public constructor(
private readonly xlsDownloader: XlsDownloaderBase,
private readonly group: string,
) {}
public constructor(private readonly xlsDownloader: XlsDownloaderBase) {}
private static getCellName(
worksheet: XLSX.Sheet,
@@ -162,14 +159,14 @@ export class ScheduleParser {
row < daySkeleton.row + rowDistance;
++row
) {
const time = ScheduleParser.getCellName(
const time: string | null = ScheduleParser.getCellName(
workSheet,
row,
lessonTimeColumn,
)?.replaceAll(" ", "");
if (!time || typeof time !== "string") continue;
const rawName = ScheduleParser.getCellName(
const rawName: string | null = ScheduleParser.getCellName(
workSheet,
row,
groupSkeleton.column,
@@ -216,6 +213,9 @@ export class ScheduleParser {
day.lessons.push(
new LessonDto(
type,
type === LessonTypeDto.DEFAULT
? Number.parseInt(time[0])
: -1,
LessonTimeDto.fromString(
type === LessonTypeDto.DEFAULT
? time.substring(5)

View File

@@ -3,7 +3,8 @@ import {
Controller,
Get,
HttpCode,
HttpStatus, Post,
HttpStatus,
Post,
UseGuards,
} from "@nestjs/common";
import { AuthGuard } from "../auth/auth.guard";

View File

@@ -22,7 +22,6 @@ export class ScheduleService {
"https://politehnikum-eng.ru/index/raspisanie_zanjatij/0-409",
XlsDownloaderCacheMode.SOFT,
),
"ИС-214/23",
);
private lastCacheUpdate: Date = new Date(0);
@@ -73,7 +72,7 @@ export class ScheduleService {
async getGroup(group: string): Promise<GroupScheduleDto> {
const schedule = await this.getSourceSchedule();
console.log(schedule);
if ((schedule.groups as object)[group] === undefined) {
throw new NotFoundException(
"Группы с таким названием не существует!",