Skip to content

Commit e047cc3

Browse files
committed
squash!: implement some suggestions
1 parent 2333d13 commit e047cc3

3 files changed

Lines changed: 10 additions & 9 deletions

File tree

openedx/core/djangoapps/content_libraries/api/libraries.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -705,18 +705,18 @@ def get_backup_task_status(
705705
If no task is found, returns None.
706706
"""
707707
task_status = None
708-
if not task_id:
709-
# Get the latest task for this user and library
710-
task_status = UserTaskStatus.objects.filter(
711-
user_id=user_id,
712-
name__contains=str(library_key)
713-
).order_by('-created').first()
714-
else:
708+
if task_id:
715709
# Get the specific task by ID
716710
try:
717711
task_status = UserTaskStatus.objects.get(task_id=task_id, user_id=user_id)
718712
except UserTaskStatus.DoesNotExist:
719713
return None
714+
else:
715+
# Get the latest task for this user and library
716+
task_status = UserTaskStatus.objects.filter(
717+
user_id=user_id,
718+
name__contains=str(library_key)
719+
).order_by('-created').first()
720720

721721
if not task_status:
722722
return None

openedx/core/djangoapps/content_libraries/rest_api/libraries.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -731,7 +731,8 @@ class LibraryBackupView(APIView):
731731
732732
The HTTP 200 response has the following values:
733733
734-
* state: String description of the state of the task
734+
* state: String description of the state of the task.
735+
Possible states: "Pending", "Exporting", "Succeeded", "Failed".
735736
* url: (may be null) If the task is complete, a URL to download the .zip file
736737
737738
**Example GET Response**

openedx/core/djangoapps/content_libraries/tasks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ def generate_name(cls, arguments_dict) -> str:
507507
str: The generated name
508508
"""
509509
key = arguments_dict['library_key_str']
510-
return f'Export of {key}'
510+
return f'Backup of {key}'
511511

512512

513513
@shared_task(base=LibraryBackupTask, bind=True)

0 commit comments

Comments
 (0)