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

Add more demo objects to the demo suite #64

Merged
merged 1 commit into from
Jul 11, 2024

Conversation

uittenbroekrobbert
Copy link
Contributor

@uittenbroekrobbert uittenbroekrobbert commented Jun 28, 2024

Description

Create a demo environment with 4 status columns, 3 example tasks and a user. The status names have been updated to be picked up by the translation module. This PR also renames the statuses created in a previous version so translation works.

Checklist

Please check all the boxes that apply to this pull request using "x":

  • I have tested the changes locally and verified that they work as expected.
  • I have followed the project's coding conventions and style guidelines.
  • I have rebased my branch onto the latest commit of the main branch.
  • I have squashed or reorganized my commits into logical units.
  • I have read, understood and agree to the Developer Certificate of Origin, which this project utilizes.

@uittenbroekrobbert uittenbroekrobbert requested a review from a team as a code owner June 28, 2024 10:42
Copy link
Member

@berrydenhartog berrydenhartog left a comment

Choose a reason for hiding this comment

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

Looks good. I would make the functions generic

tad/core/db.py Outdated Show resolved Hide resolved
tad/core/db.py Outdated Show resolved Hide resolved
tad/core/db.py Outdated Show resolved Hide resolved
@uittenbroekrobbert
Copy link
Contributor Author

Looks good. I would make the functions generic

Hm, I'm not sure what you mean or how that helps. Can you elaborate?

@berrydenhartog
Copy link
Member

Looks good. I would make the functions generic

Hm, I'm not sure what you mean or how that helps. Can you elaborate?

I mean that i would take hardcodes arrays outside of the function. example:

def add_demo_statuses(session: Session) -> None:
    for index, status_name in enumerate(["todo", "review", "in_progress", "done"]):
        status = session.exec(select(Status).where(Status.name == status_name)).first()
        if not status:
            status = Status(name=status_name, sort_order=index + 1)
            session.add(status)
            session.commit()
            session.commit()

i would rewrite to:

def add_demo_statuses(session: Session, status_name: String, index: int) -> None:
        status = session.exec(select(Status).where(Status.name == status_name)).first()
        if not status:
            status = Status(name=status_name, sort_order=index)
            session.add(status)
            session.commit()
            session.commit()

This would allow more flexibility in what demo mode is.

@uittenbroekrobbert uittenbroekrobbert force-pushed the feature/update-demo-suite branch 6 times, most recently from 554c1b3 to 4b2c3df Compare July 3, 2024 07:57
@uittenbroekrobbert uittenbroekrobbert marked this pull request as draft July 3, 2024 08:41
@uittenbroekrobbert uittenbroekrobbert force-pushed the feature/update-demo-suite branch from 354128d to 4c97b93 Compare July 4, 2024 06:16
@uittenbroekrobbert uittenbroekrobbert marked this pull request as ready for review July 4, 2024 06:16
tad/core/db.py Outdated Show resolved Hide resolved
@uittenbroekrobbert uittenbroekrobbert force-pushed the feature/update-demo-suite branch 2 times, most recently from 0735500 to ba6f74c Compare July 5, 2024 15:50
tad/core/db.py Show resolved Hide resolved
tests/core/test_db.py Show resolved Hide resolved
tests/core/test_db.py Outdated Show resolved Hide resolved
Copy link

sonarcloud bot commented Jul 11, 2024

Copy link
Member

@berrydenhartog berrydenhartog left a comment

Choose a reason for hiding this comment

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

LGTM

@berrydenhartog berrydenhartog merged commit 88db620 into main Jul 11, 2024
14 checks passed
@berrydenhartog berrydenhartog deleted the feature/update-demo-suite branch July 11, 2024 07:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants