Skip to content

Production #41

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
.DS_Store
httpd-app.conf
npm-debug.log
public/.DS_Store
node_modules
bower_components
server/config/config.js
server/config/config.js
.idea
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
"dependencies": {
"angular-video-time": "^1.0.0",
"body-parser": "^1.12.4",
"connect-redis": "^3.1.0",
"connect-session-sequelize": "^2.3.0",
"cookie-parser": "^1.3.5",
"express": "^4.12.4",
"express-session": "^1.11.2",
"express-session": "^1.14.2",
"jade": "^1.10.0",
"moment": "^2.10.6",
"moment-timezone": "^0.4.0",
Expand All @@ -27,7 +28,8 @@
},
"scripts": {
"test": "node_modules/mocha/bin/mocha",
"start": "node server.js"
"start": "node server.js",
"sync": "node cli/sync.js"
},
"repository": {
"type": "git",
Expand Down
Binary file modified public/.DS_Store
Binary file not shown.
2 changes: 2 additions & 0 deletions public/app/issues/checking.jade
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
.panel-heading.text-center {{ctrl.lesson.languageSery.title + " #" + ctrl.lesson.number + " - " + ctrl.lesson.title}}
.panel-body.text-center
video-player(config="ctrl.config")
.container.text-right
a(href="{{ctrl.lesson.qaUrl}}") Watch on Dropbox
.container(ng-show="ctrl.identity.isAdmin()")
.btn-group(role="group")
button.btn.btn-default(ng-hide="ctrl.lesson.checkedLanguage", type="button", ng-click="ctrl.markAsLanguageApproved()") Mark as Language Approved
Expand Down
12 changes: 11 additions & 1 deletion public/app/languageSeries/language-series-details.jade
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,14 @@
h1
a(href="#", editable-text="languageSeries.title", onbeforesave="update({title: $data})") {{languageSeries.title}}
.container-fluid
lessons-list(config="lessonsConfig")
lessons-list(config="lessonsConfig")
.col-sm-6
.panel.panel-default(ng-show="identity.isAdmin()")
.panel-heading
h3.panel-title Create Lessons in Series
.panel-body
.input-group
select.form-control(ng-model="newLessons.selectedNumber")
option(ng-repeat="number in newLessons.possibleValues", value="{{number}}") {{number}}
span.input-group-btn
button.btn.btn-default(type="button", ng-click="createNewLessons()") Add {{newLessons.selectedNumber}} Lessons
46 changes: 43 additions & 3 deletions public/app/languageSeries/vtmsLanguageSeriesDetailsController.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
angular.module('vtms').controller('vtmsLanguageSeriesDetailController', function($scope, vtmsLanguageSeries, vtmsLesson, $routeParams, vtmsNotifier) {
angular.module('vtms').controller('vtmsLanguageSeriesDetailController', function($scope, vtmsLanguageSeries, vtmsGlobalTask, vtmsLesson, vtmsTask, $routeParams, vtmsNotifier, vtmsIdentity) {

$scope.identity = vtmsIdentity.currentUser;

$scope.sortOptions = [
{value: "number", text: "Sort by Number"},
Expand All @@ -8,7 +10,9 @@ angular.module('vtms').controller('vtmsLanguageSeriesDetailController', function

$scope.selectedSortOption = $scope.sortOptions[0].value;

$scope.languageSeries = vtmsLanguageSeries.get({id: $routeParams.id});
$scope.languageSeries = vtmsLanguageSeries.get({id: $routeParams.id}, function(languageSeries) {
$scope.globalTaskList = vtmsGlobalTask.getListForSeries({id: languageSeries.fkSeries});
});

$scope.lessonsConfig = {
title: 'Lessons',
Expand Down Expand Up @@ -39,6 +43,42 @@ angular.module('vtms').controller('vtmsLanguageSeriesDetailController', function
}
};

$scope.globalTaskList =

$scope.newLessons = {
selectedNumber: 0,
currentMaxNumber: 0,
possibleValues: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 50, 100]
};

$scope.createNewLessons = function() {
if($scope.newLessons.selectedNumber > 0) {
console.log($scope.globalTaskList);
vtmsLesson.getList({id: $routeParams.id}, function(list) {
var maxLesson = list.length;

for(var i = 0; i < $scope.newLessons.selectedNumber; i++) {

var lessonNumber = i + maxLesson + 1;
var newLesson = new vtmsLesson({fkLanguageSeries: $routeParams.id, number: lessonNumber, title: "Lesson " + lessonNumber});
newLesson.$save().then(function(lesson) {
var taskList = $scope.globalTaskList;
for (var j = 0; j < taskList.length; j++) {
var newTask = new vtmsTask({fkLesson: lesson.id, fkTaskGlobal: taskList[j].id, fkTeamMember: taskList[j].defaultTeamMember});
newTask.$save();
}

console.log("Lesson created!");
console.log(lesson);
});
}
vtmsNotifier.success("Create " + $scope.newLessons.selectedNumber + " lessons in this language series");
});
} else {
vtmsNotifier.error("Please select a number greater than 0 to create a language series.");
}
}

$scope.update = function(newData) {

angular.extend($scope.languageSeries, newData);
Expand All @@ -54,4 +94,4 @@ angular.module('vtms').controller('vtmsLanguageSeriesDetailController', function
});
};

});
});
7 changes: 4 additions & 3 deletions public/app/publishDates/publish-dates-list.jade
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
th(ng-show="config.columns.actions && identity.isLoggedIn()") Actions
th(ng-show="config.columns.series") Series
th(ng-show="config.columns.number") Number
th(ng-show="config.columns.title") Title
th(ng-show="config.columns.shortLesson") Lesson
th(ng-show="config.columns.title") Title
th(ng-show="config.columns.platform") Platform
th(ng-show="config.columns.date") Publish Date
th(ng-show="config.columns.date && identity.isAdmin()") Edit
Expand All @@ -47,10 +47,10 @@
a(href="#", ng-click="delete(publishDate)") Delete
td(ng-show="config.columns.series") {{publishDate.lesson.languageSery.title}}
td(ng-show="config.columns.number") {{publishDate.lesson.number}}
td(ng-show="config.columns.title")
a(ng-href="/lesson/{{publishDate.lesson.id}}") {{publishDate.lesson.title}}
td(ng-show="config.columns.shortLesson")
a(href="/lesson/{{publishDate.lesson.id}}") {{publishDate.lesson.languageSery.language.name}} {{publishDate.lesson.languageSery.series.title}} ({{publishDate.lesson.languageSery.level.code}}) {{"#" + publishDate.lesson.number}}
td(ng-show="config.columns.title")
a(ng-href="/lesson/{{publishDate.lesson.id}}") {{publishDate.lesson.title}}
td(ng-show="config.columns.platform") {{publishDate.platform.name }}
td(ng-show="config.columns.date") {{publishDate.date | date: 'EEE, MMM d, yyyy'}}
td(ng-show="config.columns.date && identity.isAdmin()")
Expand All @@ -74,6 +74,7 @@
select(ng-model="newDateValues.fkPlatform")
option(value="1") pod101
option(value="2") youtube
option(value="3") facebook
td(ng-show="config.columns.date")
td(ng-show="config.columns.date && identity.isAdmin()")
td(ng-show="config.columns.deliveredOn")
Expand Down
1 change: 1 addition & 0 deletions public/app/publishDates/vtmsPublishingReadyController.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ angular.module('vtms').controller('vtmsPublishingReadyController', function($sco
},
columns: {
actions: true,
title: true,
shortLesson: true,
platform: true,
date: true,
Expand Down
8 changes: 5 additions & 3 deletions server/config/express.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ var express = require('express'),
passport = require('passport'),
shortid = require('shortid');

var SequelizeStore = require('connect-session-sequelize')(session.Store);
var RedisStore = require('connect-redis')(session);

module.exports = function(app, config) {
app.set('view engine', 'jade');
Expand All @@ -25,8 +25,10 @@ module.exports = function(app, config) {
return shortid.generate();
},
cookie: {},
store: new SequelizeStore({
db: sequelize
store: new RedisStore({
//host: 'localhost',
//port: 9382
socket: '/opt/bitnami/redis/var/run/redis.sock'
})
}));
app.use(passport.initialize());
Expand Down
31 changes: 16 additions & 15 deletions server/controllers/lesson.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
var models = require('../models/models');
'use strict';
let models = require('../models/models');

var getList = function(req, res, query) {
let getList = function(req, res, query) {
models.Lesson.findAll(query).then(function(lessons) {
if(lessons) {
res.send(lessons);
Expand Down Expand Up @@ -29,7 +30,7 @@ exports.getLessons = function (req, res) {
if (lessons) {
res.send(lessons);
} else {
res.send(404).send({error: "No lessons found."});
res.send(404).send({error: 'No lessons found.'});
}
}).catch(function (err) {
res.status(500).send({error: err});
Expand All @@ -45,7 +46,7 @@ exports.getLessonById = function (req, res) {
if (lesson) {
res.send(lesson);
} else {
res.status(404).send({error: "There is no lesson with that ID."});
res.status(404).send({error: 'There is no lesson with that ID.'});
}
}).catch(function(err) {
res.status(500).send({error: err});
Expand All @@ -58,7 +59,7 @@ exports.createNewLesson = function (req, res) {
return res.send(lesson);
}).catch(function(err) {
res.status(400);
return res.send({reason: err.errors[0].message});
return res.send({reason: err});
});
};

Expand All @@ -81,7 +82,7 @@ exports.getLessonsWithUnassignedIssues = function (req, res) {
if (lessons) {
res.send(lessons);
} else {
res.status(404).send({error: "No pending unclassified issues."})
res.status(404).send({error: 'No pending unclassified issues.'});
}
}).catch(function(err) {
res.status(500).send({error: err});
Expand Down Expand Up @@ -120,7 +121,7 @@ exports.getUpcomingLessons = function (req, res) {
if (lessons) {
res.send(lessons);
} else {
res.send(404).send({error: "No lessons found."});
res.send(404).send({error: 'No lessons found.'});
}
}).catch(function (err) {
res.status(500).send({error: err});
Expand All @@ -145,7 +146,7 @@ exports.getQaLessons = function (req, res) {
if (lessons) {
res.send(lessons);
} else {
res.send(404).send({error: "No lessons found."});
res.send(404).send({error: 'No lessons found.'});
}
}).catch(function (err) {
res.status(500).send({error: err});
Expand Down Expand Up @@ -178,7 +179,7 @@ exports.getVideoCheckableLessons = function (req, res) {
}
res.send(checkableLessons);
} else {
res.status(404).send({error: "No lessons found."});
res.status(404).send({error: 'No lessons found.'});
}
}).catch(function (err) {
res.status(500).send(err);
Expand All @@ -203,7 +204,7 @@ exports.getArchiveableLessons = function (req, res) {
if (lessons) {
res.send(lessons);
} else {
res.send(404).send({error: "No lessons found."});
res.send(404).send({error: 'No lessons found.'});
}
}).catch(function (err) {
res.status(500).send({error: err});
Expand All @@ -224,7 +225,7 @@ exports.getQueuedLessons = function (req, res) {
if (lessons.length > 0) {
res.send(lessons);
} else {
res.status(404).send({error: "No lessons found."});
res.status(404).send({error: 'No lessons found.'});
}
}).catch(function (err) {
res.status(500).send({error: err});
Expand All @@ -238,7 +239,7 @@ exports.deleteLesson = function (req, res) {
res.status(200).end();
});
} else {
res.status(404).send({error: "No lesson was found with that ID."})
res.status(404).send({error: 'No lesson was found with that ID.'});
}
}).catch(function(err) {
res.status(500).send({error: err});
Expand All @@ -264,7 +265,7 @@ exports.getReadyToRenderLessons = function (req, res) {
var renderQueueLessons = [];
for(var i = 0; i < lessons.length; i++) {
// Cannot insert value as null, so this catches lessons that were unqueued
if(lessons[i].queuedTime === '0000-00-00 00:00:00') lessons[i].queuedTime = null;
if(lessons[i].queuedTime === '0000-00-00 00:00:00') { lessons[i].queuedTime = null; }
if(lessons[i].lastTaskTime > lessons[i].queuedTime || lessons[i].lastIssueTime > lessons[i].queuedTime || lessons[i].queuedTime === '0000-00-00 00:00:00') {
if(lessons[i].checkedLanguage) {
// if it's checked language, then we shouldn't export again until all tasks are completed
Expand All @@ -278,7 +279,7 @@ exports.getReadyToRenderLessons = function (req, res) {
}
res.send(renderQueueLessons);
} else {
res.status(404).send({error: "No lessons found."});
res.status(404).send({error: 'No lessons found.'});
}
}).catch(function (err) {
res.status(500).send(err);
Expand Down Expand Up @@ -335,4 +336,4 @@ exports.getLessonsForTeamMemberWithIssues = function(req, res) {
}
]
});
};
};
19 changes: 18 additions & 1 deletion server/controllers/publishDate.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,24 @@ exports.getReadyToDeliverPublishDates = function(req, res) {
})
.then(function(publishDates) {
if(publishDates) {
res.send(publishDates);
// for each youtube publish date
// check to see if there is a site publish date
// if so, hide the youtube publish date
var siteReadyToPublishLessons = [];
publishDates.forEach(function(publishDate) {
if (publishDate.platform.name === 'pod101') {
siteReadyToPublishLessons.push(publishDate.lesson.id);
}
});
publishDates.forEach(function(publishDate) {
for (var i = 0; i < siteReadyToPublishLessons.length; i++) {
if (publishDate.lesson.id === siteReadyToPublishLessons[i] && publishDate.platform.name == 'youtube') {
publishDate.lesson.title = "**Publish on Site First** " + publishDate.lesson.title;
console.log('Lesson with id ' + publishDate.lesson.id + ' has a YouTube publish date, removing site publish date...');
}
}
});
res.send(publishDates);
} else {
res.status(404).send({error: 'No publish dates were found.'});
}
Expand Down