-
Notifications
You must be signed in to change notification settings - Fork 3
post-rank-handler #143
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
Merged
Merged
post-rank-handler #143
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
c9cbff5
post-rank-handler
VladislavVoskoboinik 2f47a48
lint-fix
VladislavVoskoboinik faec6ac
route-test
eaca41a
route-lecturer-update-fix
d20a223
change-update-response
280f88f
lint-fix
9908360
rating-refactor
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,165 @@ | ||
| """lecturer-rating | ||
|
|
||
| Revision ID: beb11fd89531 | ||
| Revises: fc7cb93684e0 | ||
| Create Date: 2025-08-25 14:59:47.363354 | ||
|
|
||
| """ | ||
|
|
||
| import sqlalchemy as sa | ||
| from alembic import op | ||
|
|
||
|
|
||
| # revision identifiers, used by Alembic. | ||
| revision = 'beb11fd89531' | ||
| down_revision = 'fc7cb93684e0' | ||
| branch_labels = None | ||
| depends_on = None | ||
|
|
||
|
|
||
| def upgrade(): | ||
| op.add_column( | ||
| 'lecturer', | ||
| sa.Column( | ||
| 'mark_weighted', | ||
| sa.Float(), | ||
| server_default='0.0', | ||
| nullable=False, | ||
| comment='Взвешенная оценка преподавателя, посчитана в dwh', | ||
| ), | ||
| ) | ||
| op.add_column( | ||
| 'lecturer', | ||
| sa.Column( | ||
| 'mark_kindness_weighted', | ||
| sa.Float(), | ||
| server_default='0.0', | ||
| nullable=False, | ||
| comment='Взвешенная оценка доброты, посчитана в dwh', | ||
| ), | ||
| ) | ||
| op.add_column( | ||
| 'lecturer', | ||
| sa.Column( | ||
| 'mark_clarity_weighted', | ||
| sa.Float(), | ||
| server_default='0.0', | ||
| nullable=False, | ||
| comment='Взвешенная оценка понятности, посчитана в dwh', | ||
| ), | ||
| ) | ||
| op.add_column( | ||
| 'lecturer', | ||
| sa.Column( | ||
| 'mark_freebie_weighted', | ||
| sa.Float(), | ||
| server_default='0.0', | ||
| nullable=False, | ||
| comment='Взвешенная оценка халявности, посчитана в dwh', | ||
| ), | ||
| ) | ||
| op.add_column( | ||
| 'lecturer', | ||
| sa.Column( | ||
| 'rank', sa.Integer(), server_default='0', nullable=False, comment='Место в рейтинге, посчитана в dwh' | ||
| ), | ||
| ) | ||
| op.add_column( | ||
| 'lecturer', | ||
| sa.Column( | ||
| 'rank_update_ts', | ||
| sa.DateTime(), | ||
| server_default=sa.func.now(), | ||
| nullable=False, | ||
| comment='Время обновления записи', | ||
| ), | ||
| ) | ||
| op.alter_column( | ||
| 'lecturer', | ||
| 'id', | ||
| existing_type=sa.INTEGER(), | ||
| comment='Идентификатор преподавателя', | ||
| existing_nullable=False, | ||
| autoincrement=True, | ||
| existing_server_default=sa.text("nextval('lecturer_id_seq'::regclass)"), | ||
| ) | ||
| op.alter_column( | ||
| 'lecturer', 'first_name', existing_type=sa.VARCHAR(), comment='Имя препода', existing_nullable=False | ||
| ) | ||
| op.alter_column( | ||
| 'lecturer', 'last_name', existing_type=sa.VARCHAR(), comment='Фамилия препода', existing_nullable=False | ||
| ) | ||
| op.alter_column( | ||
| 'lecturer', 'middle_name', existing_type=sa.VARCHAR(), comment='Отчество препода', existing_nullable=False | ||
| ) | ||
| op.alter_column( | ||
| 'lecturer', 'avatar_link', existing_type=sa.VARCHAR(), comment='Ссылка на аву препода', existing_nullable=True | ||
| ) | ||
| op.alter_column( | ||
| 'lecturer', | ||
| 'is_deleted', | ||
| existing_type=sa.BOOLEAN(), | ||
| comment='Идентификатор софт делита', | ||
| existing_nullable=False, | ||
| existing_server_default=sa.text('false'), | ||
| ) | ||
|
|
||
|
|
||
| def downgrade(): | ||
| op.alter_column( | ||
| 'lecturer', | ||
| 'is_deleted', | ||
| existing_type=sa.BOOLEAN(), | ||
| comment=None, | ||
| existing_comment='Идентификатор софт делита', | ||
| existing_nullable=False, | ||
| existing_server_default=sa.text('false'), | ||
| ) | ||
| op.alter_column( | ||
| 'lecturer', | ||
| 'avatar_link', | ||
| existing_type=sa.VARCHAR(), | ||
| comment=None, | ||
| existing_comment='Ссылка на аву препода', | ||
| existing_nullable=True, | ||
| ) | ||
| op.alter_column( | ||
| 'lecturer', | ||
| 'middle_name', | ||
| existing_type=sa.VARCHAR(), | ||
| comment=None, | ||
| existing_comment='Отчество препода', | ||
| existing_nullable=False, | ||
| ) | ||
| op.alter_column( | ||
| 'lecturer', | ||
| 'last_name', | ||
| existing_type=sa.VARCHAR(), | ||
| comment=None, | ||
| existing_comment='Фамилия препода', | ||
| existing_nullable=False, | ||
| ) | ||
| op.alter_column( | ||
| 'lecturer', | ||
| 'first_name', | ||
| existing_type=sa.VARCHAR(), | ||
| comment=None, | ||
| existing_comment='Имя препода', | ||
| existing_nullable=False, | ||
| ) | ||
| op.alter_column( | ||
| 'lecturer', | ||
| 'id', | ||
| existing_type=sa.INTEGER(), | ||
| comment=None, | ||
| existing_comment='Идентификатор преподавателя', | ||
| existing_nullable=False, | ||
| autoincrement=True, | ||
| existing_server_default=sa.text("nextval('lecturer_id_seq'::regclass)"), | ||
| ) | ||
| op.drop_column('lecturer', 'rank_update_ts') | ||
| op.drop_column('lecturer', 'rank') | ||
| op.drop_column('lecturer', 'mark_freebie_weighted') | ||
| op.drop_column('lecturer', 'mark_clarity_weighted') | ||
| op.drop_column('lecturer', 'mark_kindness_weighted') | ||
| op.drop_column('lecturer', 'mark_weighted') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
респект, правильно, что добавил