Skip to content

Commit a1d17e9

Browse files
committed
fix
1 parent e4b955e commit a1d17e9

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

rating_api/routes/comment.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
from auth_lib.fastapi import UnionAuth
88
from fastapi import APIRouter, Depends, Query
99
from fastapi_sqlalchemy import db
10-
from starlette.requests import Request
1110

1211
from rating_api.exceptions import (
1312
CommentTooLong,
@@ -39,7 +38,7 @@
3938

4039
@comment.post("", response_model=CommentGet)
4140
async def create_comment(
42-
lecturer_id: int, comment_info: CommentPost, request: Request, user=Depends(UnionAuth(enable_userdata=True))
41+
lecturer_id: int, comment_info: CommentPost, user=Depends(UnionAuth(enable_userdata=True))
4342
) -> CommentGet:
4443
"""
4544
Scopes: `["rating.comment.create"]`
@@ -115,18 +114,19 @@ async def create_comment(
115114
)
116115
# Обрабатываем анонимность комментария, и удаляем этот флаг чтобы добавить запись в БД
117116
user_id = None if comment_info.is_anonymous else user.get('id')
117+
118118
full_name = None
119119
if not comment_info.is_anonymous:
120120
userdata_info = user.get("userdata")
121-
full_name_info = list(filter(lambda x: "Полное имя" == x['param'], userdata_info))
122-
full_name = full_name_info[0]["value"] if len(full_name_info) != 0 else None
121+
fullname_info = list(filter(lambda x: "Полное имя" == x['param'], userdata_info))
122+
fullname = fullname_info[0]["value"] if len(fullname_info) != 0 else None
123123

124124
new_comment = Comment.create(
125125
session=db.session,
126126
**comment_info.model_dump(exclude={"is_anonymous"}),
127127
lecturer_id=lecturer_id,
128128
user_id=user_id,
129-
user_fullname=full_name,
129+
user_fullname=fullname,
130130
review_status=ReviewStatus.PENDING,
131131
)
132132

0 commit comments

Comments
 (0)