-
Notifications
You must be signed in to change notification settings - Fork 26
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
Circulation: Policy configuration #124
Conversation
6b52a0c
to
c6c1b41
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clean the number of commits that are part of this PR (should be only one, must be a rebase problem).
Some files shouldn't be part of this PR, such as:
- all the translations files
- the run-tests.sh file
- maybe others... 😉
Tests run successfully. 👍
data/circulation_policies.json
Outdated
{ | ||
"$schema": "https://ils.test.rero.ch/schema/circ_policies/circ_policy-v0.0.1.json", | ||
"name": "standard", | ||
"description": "default standard circulation policy", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Start the description with a capital and end it with a dot.
data/circulation_policies.json
Outdated
{ | ||
"$schema": "https://ils.test.rero.ch/schema/circ_policies/circ_policy-v0.0.1.json", | ||
"name": "short", | ||
"description": "short circulation policy", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Start the description with a capital and end it with a dot.
data/circulation_policies.json
Outdated
{ | ||
"$schema": "https://ils.test.rero.ch/schema/circ_policies/circ_policy-v0.0.1.json", | ||
"name": "on-site", | ||
"description": "on-site circulation policy", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Start the description with a capital and end it with a dot.
{ | ||
"key": "name", | ||
"validationMessage": { | ||
"alreadyTakenMessage": "The circulation policy name is already taken" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing dot at the end of the message.
{ | ||
"$schema": "http://json-schema.org/draft-04/schema#", | ||
"type": "object", | ||
"title": "CircPolicy", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not Circulation policy
?
"$schema": "http://json-schema.org/draft-04/schema#", | ||
"type": "object", | ||
"title": "CircPolicy", | ||
"description": "JSON schema for circ_policies.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be JSON schema for circulation policies.
"properties": { | ||
"$schema": { | ||
"title": "Schema", | ||
"description": "Schema to validate circ_policies records against.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change circ_policies
to circulation policies
.
"minLength": 9 | ||
}, | ||
"pid": { | ||
"title": "CircPolicy ID", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change CircPolicy
to Circulation policy
. And check all the JSON schema with this rule.
}, | ||
"name": { | ||
"title": "CircPolicy name", | ||
"description": "The name of the circulation policy", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing dot at the end of the message. And check all the description messages.
}, | ||
"organisation_pid": { | ||
"title": "Organisation ID", | ||
"description": "The organisation_pid pid of this circulation policy", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PID of the organisation in which this circulation policy applies.
Or something like it.
from ..minters import id_minter | ||
from .providers import CircPolicyProvider | ||
|
||
circ_policies_id_minter = partial( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
singular on policies ?
class CircPolicyIdentifier(RecordIdentifier): | ||
"""Sequence generator for CircPolicy identifiers.""" | ||
|
||
__tablename__ = 'circ_policies_id' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
singular on policies ?
{%- block javascript %} | ||
{{ super() }} | ||
{% assets "rero_ils_tooltips_js" %}<script src="{{ ASSET_URL }}"></script>{% endassets %} | ||
{%- endblock javascript %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indent is 2 spaces (file)
"""Circ policy name Validate.""" | ||
response = { | ||
'name': None, | ||
'organisation_pid': None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this (unused)
rero_ils/config.py
Outdated
), | ||
cipo=dict( | ||
pid_type='cipo', | ||
pid_minter='circ_policies_id', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
singular on policies ?
from rero_ils.modules.circ_policies.fetchers import \ | ||
circ_policies_id_fetcher as fetcher | ||
from rero_ils.modules.circ_policies.minters import \ | ||
circ_policies_id_minter as minter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Singular on policies ?
data = {} | ||
# first record | ||
rec_uuid = uuid4() | ||
pid1 = minters.circ_policies_id_minter(rec_uuid, data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Singular on policies ?
# second record | ||
data = {} | ||
rec_uuid = uuid4() | ||
pid2 = minters.circ_policies_id_minter(rec_uuid, data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Singular on policies ?
"number_renewals": { | ||
"title": "Maximum number of renewals", | ||
"description": "Maximum number of renewals allowed", | ||
"type": "integer" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
default value ?
rero_ils/modules/circ_policies/jsonschemas/circ_policies/circ_policy-v0.0.1.json
Show resolved
Hide resolved
85c4e85
to
24eb0ff
Compare
* NEW: add circulation policy objects Co-Authored-by: Aly Badr <[email protected]> Co-Authored-by: Gianni Pante <[email protected]>
24eb0ff
to
c59640b
Compare
Co-Authored-by: Aly Badr [email protected]
Co-Authored-by: Gianni Pante [email protected]
To test
get the PR branch
./scripts/bootstrap
./scripts/setup
run the tests
Display the list of available circulation policies (cipo), add, delete and edit