mirror of
https://github.com/rommapp/romm.git
synced 2026-02-05 11:07:55 +08:00
[HOTFIX] Only lower and strip string order_by types
This commit is contained in:
parent
2501f21861
commit
f8aeb37347
@ -17,26 +17,28 @@ runtimes:
|
||||
- python@3.12.2
|
||||
# This is the section where you manage your linters. (https://docs.trunk.io/check/configuration)
|
||||
lint:
|
||||
disabled:
|
||||
- pyright
|
||||
enabled:
|
||||
- markdownlint@0.44.0
|
||||
- eslint@9.24.0
|
||||
- eslint@9.25.1
|
||||
- actionlint@1.7.7
|
||||
- bandit@1.8.3
|
||||
- black@25.1.0
|
||||
- checkov@3.2.404
|
||||
- checkov@3.2.408
|
||||
- git-diff-check
|
||||
- isort@6.0.1
|
||||
- mypy@1.15.0
|
||||
- osv-scanner@2.0.1
|
||||
- oxipng@9.1.4
|
||||
- prettier@3.5.3
|
||||
- ruff@0.11.5
|
||||
- ruff@0.11.6
|
||||
- shellcheck@0.10.0
|
||||
- shfmt@3.6.0
|
||||
- svgo@3.3.2
|
||||
- taplo@0.9.3
|
||||
- trivy@0.61.0
|
||||
- trufflehog@3.88.23
|
||||
- trivy@0.61.1
|
||||
- trufflehog@3.88.25
|
||||
- yamllint@1.37.0
|
||||
ignore:
|
||||
- linters: [ALL]
|
||||
|
||||
@ -7,11 +7,10 @@ from decorators.database import begin_session
|
||||
from models.collection import Collection, VirtualCollection
|
||||
from models.rom import Rom, RomFile, RomMetadata, RomUser
|
||||
from sqlalchemy import (
|
||||
BigInteger,
|
||||
Integer,
|
||||
Numeric,
|
||||
Row,
|
||||
SmallInteger,
|
||||
String,
|
||||
Text,
|
||||
and_,
|
||||
case,
|
||||
cast,
|
||||
@ -423,9 +422,7 @@ class DBRomsHandler(DBBaseHandler):
|
||||
order_attr = Rom.name
|
||||
|
||||
# Ignore case when the order attribute is a number
|
||||
if not isinstance(
|
||||
order_attr.type, (Integer, BigInteger, SmallInteger, Numeric)
|
||||
):
|
||||
if isinstance(order_attr.type, (String, Text)):
|
||||
# Remove any leading articles
|
||||
order_attr = func.trim(
|
||||
func.lower(order_attr).regexp_replace(r"^(the|a|an)\s+", "", "i")
|
||||
|
||||
@ -260,10 +260,10 @@ class Rom(BaseModel):
|
||||
|
||||
# # Metadata fields
|
||||
@property
|
||||
def youtube_video_id(self) -> str:
|
||||
def youtube_video_id(self) -> str | None:
|
||||
if self.igdb_metadata:
|
||||
return self.igdb_metadata.get("youtube_video_id", "")
|
||||
return ""
|
||||
return self.igdb_metadata.get("youtube_video_id", None)
|
||||
return None
|
||||
|
||||
@property
|
||||
def alternative_names(self) -> list[str]:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user