|
3 | 3 | """
|
4 | 4 |
|
5 | 5 |
|
| 6 | +import logging |
| 7 | + |
6 | 8 | from completion.exceptions import UnavailableCompletionData
|
7 | 9 | from completion.utilities import get_key_to_last_completed_block
|
8 | 10 | from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user
|
|
37 | 39 | from ..decorators import mobile_course_access, mobile_view
|
38 | 40 | from .serializers import CourseEnrollmentSerializer, CourseEnrollmentSerializerv05, UserSerializer
|
39 | 41 |
|
| 42 | +log = logging.getLogger(__name__) |
| 43 | + |
40 | 44 |
|
41 | 45 | @mobile_view(is_user=True)
|
42 | 46 | class UserDetail(generics.RetrieveAPIView):
|
@@ -178,6 +182,7 @@ def _update_last_visited_module_id(self, request, course, module_key, modificati
|
178 | 182 | try:
|
179 | 183 | descriptor = modulestore().get_item(module_key)
|
180 | 184 | except ItemNotFoundError:
|
| 185 | + log.error(f"{errors.ERROR_INVALID_MODULE_ID} %s", module_key) |
181 | 186 | return Response(errors.ERROR_INVALID_MODULE_ID, status=400)
|
182 | 187 | block = get_block_for_descriptor(
|
183 | 188 | request.user, request, descriptor, field_data_cache, course.id, course=course
|
@@ -228,12 +233,14 @@ def patch(self, request, course, *args, **kwargs): # lint-amnesty, pylint: disa
|
228 | 233 | if modification_date_string:
|
229 | 234 | modification_date = dateparse.parse_datetime(modification_date_string)
|
230 | 235 | if not modification_date or not modification_date.tzinfo:
|
| 236 | + log.error(f"{errors.ERROR_INVALID_MODIFICATION_DATE} %s", modification_date_string) |
231 | 237 | return Response(errors.ERROR_INVALID_MODIFICATION_DATE, status=400)
|
232 | 238 |
|
233 | 239 | if module_id:
|
234 | 240 | try:
|
235 | 241 | module_key = UsageKey.from_string(module_id)
|
236 | 242 | except InvalidKeyError:
|
| 243 | + log.error(f"{errors.ERROR_INVALID_MODULE_ID} %s", module_id) |
237 | 244 | return Response(errors.ERROR_INVALID_MODULE_ID, status=400)
|
238 | 245 |
|
239 | 246 | return self._update_last_visited_module_id(request, course, module_key, modification_date)
|
|
0 commit comments