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

[SDESK-7444] - Planning: Migrate planning:flag_expired command to async #2149

Merged
merged 11 commits into from
Dec 13, 2024

Conversation

BrianMwangi21
Copy link

Purpose

This PR updates the planning:flag_expired command command to async by:

  • Updating command to use new format
  • Making use of the new async methods from events and planning to get and flag expired commands
  • Updated tests

Solves SDESK-7444

Copy link
Collaborator

@MarkLark86 MarkLark86 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, just some unit tests failing that needs to be looked into

server/planning/__init__.py Outdated Show resolved Hide resolved
Copy link

@eos87 eos87 left a comment

Choose a reason for hiding this comment

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

It looks good, I just left a few comments. I can see these functions rely much on dictionaries. In general, we should lean into using the pydantic models as much as possible.

server/planning/commands/flag_expired_items.py Outdated Show resolved Hide resolved
server/planning/commands/flag_expired_items.py Outdated Show resolved Hide resolved
server/planning/commands/flag_expired_items.py Outdated Show resolved Hide resolved
server/planning/commands/flag_expired_items_test.py Outdated Show resolved Hide resolved
server/planning/commands/flag_expired_items_test.py Outdated Show resolved Hide resolved
server/planning/planning/service.py Show resolved Hide resolved
Copy link

@eos87 eos87 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 to me!

@eos87
Copy link

eos87 commented Dec 10, 2024

@BrianMwangi21 there are some broken references to old events.service.py. Please check.

from planning.events.service import EventsAsyncService
E   ModuleNotFoundError: No module named 'planning.events.service'

"planning",
{
"p1": False,
"p2": False,
"p3": False,
"p4": False,
"p5": True,
"p6": False,
"p6": True,
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm wondering, why were p6 and p8 changed in the tests from False to True. Is there any logic or query that is not the same as the old code?

self.assertExpired("planning", {"p1": False, "p2": False, "p3": False, "p4": True})
await flag_expired_items_handler()
await self.assertExpired("events", {"e1": False, "e2": False, "e3": False, "e4": True})
await self.assertExpired("planning", {"p1": False, "p2": False, "p3": True, "p4": True})
Copy link
Collaborator

Choose a reason for hiding this comment

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

Also here as well, why is p3 now True

@MarkLark86
Copy link
Collaborator

Looks good @BrianMwangi21 👍
Just left a couple small comments, mostly about the changes in the test data. Besides that, everything looks good.

@MarkLark86
Copy link
Collaborator

@BrianMwangi21 Looks like the changes to the test data is required, as the new async Planning service doesn't yet have all the functionality from the original service (which involved processing the Coverages and dates etc), which would be why these tests were failing before your test condition changes.

We can look at this later once the async Planning service is updated

@BrianMwangi21
Copy link
Author

@MarkLark86 this is noted. I've added a TODO on the test file on the same.

@BrianMwangi21 BrianMwangi21 merged commit 744b6a9 into superdesk:async Dec 13, 2024
4 of 10 checks passed
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