Skip to content

Print-pages limit.#50

Merged
Temmmmmo merged 13 commits intomainfrom
page-limit
May 22, 2023
Merged

Print-pages limit.#50
Temmmmmo merged 13 commits intomainfrom
page-limit

Conversation

@Temmmmmo
Copy link
Copy Markdown
Member

@Temmmmmo Temmmmmo commented May 15, 2023

Изменения

В настройках можно указать ограничение на количество листов, которые можно распечатать на принтере.

Реализации

  1. Добавлена функция, считающая количество листов, которые израсходуются на печать данного файла.
  2. Создан новый столбец с данными о количестве напечатанных листов в таблице, использующейся для статистики.
  3. Во всем проекте HTTP-ошибки заменены на написанные вручную ошибки для лучшей читаемости кода.
  4. HTTP-ошибки возвращаются автоматически после возникновения прописанной вручную ошибки.

Детали

  1. Реализованная функция подсчета, позволяет из строки вида '1, 2, 4-10, 1-8' получить количество листов, которые будут напечатаны.
  2. Новый столбец sheet_used добавлен в таблицу PrintFact.
  3. Добавлены exception-хэндлеры, которые ловят ошибки, а также файл exception, в котором данные ошибки прописаны.

Check-List

  • Вы проверили свой код перед отправкой запроса?
  • Вы написали тесты к реализованным функциям?
  • Вы не забыли применить black и isort?

P.S. Проставьте x в квадратные скобки в нужных пунктах. Example: [x]

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 15, 2023

Code Coverage

Coverage Report
FileStmtsMissCoverMissing
print_service
   __main__.py440%1–7
   base.py12467%6–9
   exceptions.py52787%21, 40, 45, 60, 65, 70, 77
print_service/routes
   admin.py492647%28–29, 32–36, 39–43, 50–56, 63–69
   auth.py440%1–8
   exc_handlers.py56984%29, 43, 50, 58, 87, 94, 101, 109, 116
   file.py1281985%48, 54, 56, 126–127, 165, 173–174, 176, 179–180, 185–186, 196–199, 239, 248
   qrprint.py824743%34–43, 48–54, 57–64, 67–76, 79, 82–85, 93–96, 104–109
   user.py50492%63, 110–112
print_service/utils
   __init__.py58395%44, 86–87
TOTAL61712779% 

Summary

Tests Skipped Failures Errors Time
23 1 💤 0 ❌ 0 🔥 1.685s ⏱️

Comment thread migrations/versions/d63e9f7661dd_page_count.py Outdated
Comment thread print_service/models/__init__.py Outdated
Comment thread print_service/utils/__init__.py Outdated
Comment thread print_service/utils/__init__.py Outdated
Comment thread print_service/utils/__init__.py Outdated
@grigoriev-semyon
Copy link
Copy Markdown
Member

По моему ты там нагородил функцию из асбстракций который можно сломать когда количество уникальных записей в «1,2,3,…» больше чем количество страниц

Copy link
Copy Markdown
Member

@dyakovri dyakovri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А можешь еще создать errors.py и error_handlers по аналогии с аутхом?

В первый поместить ошибки, которые будут обычными питонячими
Типа TooLargeSize, TooManyPages, InvalidFormat и и.д.

А во второй поместить обработчики этих ошибок, которые будут отдавать JSON с ошибкой и нужным статус кодом

Comment thread migrations/versions/d63e9f7661dd_page_count.py Outdated
Comment thread migrations/versions/d63e9f7661dd_page_count.py Outdated
Comment thread print_service/utils/__init__.py Outdated
Comment thread print_service/utils/__init__.py
Comment thread print_service/models/__init__.py Outdated
Comment thread print_service/models/__init__.py Outdated
Comment thread print_service/routes/admin.py Outdated
Comment thread print_service/routes/file.py Outdated
Comment thread print_service/settings.py Outdated
@Temmmmmo Temmmmmo requested a review from dyakovri May 19, 2023 19:43
Comment thread print_service/exceptions.py
Comment thread print_service/models/__init__.py Outdated
Comment thread print_service/models/__init__.py Outdated
Comment thread print_service/models/__init__.py
Comment thread print_service/routes/exc_handlers.py Outdated
Comment thread print_service/routes/file.py
Comment thread print_service/routes/file.py Outdated
Comment thread print_service/routes/file.py
Comment thread print_service/routes/file.py
Comment thread print_service/routes/qrprint.py Outdated
Copy link
Copy Markdown
Member

@grigoriev-semyon grigoriev-semyon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Не исправлено ничего из моего ревью

@github-actions
Copy link
Copy Markdown

💩 Code linting failed, use black and isort to fix it.

Comment thread print_service/models/__init__.py Outdated
Comment thread print_service/models/__init__.py Outdated
Comment thread print_service/exceptions.py Outdated
@Temmmmmo Temmmmmo merged commit 71369b5 into main May 22, 2023
@Temmmmmo Temmmmmo deleted the page-limit branch May 22, 2023 17:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Добавить ограничение на бэке

4 participants