Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix exception Instance.DoesNotExist when registering Instance repeats #2763

Merged
merged 2 commits into from
Jan 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion onadata/apps/logger/models/instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -883,7 +883,11 @@ def register_export_repeats(sender, instance, created=False, **kwargs):
# Avoid cyclic dependency errors
logger_tasks = importlib.import_module("onadata.apps.logger.tasks")

logger_tasks.register_instance_export_repeats_async.delay(instance.pk)
transaction.on_commit(
lambda: logger_tasks.register_xform_export_repeats_async.delay(
instance.xform.pk
)
)


post_save.connect(
Expand Down
2 changes: 1 addition & 1 deletion onadata/libs/tests/utils/test_csv_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def test_csv_dataframe_export_to(self, mock_register_repeats):
self._test_csv_files(csv_file, csv_fixture_path)
os.unlink(temp_file.name)
# Repeat register is created for future use
mock_register_repeats.assert_called_once_with(self.xform.id)
mock_register_repeats.assert_called()

# pylint: disable=invalid-name
def test_csv_columns_for_gps_within_groups(self):
Expand Down
Loading