Skip to content
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

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from

Conversation

phorward
Copy link
Member

@phorward phorward commented Feb 23, 2024

  • Refactored entire code
  • Moved language stuff into the BaseBone
  • Support for better, talking names for "orderdir" parameter
  • Moved orderdir parse function into utils.parse.

- Refactored entire code
- Moved language stuff into the `BaseBone`
- Support for better, talking names for "orderdir" parameter
@phorward phorward added feature New feature or request refactoring Pull requests that refactor code but do not change its behavior. performance This issue or pull request enhances or criticizes the performance. labels Feb 29, 2024
@phorward phorward added this to the ViUR-core v3.7 milestone Feb 29, 2024
@phorward phorward added Priority: High After critical issues are fixed, these should be dealt with before any further issues. Priority: Medium This issue may be useful, and needs some attention. and removed Priority: High After critical issues are fixed, these should be dealt with before any further issues. labels May 22, 2024
@phorward phorward marked this pull request as ready for review May 23, 2024 10:07
ArneGudermann
ArneGudermann previously approved these changes May 24, 2024
@@ -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:
Copy link
Member

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',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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 ("<", ">", "!="))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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]}")
Copy link
Member

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? 😆

src/viur/core/bones/relational.py Outdated Show resolved Hide resolved
src/viur/core/bones/relational.py Outdated Show resolved Hide resolved
Co-authored-by: Sven Eberth <mail@sveneberth.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request performance This issue or pull request enhances or criticizes the performance. Priority: Medium This issue may be useful, and needs some attention. refactoring Pull requests that refactor code but do not change its behavior.
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

None yet

3 participants