Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 24 additions & 4 deletions docs/inspections.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,32 @@ Optionally, inspection of some consignments can be skipped using a release progr

## Skipping inspections

Inspections can be skipped using release programs specified under the key `release_programs`.
Before an inspection occurs, a release programs, specified under the key `release_programs`,
can be used to skip an inspection of a particular consignment.

Two programs are supported: a naive variation of the Cut Flower Release Program
and a full version of the _Cut Flower Release Program_.
Several release programs including _Dynamic Skip Lot Program_
and _Cut Flower Release Program_ are available, but only one program can be specified at a time.

Only one program can be specified at a time.
By default, first release program under `release_programs` is used. When name of a release program
is provided as `release_program` under `inspection`, a release program with the matching name
is used. The names are the same as the keys under `release_programs` (see below).
For example, the Cut Flower Release Program (CFRP) would be explicitly enabled using:

```yaml
inspection:
release_program: cfrp
release_programs:
cfrp:
schedule:
file_name: schedule.csv
```

If an empty value (`None` in Python, `null` in JSON) is provided
as `release_program`, no release program is activated. Additionally,
any name which is not present in the `release_programs` will avoid
release program activation. For scenarios, the configuration may use
`none` as the name to avoid release program activation, while still using
a text (string) value rather than special empty value.

### Fixed Skip Lot Program

Expand Down
8 changes: 8 additions & 0 deletions popsborder/skipping.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,16 @@ def get_inspection_needed_function(config):
consignment should be inspected. The second item is a string which is the name of
the release program applied or None if no release program was applied.
"""
if "inspection" in config and "release_program" in config["inspection"]:
user_selected_program = True
selected_program_name = config["inspection"]["release_program"]
else:
user_selected_program = False
selected_program_name = None
if "release_programs" in config:
for name in sorted(config["release_programs"].keys()):
if user_selected_program and name != selected_program_name:
continue
# Notably, this does not support multiple programs at once.
# We simply return whatever is the first program alphabetically
# or raise exception if there is an unknown program name.
Expand Down