63 lines
1.8 KiB
Markdown
63 lines
1.8 KiB
Markdown
---
|
|
status: seed
|
|
type: concept
|
|
tags: []
|
|
created: 2025-12-17
|
|
updated: 2026-05-25
|
|
aliases: []
|
|
---
|
|
**API Импорт**
|
|
|
|
Команда Rails:
|
|
|
|
```sh
|
|
/home/ada/.local/bin/mise exec ruby -- bin/rails runner '...'
|
|
```
|
|
|
|
Семестр берётся из `Term.actual`. Для старта `2026-02-07` код семестра: `20252`.
|
|
|
|
**Credentials**
|
|
|
|
```yaml
|
|
api:
|
|
home_mephi:
|
|
host:
|
|
code:
|
|
token:
|
|
students_mephi:
|
|
host:
|
|
username:
|
|
password:
|
|
```
|
|
|
|
**Endpoints**
|
|
|
|
```text
|
|
GET {home_mephi.host}/study_groups.json?term_code=20252&code=...&token=...
|
|
GET {home_mephi.host}/tutors.json?term_code=20252&code=...&token=...
|
|
GET {students_mephi.host}/get_list_by_group_name?group=...&term=20252
|
|
GET {home_mephi.host}/tutors/{staff_id}/schedules.json?term_code=20252&date=YYYY-MM-DD&code=...&token=...
|
|
```
|
|
|
|
`students_mephi` использует Basic Auth: `username/password`.
|
|
|
|
**Ручная загрузка**
|
|
|
|
```sh
|
|
/home/ada/.local/bin/mise exec ruby -- bin/rails runner 'ImportGroupsService.execute'
|
|
/home/ada/.local/bin/mise exec ruby -- bin/rails runner 'ImportTutorsService.execute'
|
|
/home/ada/.local/bin/mise exec ruby -- bin/rails runner 'ImportStudentsService.execute'
|
|
/home/ada/.local/bin/mise exec ruby -- bin/rails runner 'term = Term.actual; ImportDisciplineService.execute(nil, term)'
|
|
```
|
|
|
|
Расписание на сегодня:
|
|
|
|
```sh
|
|
/home/ada/.local/bin/mise exec ruby -- bin/rails runner 'term = Term.actual; ImportScheduleService.execute(Date.today, term)'
|
|
```
|
|
|
|
Расписание за весь семестр до сегодня:
|
|
|
|
```sh
|
|
/home/ada/.local/bin/mise exec ruby -- bin/rails runner 'term = Term.actual; finish = [term.get_finish_date, Date.today].min; (term.start_date..finish).each { |date| ImportScheduleService.execute(date, term) unless date.wday == 0 }'
|
|
``` |