Skip to content

Commit

Permalink
Fix errors for compare revisions page(JSONDecodeError and Invalid lit…
Browse files Browse the repository at this point in the history
…eral int error) (#3727)

Fixes #3709
  • Loading branch information
sandeepsajan0 authored Jan 19, 2024
1 parent 8da7778 commit 9a603b6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
6 changes: 6 additions & 0 deletions hypha/apply/funds/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ class Meta:
icon = "decimal"

def prepare_data(self, value, data, serialize):
if not data:
return data
return format_number_as_currency(str(data))


Expand Down Expand Up @@ -99,6 +101,8 @@ def format_data(self, data):
return ", ".join(data[field] for field in ADDRESS_FIELDS_ORDER if data[field])

def prepare_data(self, value, data, serialize):
if not data:
return data
data = json.loads(data)
data = {field: data[field] for field in ADDRESS_FIELDS_ORDER}

Expand Down Expand Up @@ -193,6 +197,8 @@ def get_field_kwargs(self, struct_value, *args, **kwargs):
return field_kwargs

def prepare_data(self, value, data, serialize):
if not data:
return data
if value["duration_type"] == self.DAYS:
return self.DURATION_DAY_OPTIONS[int(data)]
if value["duration_type"] == self.WEEKS:
Expand Down
6 changes: 5 additions & 1 deletion hypha/apply/stream_forms/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,8 @@ def get_field_kwargs(self, struct_value):
return kwargs

def prepare_data(self, value, data, serialize=False):
if not data:
return data
base_prepare = super().prepare_data
return [base_prepare(value, item, serialize) for item in data]

Expand Down Expand Up @@ -443,7 +445,9 @@ def get_field_kwargs(self, struct_value):

def prepare_data(self, value, data, serialize):
if serialize:
return [file.serialize() for file in data]
if data:
return [file.serialize() for file in data]
return None
return data

def no_response(self):
Expand Down

0 comments on commit 9a603b6

Please sign in to comment.