-
Notifications
You must be signed in to change notification settings - Fork 14
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
refactor: BaseBone.buildDBSort
#1077
base: develop
Are you sure you want to change the base?
Conversation
- Refactored entire code - Moved language stuff into the `BaseBone` - Support for better, talking names for "orderdir" parameter
@@ -13,7 +13,7 @@ | |||
from datetime import datetime, timedelta | |||
from enum import Enum | |||
import typing as t | |||
from viur.core import db, utils | |||
from viur.core import db, utils, current | |||
from viur.core.config import conf | |||
|
|||
if t.TYPE_CHECKING: |
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.
Please change the line below to
from ..skeleton import Skeleton, SkeletonInstance
def buildDBSort( | ||
self, | ||
name: str, | ||
skel: 'viur.core.skeleton.SkeletonInstance', |
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.
skel: 'viur.core.skeleton.SkeletonInstance', | |
skel: "SkeletonInstance", |
for item in query.queries: | ||
new_in_eq_filter = [ | ||
key for key in item.filters.keys() | ||
if any(key.rstrip().endswith(op) for op in ("<", ">", "!=")) |
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.
if any(key.rstrip().endswith(op) for op in ("<", ">", "!=")) | |
if key.rstrip().endswith(("<", ">", "!=")) |
if inEqFilter: | ||
inEqFilter = inEqFilter[0][: inEqFilter[0].find(" ")] | ||
if inEqFilter != order[0]: | ||
logging.warning(f"I fixed you query! Impossible ordering changed to {inEqFilter}, {order[0]}") |
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.
I this no longer a manually developer task? 😆
Co-authored-by: Sven Eberth <mail@sveneberth.de>
BaseBone
utils.parse
.