Skip to content

Commit 2d09f8e

Browse files
committed
Merge pull request #45 from Precourse-Tracker/backend
Backend, added video, dashboard controllers,services
2 parents 4898a11 + aabd78b commit 2d09f8e

32 files changed

+584
-123
lines changed

gulpfile.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ var gulp = require('gulp'),
66
uglifycss = require('gulp-uglifycss'),
77
stripCode = require('gulp-strip-code'),
88
ngAnnotate = require('gulp-ng-annotate'),
9-
watcher = gulp.watch(['./main/**/*.js', './main/styles/*.scss', './main/**/*.html', './main/jquery.js', './main/ng-webworker.js', './main/worker_wrapper.js', './main/ui-ace.js'], ['default']);
9+
watcher = gulp.watch(['./main/**/*.js', './test/**/*.js', './main/styles/*.scss', './main/**/*.html', './main/jquery.js', './main/ng-webworker.js', './main/worker_wrapper.js', './main/ui-ace.js', './main/angular-youtube-embed.js'], ['default']);
1010

1111
gulp.watch(['./main/**/*.js', './main/styles/*.scss', './main/**/*.html', './main/jquery.js'], ['default']);
1212
watcher.on('change', function(event) {
@@ -24,7 +24,7 @@ gulp.task('styles', function() { // .scss is newer file version of .sass
2424
});
2525

2626
gulp.task('javascript', function() {
27-
gulp.src(['./main/**/*.js', '!./main/jquery.js', '!./main/ng-webworker.js', '!./main/worker_wrapper.js', '!./main/ui-ace.js'])
27+
gulp.src(['./main/**/*.js', './test/**/*.js', '!./main/jquery.js', '!./main/ng-webworker.js', '!./main/worker_wrapper.js', '!./main/ui-ace.js', '!./main/angular-youtube-embed.js'])
2828
.pipe(ngAnnotate())
2929
// .pipe(uglify())
3030
.pipe(concat('all.js'))

main/app.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
angular.module('myApp', ['ui.router', 'ui.ace', 'ngWebworker'])
1+
angular.module('myApp', ['ui.router', 'ui.ace', 'ngWebworker', 'youtube-embed'])
22

33
.config(["$stateProvider", "$urlRouterProvider", function($stateProvider, $urlRouterProvider) {
44

main/assessment/assessmentController.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ angular.module('myApp')
1515

1616
$scope.eval = function(q, userCode) {
1717

18-
1918
let qId = q._id;
2019
let answer = q.answer;
2120

main/assessment/assessmentService.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ angular.module('myApp')
3737
}
3838
}
3939
}).success(function(resp) {
40+
tick = 0;
4041
console.log(resp);
4142
})
4243
}

main/assessment/assessmentStyles.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
}
77
.ace_editor {
88
height : 200px;
9+
width: 600px;
910
}
1011
.assessment-eval {
1112
color: #fff;
@@ -48,4 +49,8 @@
4849
width: 100vw;
4950
height: 20vh;
5051
}
52+
.assessmentQ {
53+
display: flex;
54+
line-height: 40px;
55+
}
5156
}

main/assessment/assessmentTemplate.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<navigation-directive></navigation-directive>
22
<section ng-controller="assessmentController" id=assessment-view>
33
<div ng-repeat="q in questions" class="stuff">
4-
Q: {{q.question}}
4+
Instructions: <span class="assessmentQ">{{q.question}}</span>
55
<div ng-model="userCode" ui-ace="{
66
mode: 'javascript',
77
theme: 'crimson_editor'
88
}"></div>
9-
ANSWER: {{q.answer}}
9+
<!-- ANSWER: {{q.answer}} -->
1010
<button ng-click="eval(q, userCode); doSomeStuff(q);" ng-disabled="q.disabled" class="assessment-eval">eval</button>
1111
</div>
1212

main/assessment/workerService.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ angular.module('myApp').service('workerService', function(Webworker) {
33
this.worker = (qId, answer, userCode) => {
44

55
function isSame(userCode, answer) {
6-
if (userCode === answer) {
6+
var results = eval(userCode);
7+
if (results.toString() === answer) {
78
return true;
89
} else {
910
return false;
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
angular.module('myApp').controller('dashboardController', function($scope, dashboardService) {
2+
3+
getUserData = () => {
4+
dashboardService.getUserData().then(function(response) {
5+
console.log("controller", response.data.progress.lessons[0].score);
6+
var total = response.data.progress.lessons[0].score;
7+
$scope.radarChartData = total / 100;
8+
9+
})
10+
}
11+
getUserData();
12+
13+
})

main/dashboard/dashboardService.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
angular.module('myApp').service('dashboardService', function($q, $http) {
2+
3+
this.getUserData = () => {
4+
return $http({
5+
method: 'GET',
6+
url: '/api/users/progress'
7+
}).then(function(response) {
8+
// console.log("service", response);
9+
return response;
10+
})
11+
}
12+
13+
})

main/dashboard/dashboardTemplate.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<navigation-directive></navigation-directive>
22

33
<!-- <unit-test-menu-directive></unit-test-menu-directive> -->
4-
<section unit-test-menu-directive id="dashboard-wrapper">
4+
<section unit-test-menu-directive id="dashboard-wrapper" ng-controller="dashboardController">
55

66
<div id="dashboard">
77

@@ -21,7 +21,7 @@
2121

2222

2323
<div id="unit-subview">
24-
<div id="js-graph-div" ><bars class="radarChart"></bars></div>
24+
<div id="js-graph-div" ><bars class="radarChart" data="radarChartData"></bars></div>
2525
<div id="html-graph-div"><span>HTML</span></div>
2626
<div id="css-graph-div"><span>CSS</span></div>
2727
<div id="git-graph-div"><span>Git</span></div>

0 commit comments

Comments
 (0)