More Shipstation integrations(warehouses)
This commit is contained in:
@@ -19,7 +19,7 @@ from app import config
|
||||
from app.companies import parse_mapping, resolve_company_for_skus
|
||||
from app.queries import get_open_ticket_numbers
|
||||
from app.services.base import OrderService, NormalizedOrder
|
||||
from app.status_rules import parse_status_list
|
||||
from app.status_rules import get_active_statuses
|
||||
|
||||
SEARCH_PAGE_SIZE = 50
|
||||
REQUEST_TIMEOUT_SECONDS = 30
|
||||
@@ -75,11 +75,9 @@ class JiraService(OrderService):
|
||||
"npi": settings["JIRA_FIELD_NPI"].strip(),
|
||||
}
|
||||
|
||||
# Statuses at which we stop re-checking a ticket for changes -
|
||||
# see fetch_orders() for why we re-check at all.
|
||||
self.terminal_statuses = parse_status_list(
|
||||
settings["JIRA_TERMINAL_STATUSES"] or config.DEFAULT_TERMINAL_STATUSES
|
||||
)
|
||||
# The one (or few) statuses that mean "still needs work" - see
|
||||
# fetch_orders() for why we re-check tickets that are still active.
|
||||
self.active_statuses = get_active_statuses()
|
||||
|
||||
@staticmethod
|
||||
def _split_field_ids(raw: str) -> List[str]:
|
||||
@@ -97,13 +95,13 @@ class JiraService(OrderService):
|
||||
|
||||
# Your JQL (e.g. "created >= startOfDay()") only catches NEW
|
||||
# tickets. On its own, that would miss a ticket that gets
|
||||
# cancelled a day or two after it was created, since it no
|
||||
# longer matches "created today". So on top of your JQL, we
|
||||
# also re-check every previously-imported JIRA ticket that
|
||||
# hasn't reached a terminal status yet (JIRA_TERMINAL_STATUSES,
|
||||
# default just "Cancelled") - that's how a later cancellation
|
||||
# gets picked up.
|
||||
recheck_keys = get_open_ticket_numbers("jira", self.terminal_statuses)
|
||||
# cancelled - or reaches any other status - a day or two after
|
||||
# it was created, since it no longer matches "created today". So
|
||||
# on top of your JQL, we also re-check every previously-imported
|
||||
# JIRA ticket that's still in an active status (ACTIVE_STATUSES,
|
||||
# default just "Created") - that's how a later status change
|
||||
# gets picked up, no matter what it changes to.
|
||||
recheck_keys = get_open_ticket_numbers("jira", self.active_statuses)
|
||||
effective_jql = self._build_effective_jql(self.jql, recheck_keys)
|
||||
|
||||
issues = self._search_all_issues(effective_jql)
|
||||
@@ -118,11 +116,11 @@ class JiraService(OrderService):
|
||||
want to re-check, being careful to keep any ORDER BY clause at
|
||||
the very end (JQL requires it there).
|
||||
|
||||
Note: as the number of still-open tracked tickets grows, this
|
||||
"key in (...)" list grows too. If that ever gets unwieldy, add
|
||||
more statuses to JIRA_TERMINAL_STATUSES (e.g. "Done", once you
|
||||
know your workflow's real terminal status names) so fulfilled
|
||||
tickets stop being re-checked and drop out of this list.
|
||||
Note: as the number of still-active tracked tickets grows, this
|
||||
"key in (...)" list grows too. Since ACTIVE_STATUSES defaults to
|
||||
just "Created", a ticket drops out of this list the moment it
|
||||
moves to anything else, so this naturally stays bounded to
|
||||
what's genuinely still unprocessed.
|
||||
"""
|
||||
if not recheck_keys:
|
||||
return base_jql
|
||||
|
||||
Reference in New Issue
Block a user