wtfs.collections.scan_jobs

Module Contents

Classes

ScanJobCollection

Provides collections with pagination, if they implement a few

class wtfs.collections.scan_jobs.ScanJobCollection(session: sqlalchemy.orm.Session, page: int = 0, group_id: str | None = None, from_date: date | None = None, to_date: date | None = None, type: Collection[str] | None = None, municipality_id: Collection[UUID | str] | None = None, term: str | None = None, sort_by: str | None = None, sort_order: str | None = None)[source]

Bases: onegov.core.collection.Pagination[onegov.wtfs.models.ScanJob]

Provides collections with pagination, if they implement a few documented properties and methods.

See onegov.ticket.TicketCollection for an example.

property page_index: int[source]

The current page.

property current_sort_by: str[source]

Returns the currently used sorting key.

Defaults to a reasonable value.

property current_sort_order: str[source]

Returns the currently used sorting order.

Defaults to a reasonable value.

property order_by: Any[source]

Returns an SqlAlchemy expression for ordering queries based on the current sorting key and ordering.

property offset: int[source]

The current position in the batch.

property previous: Self | None[source]

The previous page.

property next: Self | None[source]

The next page.

page: int | None[source]
batch_size = 20[source]
initial_sort_by = 'dispatch_date'[source]
initial_sort_order = 'descending'[source]
default_sort_order = 'ascending'[source]
SORT_BYS = ('dispatch_date', 'delivery_number', 'municipality_id')[source]
SORT_ORDERS = ('ascending', 'descending')[source]
next_delivery_number(municipality_id: UUID | str | None) int[source]

Returns the next delivery number for the given municipality.

add(**kwargs: Any) onegov.wtfs.models.ScanJob[source]

Adds a new scan job.

subset() Query[ScanJob][source]

Returns an SQLAlchemy query containing all records that should be considered for pagination.

__eq__(other: object) bool[source]

Returns True if the current and the other Pagination instance are equal. Used to find the current page in a list of pages.

default() typing_extensions.Self[source]

Returns the jobs unfiltered and ordered by default.

page_by_index(page: int) typing_extensions.Self[source]

Returns the requested page.

sort_order_by_key(sort_by: str) str[source]

Returns the sort order by key.

Defaults to ‘unsorted’.

by_order(sort_by: str) typing_extensions.Self[source]

Returns the jobs ordered by the given key.

query() Query[ScanJob][source]

Returns the jobs matching to the current filters and order.

by_id(id: uuid.UUID) onegov.wtfs.models.ScanJob | None[source]

Returns the scan job with the given ID.

delete(scan_job: onegov.wtfs.models.ScanJob) None[source]

Deletes the given scan job.