Merge pull request #3611 from InspectorCaracal/reports-patch

Update Reports contrib
This commit is contained in:
Griatch 2024-09-10 14:09:29 +02:00 committed by GitHub
commit 186818c811
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 7 deletions

View file

@ -24,11 +24,6 @@ if hasattr(settings, "INGAME_REPORT_STATUS_TAGS"):
def menunode_list_reports(caller, raw_string, **kwargs):
"""Paginates and lists out reports for the provided hub"""
hub = caller.ndb._evmenu.hub
page = kwargs.get("page", 0)
start = page * _REPORTS_PER_PAGE
end = start + _REPORTS_PER_PAGE
report_slice = report_list[start:end]
hub_name = " ".join(hub.key.split("_")).title()
text = f"Managing {hub_name}"
@ -54,6 +49,11 @@ def menunode_list_reports(caller, raw_string, **kwargs):
if not report_list:
return "There is nothing there for you to manage.", {}
page = kwargs.get("page", 0)
start = page * _REPORTS_PER_PAGE
end = start + _REPORTS_PER_PAGE
report_slice = report_list[start:end]
options = [
{
"desc": f"{datetime_format(report.date_created)} - {crop(report.message, 50)}",

View file

@ -67,8 +67,8 @@ def _get_report_hub(report_type):
Note: If no matching valid script exists, this function will attempt to create it.
"""
hub_key = f"{report_type}_reports"
# NOTE: due to a regression in GLOBAL_SCRIPTS, we use search_script instead of the container
if not (hub := search.search_script(hub_key)):
from evennia import GLOBAL_SCRIPTS
if not (hub := GLOBAL_SCRIPTS.get(hub_key)):
hub = create.create_script(key=hub_key)
return hub or None