diff --git a/app/dashboard/migrations/0034_data_for_old_grants.py b/app/dashboard/migrations/0034_data_for_old_grants.py index 389babb91ec..1b48b4bccce 100644 --- a/app/dashboard/migrations/0034_data_for_old_grants.py +++ b/app/dashboard/migrations/0034_data_for_old_grants.py @@ -19,25 +19,29 @@ def record_grant_activity_helper(activity_type, grant, profile, date): grant_logo = grant.logo.url except: grant_logo = None - metadata = { - 'id': grant.id, - 'value_in_token': '{0:.2f}'.format(grant.amount_received), - 'amount_goal': '{0:.2f}'.format(grant.amount_goal), - 'token_name': grant.token_symbol, - 'title': grant.title, - 'grant_logo': grant_logo, - 'grant_url': grant.url, - 'category': 'grant', - } - kwargs = { - 'profile': profile, - 'grant': grant, - 'activity_type': activity_type, - 'metadata': metadata, - 'created_on': date, - } - if not activity_exists(activity_type, grant, 'grant', profile, date): - Activity.objects.create(**kwargs) + + try: + metadata = { + 'id': grant.id, + 'value_in_token': '{0:.2f}'.format(grant.amount_received), + 'amount_goal': '{0:.2f}'.format(grant.amount_goal), + 'token_name': grant.token_symbol, + 'title': grant.title, + 'grant_logo': grant_logo, + 'grant_url': grant.url, + 'category': 'grant', + } + kwargs = { + 'profile': profile, + 'grant': grant, + 'activity_type': activity_type, + 'metadata': metadata, + 'created_on': date, + } + if not activity_exists(activity_type, grant, 'grant', profile, date): + Activity.objects.create(**kwargs) + except: + pass def record_subscription_activity_helper(activity_type, subscription, profile, date): """Registers a new activity concerning a grant subscription