Skip to content

Commit 073a238

Browse files
JakobMiesnerkpsherva
authored andcommitted
stats: add feature flag for extending record indices with stats
1 parent 147dfe0 commit 073a238

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

invenio_app_ils/config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1247,6 +1247,7 @@ def _(x):
12471247

12481248
# Feature Toggles
12491249
ILS_SELF_CHECKOUT_ENABLED = False
1250+
ILS_EXTEND_INDICES_WITH_STATS_ENABLED = False
12501251

12511252
# Use default frontpage
12521253
THEME_FRONTPAGE = False

invenio_app_ils/ext.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,4 +330,5 @@ def before_loan_index_hook(sender, json=None, record=None, index=None, **kwargs)
330330
:param kwargs: Any other parameters.
331331
"""
332332
index_extra_fields_for_loan(json)
333-
index_stats_fields_for_loan(json)
333+
if current_app.config["ILS_EXTEND_INDICES_WITH_STATS_ENABLED"]:
334+
index_stats_fields_for_loan(json)

tests/api/ils/stats/conftest.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,12 @@ def empty_event_queues():
1717
queue = current_stats.events[event].queue
1818
queue.queue.declare()
1919
queue.consume()
20+
21+
@pytest.fixture()
22+
def with_stats_index_extensions(app):
23+
"""Enable indices to be extended with stats data."""
24+
app.config["ILS_EXTEND_INDICES_WITH_STATS_ENABLED"] = True
25+
yield
26+
app.config["ILS_EXTEND_INDICES_WITH_STATS_ENABLED"] = False
27+
28+

0 commit comments

Comments
 (0)