prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Single user syncing - Lesson completion is not restored after second setup of the same learner account
  ## Observed behavior
  I have setup a learner-only device and have completed a lesson assigned to the learner user which is then synced correctly to the server. After that I've deleted the android app storage and cache and repeated the setup for the same user expecting the lesson progress to be restored while in reality it does not get restored and the learner has to start over.
  
  ## Expected behavior
  Any synced user data should be restored.
  
  ## Steps to reproduce the issue
  1. Install this Windows [build](https://buildkite.com/learningequality/kolibri-windows/builds/1930) and this Android [build](https://buildkite.com/learningequality/kolibri-android-installer/builds/2692)
  2. Setup the Windows app as a server and setup a learner device on Android.
  3. As a learner complete an assigned lesson.
  4. As an admin go to Coach>Reports>Lessons and verify that the lesson progress is synced correctly.
  5. Delete the cache and storage of the android app and setup the same learner user again. Observe that there is no indication for the progress made so far.
  
  ## Additional information
  Admin:
  ![2021-09-16_12-39-50](https://user-images.githubusercontent.com/79847249/133593574-4c5124df-d5d8-421c-8d79-9e36c04c8fe0.png)
  
  Learner with completed lesson:
  ![2021-09-16_12-38-33](https://user-images.githubusercontent.com/79847249/133593661-6cf00ade-1a61-45f6-93d7-cea75eda7203.png)
  
  Restored learner device without any indication of the progress made:
  ![2021-09-16_12-49-17](https://user-images.githubusercontent.com/79847249/133593883-a6232fdc-10af-46c0-a1ed-d4b566ee94b8.png)
  
  
  ## Windows Logs
  [logs.zip](https://github.com/learningequality/kolibri/files/7176855/logs.zip)
  
  ## Android and Ubuntu Logs and DB files
  https://drive.google.com/file/d/1RAZG77NHuX92puj-KxA-GtkSpx3JxjyZ/view?usp=sharing
  
  ## Usage Details
   - OS: Windows 10, Android 11
   - Browser: Chrome
  Single user syncing - Lesson completion is not restored after second setup of the same learner account
  ## Observed behavior
  I have setup a learner-only device and have completed a lesson assigned to the learner user which is then synced correctly to the server. After that I've deleted the android app storage and cache and repeated the setup for the same user expecting the lesson progress to be restored while in reality it does not get restored and the learner has to start over.
  
  ## Expected behavior
  Any synced user data should be restored.
  
  ## Steps to reproduce the issue
  1. Install this Windows [build](https://buildkite.com/learningequality/kolibri-windows/builds/1930) and this Android [build](https://buildkite.com/learningequality/kolibri-android-installer/builds/2692)
  2. Setup the Windows app as a server and setup a learner device on Android.
  3. As a learner complete an assigned lesson.
  4. As an admin go to Coach>Reports>Lessons and verify that the lesson progress is synced correctly.
  5. Delete the cache and storage of the android app and setup the same learner user again. Observe that there is no indication for the progress made so far.
  
  ## Additional information
  Admin:
  ![2021-09-16_12-39-50](https://user-images.githubusercontent.com/79847249/133593574-4c5124df-d5d8-421c-8d79-9e36c04c8fe0.png)
  
  Learner with completed lesson:
  ![2021-09-16_12-38-33](https://user-images.githubusercontent.com/79847249/133593661-6cf00ade-1a61-45f6-93d7-cea75eda7203.png)
  
  Restored learner device without any indication of the progress made:
  ![2021-09-16_12-49-17](https://user-images.githubusercontent.com/79847249/133593883-a6232fdc-10af-46c0-a1ed-d4b566ee94b8.png)
  
  
  ## Windows Logs
  [logs.zip](https://github.com/learningequality/kolibri/files/7176855/logs.zip)
  
  ## Android and Ubuntu Logs and DB files
  https://drive.google.com/file/d/1RAZG77NHuX92puj-KxA-GtkSpx3JxjyZ/view?usp=sharing
  
  ## Usage Details
   - OS: Windows 10, Android 11
   - Browser: Chrome
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `kolibri/core/exams/kolibri_plugin.py`
  Content:
  ```
  1 # To reinstate the original functionality, please remove this header comment
  2 # and uncomment the code below
  3 # from .single_user_assignment_utils import (
  4 #     update_assignments_from_individual_syncable_exams,
  5 # )
  6 # from .single_user_assignment_utils import (
  7 #     update_individual_syncable_exams_from_assignments,
  8 # )
  9 # from kolibri.core.auth.hooks import FacilityDataSyncHook
  10 # from kolibri.plugins.hooks import register_hook
  11 # @register_hook
  12 # class SingleUserExamSyncHook(FacilityDataSyncHook):
  13 #     def pre_transfer(
  14 #         self,
  15 #         dataset_id,
  16 #         local_is_single_user,
  17 #         remote_is_single_user,
  18 #         single_user_id,
  19 #         context,
  20 #     ):
  21 #         # if we're about to send data to a single-user device, prep the syncable exam assignments
  22 #         if context.is_producer and remote_is_single_user:
  23 #             update_individual_syncable_exams_from_assignments(single_user_id)
  24 #     def post_transfer(
  25 #         self,
  26 #         dataset_id,
  27 #         local_is_single_user,
  28 #         remote_is_single_user,
  29 #         single_user_id,
  30 #         context,
  31 #     ):
  32 #         # if we've just received data on a single-user device, update the exams and assignments
  33 #         if context.is_receiver and local_is_single_user:
  34 #             update_assignments_from_individual_syncable_exams(single_user_id)
  35
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/kolibri/core/exams/kolibri_plugin.py b/kolibri/core/exams/kolibri_plugin.py
  --- a/kolibri/core/exams/kolibri_plugin.py
  +++ b/kolibri/core/exams/kolibri_plugin.py
  @@ -1,5 +1,5 @@
   # To reinstate the original functionality, please remove this header comment
  -# and uncomment the code below
  +# and uncomment the code below (and re-enable exams in test_single_user_assignment_sync, search for "TODO")
   # from .single_user_assignment_utils import (
   #     update_assignments_from_individual_syncable_exams,
   # )
  
verification_info: {"golden_diff": "diff --git a/kolibri/core/exams/kolibri_plugin.py b/kolibri/core/exams/kolibri_plugin.py\n--- a/kolibri/core/exams/kolibri_plugin.py\n+++ b/kolibri/core/exams/kolibri_plugin.py\n@@ -1,5 +1,5 @@\n # To reinstate the original functionality, please remove this header comment\n-# and uncomment the code below\n+# and uncomment the code below (and re-enable exams in test_single_user_assignment_sync, search for \"TODO\")\n # from .single_user_assignment_utils import (\n #     update_assignments_from_individual_syncable_exams,\n # )\n", "issue": "Single user syncing - Lesson completion is not restored after second setup of the same learner account\n## Observed behavior\r\nI have setup a learner-only device and have completed a lesson assigned to the learner user which is then synced correctly to the server. After that I've deleted the android app storage and cache and repeated the setup for the same user expecting the lesson progress to be restored while in reality it does not get restored and the learner has to start over.\r\n\r\n## Expected behavior\r\nAny synced user data should be restored.\r\n\r\n## Steps to reproduce the issue\r\n1. Install this Windows [build](https://buildkite.com/learningequality/kolibri-windows/builds/1930) and this Android [build](https://buildkite.com/learningequality/kolibri-android-installer/builds/2692)\r\n2. Setup the Windows app as a server and setup a learner device on Android.\r\n3. As a learner complete an assigned lesson.\r\n4. As an admin go to Coach>Reports>Lessons and verify that the lesson progress is synced correctly.\r\n5. Delete the cache and storage of the android app and setup the same learner user again. Observe that there is no indication for the progress made so far.\r\n\r\n## Additional information\r\nAdmin:\r\n![2021-09-16_12-39-50](https://user-images.githubusercontent.com/79847249/133593574-4c5124df-d5d8-421c-8d79-9e36c04c8fe0.png)\r\n\r\nLearner with completed lesson:\r\n![2021-09-16_12-38-33](https://user-images.githubusercontent.com/79847249/133593661-6cf00ade-1a61-45f6-93d7-cea75eda7203.png)\r\n\r\nRestored learner device without any indication of the progress made:\r\n![2021-09-16_12-49-17](https://user-images.githubusercontent.com/79847249/133593883-a6232fdc-10af-46c0-a1ed-d4b566ee94b8.png)\r\n\r\n\r\n## Windows Logs\r\n[logs.zip](https://github.com/learningequality/kolibri/files/7176855/logs.zip)\r\n\r\n## Android and Ubuntu Logs and DB files\r\nhttps://drive.google.com/file/d/1RAZG77NHuX92puj-KxA-GtkSpx3JxjyZ/view?usp=sharing\r\n\r\n## Usage Details\r\n - OS: Windows 10, Android 11\r\n - Browser: Chrome\nSingle user syncing - Lesson completion is not restored after second setup of the same learner account\n## Observed behavior\r\nI have setup a learner-only device and have completed a lesson assigned to the learner user which is then synced correctly to the server. After that I've deleted the android app storage and cache and repeated the setup for the same user expecting the lesson progress to be restored while in reality it does not get restored and the learner has to start over.\r\n\r\n## Expected behavior\r\nAny synced user data should be restored.\r\n\r\n## Steps to reproduce the issue\r\n1. Install this Windows [build](https://buildkite.com/learningequality/kolibri-windows/builds/1930) and this Android [build](https://buildkite.com/learningequality/kolibri-android-installer/builds/2692)\r\n2. Setup the Windows app as a server and setup a learner device on Android.\r\n3. As a learner complete an assigned lesson.\r\n4. As an admin go to Coach>Reports>Lessons and verify that the lesson progress is synced correctly.\r\n5. Delete the cache and storage of the android app and setup the same learner user again. Observe that there is no indication for the progress made so far.\r\n\r\n## Additional information\r\nAdmin:\r\n![2021-09-16_12-39-50](https://user-images.githubusercontent.com/79847249/133593574-4c5124df-d5d8-421c-8d79-9e36c04c8fe0.png)\r\n\r\nLearner with completed lesson:\r\n![2021-09-16_12-38-33](https://user-images.githubusercontent.com/79847249/133593661-6cf00ade-1a61-45f6-93d7-cea75eda7203.png)\r\n\r\nRestored learner device without any indication of the progress made:\r\n![2021-09-16_12-49-17](https://user-images.githubusercontent.com/79847249/133593883-a6232fdc-10af-46c0-a1ed-d4b566ee94b8.png)\r\n\r\n\r\n## Windows Logs\r\n[logs.zip](https://github.com/learningequality/kolibri/files/7176855/logs.zip)\r\n\r\n## Android and Ubuntu Logs and DB files\r\nhttps://drive.google.com/file/d/1RAZG77NHuX92puj-KxA-GtkSpx3JxjyZ/view?usp=sharing\r\n\r\n## Usage Details\r\n - OS: Windows 10, Android 11\r\n - Browser: Chrome\n", "before_files": [{"content": "# To reinstate the original functionality, please remove this header comment\n# and uncomment the code below\n# from .single_user_assignment_utils import (\n#     update_assignments_from_individual_syncable_exams,\n# )\n# from .single_user_assignment_utils import (\n#     update_individual_syncable_exams_from_assignments,\n# )\n# from kolibri.core.auth.hooks import FacilityDataSyncHook\n# from kolibri.plugins.hooks import register_hook\n# @register_hook\n# class SingleUserExamSyncHook(FacilityDataSyncHook):\n#     def pre_transfer(\n#         self,\n#         dataset_id,\n#         local_is_single_user,\n#         remote_is_single_user,\n#         single_user_id,\n#         context,\n#     ):\n#         # if we're about to send data to a single-user device, prep the syncable exam assignments\n#         if context.is_producer and remote_is_single_user:\n#             update_individual_syncable_exams_from_assignments(single_user_id)\n#     def post_transfer(\n#         self,\n#         dataset_id,\n#         local_is_single_user,\n#         remote_is_single_user,\n#         single_user_id,\n#         context,\n#     ):\n#         # if we've just received data on a single-user device, update the exams and assignments\n#         if context.is_receiver and local_is_single_user:\n#             update_assignments_from_individual_syncable_exams(single_user_id)\n", "path": "kolibri/core/exams/kolibri_plugin.py"}], "after_files": [{"content": "# To reinstate the original functionality, please remove this header comment\n# and uncomment the code below (and re-enable exams in test_single_user_assignment_sync, search for \"TODO\")\n# from .single_user_assignment_utils import (\n#     update_assignments_from_individual_syncable_exams,\n# )\n# from .single_user_assignment_utils import (\n#     update_individual_syncable_exams_from_assignments,\n# )\n# from kolibri.core.auth.hooks import FacilityDataSyncHook\n# from kolibri.plugins.hooks import register_hook\n# @register_hook\n# class SingleUserExamSyncHook(FacilityDataSyncHook):\n#     def pre_transfer(\n#         self,\n#         dataset_id,\n#         local_is_single_user,\n#         remote_is_single_user,\n#         single_user_id,\n#         context,\n#     ):\n#         # if we're about to send data to a single-user device, prep the syncable exam assignments\n#         if context.is_producer and remote_is_single_user:\n#             update_individual_syncable_exams_from_assignments(single_user_id)\n#     def post_transfer(\n#         self,\n#         dataset_id,\n#         local_is_single_user,\n#         remote_is_single_user,\n#         single_user_id,\n#         context,\n#     ):\n#         # if we've just received data on a single-user device, update the exams and assignments\n#         if context.is_receiver and local_is_single_user:\n#             update_assignments_from_individual_syncable_exams(single_user_id)\n", "path": "kolibri/core/exams/kolibri_plugin.py"}]}