Skip to content

Commit

Permalink
Bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
nursix committed Nov 14, 2024
1 parent 6857e26 commit 34fb428
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 19 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
nursix-dev-6019-ga189f5c2c (2024-11-14 13:46:14)
nursix-dev-6020-g6857e266c (2024-11-14 20:45:35)
47 changes: 29 additions & 18 deletions modules/templates/MRCMS/reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,12 +171,6 @@ def formfields(cls, r, report_name):
),
default = default_org,
),
Field("shelter_id",
label = T("Shelter"),
requires = IS_ONE_OF_EMPTY(db, "cr_shelter.id",
rtable.shelter_id.represent,
),
),
DateField("start_date",
label = T("From Date"),
default = one_month_ago,
Expand All @@ -191,17 +185,26 @@ def formfields(cls, r, report_name):
),
]

# Filter shelter list to just those for organisation
options = {"trigger": "organisation_id",
"target": "shelter_id",
"lookupPrefix": "cr",
"lookupResource": "shelter",
"showEmptyField": False,
"optional": True,
}
jquery_ready = current.response.s3.jquery_ready
jquery_ready.append('''$.filterOptionsS3(%s)''' % \
json.dumps(options, separators=JSONSEPARATORS))
# Allow shelter selection if user has permission
if current.auth.permission.has_permission("read", c="cr", f="shelter"):
formfields.insert(1, Field("shelter_id",
label = T("Shelter"),
requires = IS_ONE_OF_EMPTY(db, "cr_shelter.id",
rtable.shelter_id.represent,
),
))

# Filter shelter list to just those for organisation
options = {"trigger": "organisation_id",
"target": "shelter_id",
"lookupPrefix": "cr",
"lookupResource": "shelter",
"showEmptyField": False,
"optional": True,
}
jquery_ready = current.response.s3.jquery_ready
jquery_ready.append('''$.filterOptionsS3(%s)''' % \
json.dumps(options, separators=JSONSEPARATORS))

return formfields

Expand Down Expand Up @@ -2025,7 +2028,15 @@ def extract(cls, organisation_id, shelter_id, start_date, end_date):
# -------------------------------------------------------------------------
@staticmethod
def get_shelter_site_id(shelter_id):
# TODO docstring
"""
Returns the site_id for a shelter
Args:
shelter_id: the cr_shelter record ID
Returns:
site_id
"""

table = current.s3db.cr_shelter
query = (table.id == shelter_id) & (table.deleted == False)
Expand Down

0 comments on commit 34fb428

Please sign in to comment.