Commit ccf76b3b by Mushtaq Ali

code refactor

parent e91481cf
...@@ -28,12 +28,10 @@ define( ...@@ -28,12 +28,10 @@ define(
*/ */
sortByValue: function(itemObject) { sortByValue: function(itemObject) {
var sortedArray = []; var sortedArray = [];
_.each(itemObject, function(value, key) { _.each(itemObject, function(value, key) {
// Push each JSON Object entry in array by [value, key] // Push each JSON Object entry in array by [value, key]
sortedArray.push([value, key]); sortedArray.push([value, key]);
}); });
return sortedArray.sort(); return sortedArray.sort();
}, },
...@@ -43,12 +41,10 @@ define( ...@@ -43,12 +41,10 @@ define(
getTranscriptClientTitle: function() { getTranscriptClientTitle: function() {
// Use a fixed length tranascript name. // Use a fixed length tranascript name.
var clientTitle = this.clientVideoID.substring(0, 20); var clientTitle = this.clientVideoID.substring(0, 20);
// Remove video file extension for transcript title. // Remove video file extension for transcript title.
_.each(this.videoSupportedFileFormats, function(videoFormat) { _.each(this.videoSupportedFileFormats, function(videoFormat) {
clientTitle.replace(videoFormat, ''); clientTitle.replace(videoFormat, '');
}); });
return clientTitle; return clientTitle;
}, },
...@@ -93,8 +89,6 @@ define( ...@@ -93,8 +89,6 @@ define(
transcripts: this.transcripts, transcripts: this.transcripts,
transcriptAvailableLanguages: this.sortByValue(this.transcriptAvailableLanguages), transcriptAvailableLanguages: this.sortByValue(this.transcriptAvailableLanguages),
edxVideoID: this.edxVideoID, edxVideoID: this.edxVideoID,
// Slice last 4 letters so that video filetype is not attached
// eg. eg. Harry-Potter.mp4 would give us eg. Harry-Potter
transcriptClientTitle: this.getTranscriptClientTitle(), transcriptClientTitle: this.getTranscriptClientTitle(),
transcriptDownloadFileFormat: TRANSCRIPT_DOWNLOAD_FILE_FORMAT transcriptDownloadFileFormat: TRANSCRIPT_DOWNLOAD_FILE_FORMAT
}) })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment