Skip to content

Commit

Permalink
MRCMS: fix AbsenceFilter too
Browse files Browse the repository at this point in the history
  • Loading branch information
nursix committed Jun 18, 2024
1 parent 0a72cd2 commit d5dc7be
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
nursix-dev-5925-g92a30e974 (2024-06-19 00:28:09)
nursix-dev-5926-g0a72cd2b5 (2024-06-19 00:35:37)
28 changes: 16 additions & 12 deletions modules/templates/MRCMS/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -981,8 +981,22 @@ def widget(self, resource, values):

input_id = "%s-%s" % (_id, operator)

variable = _variable(selector, operator)

# Populate with the value, if given
# if user has not set any of the limits, we get [] in values.
value = values.get(variable, None)
if value not in [None, []]:
if type(value) is list:
value = value[0]
try:
value = int(value)
except (ValueError, TypeError):
value = None

# Selectable options
input_opts = [OPTION("%s" % i, value=i)
input_opts = [OPTION("%s" % i, value=i) if value != i else
OPTION("%s" % i, value=i, _selected="selected")
for i in range(minimum, maximum + 1)
]
input_opts.insert(0, OPTION("", value=""))
Expand All @@ -991,19 +1005,9 @@ def widget(self, resource, values):
input_box = SELECT(input_opts,
_id = input_id,
_class = input_class,
_value = value,
)

variable = _variable(selector, operator)

# Populate with the value, if given
# if user has not set any of the limits, we get [] in values.
value = values.get(variable, None)
if value not in [None, []]:
if type(value) is list:
value = value[0]
input_box["_value"] = value
input_box["value"] = value

label = input_labels[operator]
if label:
label = DIV(LABEL("%s:" % T(input_labels[operator]),
Expand Down

0 comments on commit d5dc7be

Please sign in to comment.