Sort Studio video uploads by creation date
This provides a better UX for video uploaders, because recent uploads are readily visible at the beginning of the table.
This commit is contained in:
@@ -162,8 +162,9 @@ class VideosHandlerTestCase(VideoUploadTestMixin, CourseTestCase):
|
||||
self.assertEqual(response.status_code, 200)
|
||||
response_videos = json.loads(response.content)["videos"]
|
||||
self.assertEqual(len(response_videos), len(self.previous_uploads))
|
||||
for response_video in response_videos:
|
||||
original_video = self._get_previous_upload(response_video["edx_video_id"])
|
||||
for i, response_video in enumerate(response_videos):
|
||||
# Videos should be returned by creation date descending
|
||||
original_video = self.previous_uploads[-(i + 1)]
|
||||
self.assertEqual(
|
||||
set(response_video.keys()),
|
||||
set(["edx_video_id", "client_video_id", "created", "duration", "status"])
|
||||
@@ -338,14 +339,14 @@ class VideoUrlsCsvTestCase(VideoUploadTestMixin, CourseTestCase):
|
||||
["{} URL".format(profile) for profile in expected_profiles]
|
||||
)
|
||||
)
|
||||
actual_video_ids = []
|
||||
for row in reader:
|
||||
rows = list(reader)
|
||||
self.assertEqual(len(rows), len(self.previous_uploads))
|
||||
for i, row in enumerate(rows):
|
||||
response_video = {
|
||||
key.decode("utf-8"): value.decode("utf-8") for key, value in row.items()
|
||||
}
|
||||
self.assertNotIn(response_video["Video ID"], actual_video_ids)
|
||||
actual_video_ids.append(response_video["Video ID"])
|
||||
original_video = self._get_previous_upload(response_video["Video ID"])
|
||||
# Videos should be returned by creation date descending
|
||||
original_video = self.previous_uploads[-(i + 1)]
|
||||
self.assertEqual(response_video["Name"], original_video["client_video_id"])
|
||||
self.assertEqual(response_video["Duration"], str(original_video["duration"]))
|
||||
dateutil.parser.parse(response_video["Date Added"])
|
||||
@@ -365,7 +366,6 @@ class VideoUrlsCsvTestCase(VideoUploadTestMixin, CourseTestCase):
|
||||
self.assertEqual(response_profile_url, original_encoded_for_profile["url"])
|
||||
else:
|
||||
self.assertEqual(response_profile_url, "")
|
||||
self.assertEqual(len(actual_video_ids), len(self.previous_uploads))
|
||||
|
||||
def test_basic(self):
|
||||
self._check_csv_response(["profile1"])
|
||||
|
||||
@@ -12,7 +12,7 @@ from django.utils.translation import ugettext as _, ugettext_noop
|
||||
from django.views.decorators.http import require_GET, require_http_methods
|
||||
import rfc6266
|
||||
|
||||
from edxval.api import create_video, get_videos_for_ids
|
||||
from edxval.api import create_video, get_videos_for_ids, SortDirection, VideoSortField
|
||||
from opaque_keys.edx.keys import CourseKey
|
||||
|
||||
from contentstore.models import VideoUploadConfig
|
||||
@@ -222,7 +222,7 @@ def _get_videos(course):
|
||||
for v in modulestore().get_all_asset_metadata(course.id, VIDEO_ASSET_TYPE)
|
||||
]
|
||||
|
||||
videos = list(get_videos_for_ids(edx_videos_ids))
|
||||
videos = list(get_videos_for_ids(edx_videos_ids, VideoSortField.created, SortDirection.desc))
|
||||
|
||||
# convert VAL's status to studio's Video Upload feature status.
|
||||
for video in videos:
|
||||
|
||||
@@ -33,7 +33,7 @@ git+https://github.com/mitocw/django-cas.git@60a5b8e5a62e63e0d5d224a87f0b489201a
|
||||
-e git+https://github.com/edx/ease.git@97de68448e5495385ba043d3091f570a699d5b5f#egg=ease
|
||||
-e git+https://github.com/edx/i18n-tools.git@56f048af9b6868613c14aeae760548834c495011#egg=i18n-tools
|
||||
-e git+https://github.com/edx/edx-oauth2-provider.git@0.4.0#egg=oauth2-provider
|
||||
-e git+https://github.com/edx/edx-val.git@ba00a5f2e0571e9a3f37d293a98efe4cbca850d5#egg=edx-val
|
||||
-e git+https://github.com/edx/edx-val.git@9ceddb4944d0a1264b345947bf486340c5774a00#egg=edx-val
|
||||
-e git+https://github.com/pmitros/RecommenderXBlock.git@9b07e807c89ba5761827d0387177f71aa57ef056#egg=recommender-xblock
|
||||
-e git+https://github.com/edx/edx-milestones.git@547f2250ee49e73ce8d7ff4e78ecf1b049892510#egg=edx-milestones
|
||||
-e git+https://github.com/edx/edx-search.git@264bb3317f98e9cb22b932aa11b89d0651fd741c#egg=edx-search
|
||||
|
||||
Reference in New Issue
Block a user