Skip to content

Commit

Permalink
Clean project for final release
Browse files Browse the repository at this point in the history
Delete unused frontend files and rename XXV2 into XX
  • Loading branch information
ttben committed Sep 9, 2015
1 parent a1d230a commit cde7316
Show file tree
Hide file tree
Showing 17 changed files with 37 additions and 521 deletions.
2 changes: 2 additions & 0 deletions backend/src/challenge/TeamChallengeFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ class TeamChallengeFactory {
for(var currentChildIDIndex in childrenIDs) {
var currentChildID = childrenIDs[currentChildIDIndex];
var currentChild = userChallengeRepository.getChallengeByID(currentChildID);
currentChild.setTakenBy(team.getName());

children.push(currentChild);
}

Expand Down
2 changes: 2 additions & 0 deletions backend/src/challenge/UserChallenge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,8 @@ class UserChallenge {
}


setTakenBy(teamName:string) {this.takenBy = teamName;}

getStatusAsString():string {
switch (this.status) {
case 0:
Expand Down
Binary file modified frontend/app/favicon.ico
Binary file not shown.
12 changes: 3 additions & 9 deletions frontend/app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
</ul>
<ul class="nav navbar-nav navbar-right">
<li><a ng-href="#/create-goal"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span> Créer objectif</a></li>
<li><a ng-href="#/create-badge-perso"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span> Créer badge</a></li>
<li><a ng-href="#/create-badge"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span> Créer badge</a></li>
</ul>
</div>
</div>
Expand All @@ -68,8 +68,8 @@
<p><span class="glyphicon glyphicon-education"></span> ecoknowledge - a SmartCampus project</p>
</div>
</footer>
-->
-->
<!-- Google Analytics: change UA-XXXXX-X to be your site's ID -->
<script>
!function (A, n, g, u, l, a, r) {
Expand Down Expand Up @@ -100,19 +100,13 @@
<!-- build:js({.tmp,app}) scripts/scripts.js -->
<script src="scripts/app.js"></script>
<script src="ui-bootstrap-tpls-0.9.0.min.js"></script>
<script src="scripts/controllers/main.js"></script>
<script src="scripts/controllers/about.js"></script>
<script src="scripts/controllers/goal.js"></script>
<script src="scripts/controllers/home.js"></script>
<script src="scripts/controllers/badge.js"></script>
<script src="scripts/controllers/dashboard.js"></script>
<script src="scripts/controllers/login.js"></script>
<script src="scripts/controllers/ServiceGoal.js"></script>
<script src="scripts/controllers/ServiceChallenge.js"></script>
<script src="scripts/controllers/viewGoal.js"></script>
<script src="scripts/controllers/ServiceSensor.js"></script>
<script src="scripts/controllers/badgeV2.js"></script>
<script src="scripts/controllers/ServiceBadgeV2.js"></script>
<script src="scripts/controllers/ServiceBadge.js"></script>
<script src="scripts/controllers/ServiceDashboard.js"></script>
<script src="scripts/controllers/ServiceLogin.js"></script>
<!-- endbuild -->
Expand Down
55 changes: 8 additions & 47 deletions frontend/app/scripts/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,76 +29,37 @@ var app = angular
.when('/dashboard/view/', {
templateUrl: '../views/dashboard.html',
controller: 'DashboardCtrl',
controllerAs:'dashboard'
controllerAs: 'dashboard'
})
.when('/dashboard/view/:id/', {
templateUrl: '../views/dashboard.html',
controller: 'DashboardCtrl',
controllerAs:'dashboard'
controllerAs: 'dashboard'
})
.when('/dashboard/view/:id/:dashboardType', {
templateUrl: '../views/dashboard.html',
controller: 'DashboardCtrl',
controllerAs:'dashboard'
controllerAs: 'dashboard'
})
.when('/create-goal', {
templateUrl: '../views/create-goal.html',
controller: 'GoalCtrl'
})
.otherwise({
redirectTo: '/lolerreurdansredirectionangulareuuuh/'
});

/*
$routeProvider
.when('/', {
templateUrl: '../views/homepage/homepage.html',
controller: 'HomeCtrl',
controllerAs: 'homeCtrl'
})
.when('/about', {
templateUrl: 'views/about.html',
controller: 'AboutCtrl'
})
.when('/create-goal', {
templateUrl: 'views/create-goal.html',
controller: 'GoalCtrl'
})
.when('/create-badge', {
templateUrl: 'views/create-badge.html',
templateUrl: '../views/create-badge.html',
controller: 'BadgeCtrl',
controllerAs: 'badgeCreateCtrl'
})
.when('/view-goal/:goalId', {
templateUrl: 'views/view-goal.html',
controller: 'ViewGoalCtrl',
controllerAs: 'viewGoalCtrl'
})
.when('/create-badge-perso', {
templateUrl: 'views/create-badge-perso.html',
controller: 'BadgeCtrlV2'
})
.when('/dashboard', {
templateUrl: '../views/dashboard.html',
controller: 'DashboardCtrl',
controllerAs:'dashboard'
})
.when('/login', {
templateUrl: '../views/login.html',
controller: 'LoginCtrl',
controllerAs:'loginCtrl'
controllerAs: 'badgeCtrl'
})
.otherwise({
redirectTo: '/'
});
*/
});


app.filter('range', function() {
return function(input, total) {
app.filter('range', function () {
return function (input, total) {
total = parseInt(total);
for (var i=0; i<total; i++) {
for (var i = 0; i < total; i++) {
input.push(i);
}
return input;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
var badgeBasePath = 'http://localhost:3000/badges/';

var app = angular.module('ecoknowledgeApp');
app.service('ServiceBadgeV2', ['$http', function ServiceBadgeV2($http) {
app.service('ServiceBadge', ['$http', function ServiceBadgeV2($http) {
this.post = function (badge, successFunc, failFunc) {
$http.post(badgeBasePath + 'new', badge)
.success(function (data) {
Expand All @@ -30,16 +30,4 @@ app.service('ServiceBadgeV2', ['$http', function ServiceBadgeV2($http) {
});
};

this.getTrophies = function (successFunc, failFunc) {
var pathToGet = badgeBasePath + 'trophyWall';
console.log('Service Badge : Get on ', pathToGet);
$http.get(pathToGet)
.success(function (data) {
successFunc(data);
})
.error(function (data) {
failFunc(data);
})
;
};
}]);
23 changes: 0 additions & 23 deletions frontend/app/scripts/controllers/ServiceSensor.js

This file was deleted.

17 changes: 0 additions & 17 deletions frontend/app/scripts/controllers/about.js

This file was deleted.

118 changes: 18 additions & 100 deletions frontend/app/scripts/controllers/badge.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,109 +2,27 @@

/**
* @ngdoc function
* @name ecoknowledgeApp.controller:BadgeCtrl
* @name ecoknowledgeApp.controller:BadgeCtrlV2
* @description
* # BadgeCtrl
* Controller of the ecoknowledgeApp for the creation of a badge
*/

angular.module('ecoknowledgeApp')
.controller('BadgeCtrl',['ServiceGoal','ServiceChallenge','ServiceSensor','Sign',
function (ServiceGoal, ServiceChallenge, ServiceSensor, Sign) {
var self = this;
self.badge = {};
self.goals = [];
self.badge.currentGoal = {};
self.sign = Sign;
self.addBadge = function () {
var badgeToSend = {};
badgeToSend.name = self.badge.name;
badgeToSend.description = self.badge.description;
badgeToSend.points = self.badge.points;
badgeToSend.goals = [];
badgeToSend.goals.push(self.badge.currentGoal);
var toSend = angular.toJson(badgeToSend);
console.log('badge to send : ',toSend);
ServiceChallenge.post(toSend, function(data) {
console.log('Achieve to send the badge', data);
},function(data) {
console.log('Fail to send the badge', data);
});
};

self.getGoals = function () {
self.goals = [];
ServiceGoal.get('', function(data){
console.log('achieve to get the goals', data);
self.goals = data;
},function(data){
console.log('fail when trying to get the goals', data);
});
};

self.getSensors = function(){
self.sensors = [];
ServiceSensor.get('',function(data){
console.log('achieve to get the sensors', data);
for(var sens in data){
self.sensors.push(data[sens].name);
}
},function(data){
console.log('fail when trying to get the sensors',data);
});
};

self.change = function(selectedGoal) {
console.log('select : ',selectedGoal);
ServiceGoal.getRequired(selectedGoal, function(data) {
// success
console.log('win to get required',data);
self.badge.currentGoal.id = selectedGoal;
self.badge.currentGoal.conditions = {};
for(var posCond in data.conditions){
var condition = data.conditions[posCond];
if(condition.leftValue.sensor) {
self.badge.currentGoal.conditions[condition.leftValue.name] = '';
}
if(condition.rightValue.sensor){
self.badge.currentGoal.conditions[condition.rightValue.name] = '';
}
}
self.currentGoal = {conditions: data.conditions};
}, function(data) {
//error
console.log('error when trying to get a goal : ',data);
});
};

self.changeSensor = function(sensor, nameSensor){
this.change = false;
for(var posCondition in self.badge.currentGoal.conditions){
var curCondition = self.badge.currentGoal.conditions[posCondition];
if(curCondition.name === nameSensor){
curCondition.sensor = sensor.name;
this.change = true;
break;
}
}
if(!this.change){
this.condition = {};
this.condition.name = nameSensor;
this.condition.sensor = sensor.name;
self.badge.currentGoal.conditions.push(this.condition);
}
};

self.getValue = function(nameSensor){
for(var posCondition in self.badge.currentGoal.conditions) {
var curCondition = self.badge.currentGoal.conditions[posCondition];
if(curCondition.name === nameSensor){
return curCondition.sensor;
}
}
return null;
};

self.getSensors();
self.getGoals();
}]);
.controller('BadgeCtrl', ['ServiceBadge', function(ServiceBadgeV2){
this.badge = {};
this.badge.name = '';
this.badge.points = 0;

var self = this;

this.addBadge = function(){
console.log('add badge V2');
ServiceBadgeV2.post(self.badge,function(data){
console.log('achieve to send a badge',data);
},function(data){
console.log('fail to send a badge',data);
});
};

}]);
28 changes: 0 additions & 28 deletions frontend/app/scripts/controllers/badgeV2.js

This file was deleted.

2 changes: 1 addition & 1 deletion frontend/app/scripts/controllers/goal.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

var app = angular.module('ecoknowledgeApp')
.controller('GoalCtrl', ['ServiceGoal','ServiceBadgeV2', function (ServiceGoal, ServiceBadgeV2) {
.controller('GoalCtrl', ['ServiceGoal','ServiceBadge', function (ServiceGoal, ServiceBadgeV2) {

var self = this;
self.goal = {};
Expand Down
Loading

0 comments on commit cde7316

Please sign in to comment.