Skip to content

Commit

Permalink
Remove unnecessary cast
Browse files Browse the repository at this point in the history
  • Loading branch information
cyrillkuettel committed Jul 4, 2024
1 parent 4739ae3 commit b13f041
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/privatim/views/activities.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ def activities_view(request: 'IRequest') -> 'RenderData':
consultation_stmt = select(
Consultation.id.label('id'),
Consultation.created.label('timestamp'),
cast(literal("'consultation'"), String).label('type')
literal("'consultation'").label('type')
)
meeting_stmt = select(
Meeting.id.label('id'),
Meeting.time.label('timestamp'),
cast(literal("'meeting'"), String).label('type')
literal("'meeting'").label('type')
)
union_stmt = union_all(consultation_stmt, meeting_stmt)

Expand Down
8 changes: 4 additions & 4 deletions src/privatim/views/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,11 @@ def build_file_query(
model. Headlines in this context are snippets of text from the
fiel, with the matching search terms highlighted. They
provide context around where the search term appears in each field.
ts_headlines requiresd the original document text, not tsvector.
ts_headlines requires the original document text, not tsvector.
2. The actual search happens in the tsvector type searchable_text_{
locale}, which as been indexedin beforehand.
locale}, which as been indexed beforehand.
"""

return (
Expand All @@ -161,7 +161,7 @@ def build_file_query(
'MaxFragments=3, FragmentDelimiter=" ... "',
).label('file_content_headline'),
SearchableFile,
cast(literal('SearchableFile'), String).label('type')
literal('SearchableFile').label('type')
)
.select_from(model)
.join(SearchableFile, model.files)
Expand All @@ -186,7 +186,7 @@ def build_attribute_query(
select_fields = [
model.id,
*headline_expressions,
cast(literal(model.__name__), String).label('type'), # noqa: MS001
literal(model.__name__).label('type'), # noqa: MS001
]

return select(*select_fields).filter(
Expand Down

0 comments on commit b13f041

Please sign in to comment.