diff --git a/Testing/CoursesAPI_Test.py b/Testing/CoursesAPI_Test.py deleted file mode 100644 index f4c37d5..0000000 --- a/Testing/CoursesAPI_Test.py +++ /dev/null @@ -1,91 +0,0 @@ -__author__ = 'etye' -import unittest -import requests -import json -from Testing.config import __CONFIG__ -class CoursesTestPlan(unittest.TestCase): - @classmethod - def setUpClass(cls): - debug = __CONFIG__['DEBUG'] - if debug: - url = __CONFIG__['PATHS']['DEBUG'] - else: - url = __CONFIG__['PATHS']['PRODUCTION'] - cls.url_ = url - request = requests.get(url+'api/qa/init') - if 200 <= request.status_code <= 299: - print 'Initialized' - - def test_coursesCreate_Lecturer(self): - headers = {'content-type': 'application/json'} - url = 'http://se-hub.appspot.com/api/courses/create/_QA_TOKEN_TEST_LECTURER' - params = {'seToken': 'seToken' } - data = { - 'courseName': 'QA COURSE', - 'campusName': 'https://yt3.ggpht.com/--ZkWxybWGOM/AAAAAAAAAAI/AAAAAAAAAAA/_nAICC_kzzI/s88-c-k-no/photo.jpg', - 'projects': '@gay.lord.ultima.multi.omega', - 'startDate': {'year': 2015, 'month' : 4, 'day' : 3}, - 'endDate': {'year': 2016,'month' : 6,'day' : 6} - } - - #r = requests.post(self.__class__.url_+'api/courses/create/'+__CONFIG__['TOKENS']['STUDENT'],data=payload) - r = requests.post(url, params=params, data=json.dumps(data), headers=headers) - ''' - payload = { - 'courseName': 'QA COURSE', - 'campusName': 'https://yt3.ggpht.com/--ZkWxybWGOM/AAAAAAAAAAI/AAAAAAAAAAA/_nAICC_kzzI/s88-c-k-no/photo.jpg', - 'projects': '@gay.lord.ultima.multi.omega', - 'startDate': {'year': 2015, 'month' : 4, 'day' : 3}, - 'endDate': {'year': 2016,'month' : 6,'day' : 6} - } - ''' - # r = requests.post(self.__class__.url_+'api/courses/create/'+__CONFIG__['TOKENS']['LECTURER'],data=payload) - #r = requests.post('http://localhost:8080/api/courses/create/_QA_TOKEN_TEST_LECTURER',data=payload) - #self.assertEquals(r.status_code, 201) - - def test_coursesCreate_InvalidToken(self): - headers = {'content-type': 'application/json'} - url = self.__class__.url_+'api/courses/create/invalidToken' - data = { - 'courseName': 'QA COURSE', - 'campusName': 'https://yt3.ggpht.com/--ZkWxybWGOM/AAAAAAAAAAI/AAAAAAAAAAA/_nAICC_kzzI/s88-c-k-no/photo.jpg', - 'projects': '@gay.lord.ultima.multi.omega', - 'startDate': {'year': 2015, 'month' : 4, 'day' : 3}, - 'endDate': {'year': 2016,'month' : 6,'day' : 6} - } - params = {'seToken': 'seToken' } - r = requests.post(url, params=params, data=json.dumps(data), headers=headers) - self.assertEquals(r.status_code, 403) - ''' - payload = {'courseName': 'Advance Math', 'campusName': 'JCE', 'startDate':'2015-14-3','endDate': '2015-29-6','taskFlag': 'False'} - payload = { - 'courseName': 'QA COURSE', - 'campusName': 'https://yt3.ggpht.com/--ZkWxybWGOM/AAAAAAAAAAI/AAAAAAAAAAA/_nAICC_kzzI/s88-c-k-no/photo.jpg', - 'projects': '@gay.lord.ultima.multi.omega', - 'startDate': {'year': 2015, 'month' : 4, 'day' : 3}, - 'endDate': {'year': 2016,'month' : 6,'day' : 6} - } - r = requests.post(self.__class__.url_+'api/courses/create/invalidToken',data=payload) - ''' - def test_coursesCreate_Student(self): - headers = {'content-type': 'application/json'} - url = self.__class__.url_+'api/courses/create/_QA_TOKEN_TEST_STUDENT' - params = {'seToken': 'seToken' } - data = { - 'courseName': 'QA COURSE', - 'campusName': 'https://yt3.ggpht.com/--ZkWxybWGOM/AAAAAAAAAAI/AAAAAAAAAAA/_nAICC_kzzI/s88-c-k-no/photo.jpg', - 'projects': '@gay.lord.ultima.multi.omega', - 'startDate': {'year': 2015, 'month' : 4, 'day' : 3}, - 'endDate': {'year': 2016,'month' : 6,'day' : 6} - } - - #r = requests.post(self.__class__.url_+'api/courses/create/'+__CONFIG__['TOKENS']['STUDENT'],data=payload) - r = requests.post(url, params=params, data=json.dumps(data), headers=headers) - self.assertEquals(r.status_code, 403, 'message: ' + r.json()['message']) - - def test_getCourseByCampusName(self): - r = requests.get(self.__class__.url_+'api/courses/getCourseByCampusName/'+__CONFIG__['TOKENS']['CAMPUS_NAME']) - self.assertEquals(r.status_code, 200) - -if __name__ == '__main__': - unittest.main() \ No newline at end of file diff --git a/Testing/CoursesAPI_test.py b/Testing/CoursesAPI_test.py deleted file mode 100644 index dcc9a84..0000000 --- a/Testing/CoursesAPI_test.py +++ /dev/null @@ -1,97 +0,0 @@ -__author__ = 'etye' -import unittest -import requests -import json -from Testing.config import __CONFIG__ - -class UserTestPlan(unittest.TestCase): - @classmethod - def setUpClass(cls): - debug = __CONFIG__['DEBUG'] - if debug: - url = __CONFIG__['PATHS']['DEBUG'] - else: - url = __CONFIG__['PATHS']['PRODUCTION'] - cls.url_ = url - request = requests.get(url+'api/qa/init') - if 200 <= request.status_code <= 299: - print 'Initialized' - - def test_courseCreate_lecturer(self): - #url = "http://localhost:8080/api/courses/create/_QA_TOKEN_TEST_LECTURER" - url=self.__class__.url_+'api/courses/create/'+__CONFIG__['TOKENS']['LECTURER'] - data = { - 'courseName': 'matan', - 'campusName': 'https://yt3.ggpht.com/--ZkWxybWGOM/AAAAAAAAAAI/AAAAAAAAAAA/_nAICC_kzzI/s88-c-k-no/photo.jpg', - 'projects': '@gay.lord.ultima.multi.omega', - 'startDate': {'year': 2015, 'month' : 4, 'day' : 3}, - 'endDate': {'year': 2016,'month' : 6,'day' : 6} - } - headers = {'Content-type': 'application/json', 'Accept': 'text/plain'} - r = requests.post(url, data=json.dumps(data), headers=headers) - self.assertEquals(r.status_code, 201) - - def test_courseCreate_lecturerExsistingCourse(self): - #url = "http://localhost:8080/api/courses/create/_QA_TOKEN_TEST_LECTURER" - url=self.__class__.url_+'api/courses/create/'+__CONFIG__['TOKENS']['LECTURER'] - data = { - 'courseName': 'matan', - 'campusName': 'https://yt3.ggpht.com/--ZkWxybWGOM/AAAAAAAAAAI/AAAAAAAAAAA/_nAICC_kzzI/s88-c-k-no/photo.jpg', - 'projects': '@gay.lord.ultima.multi.omega', - 'startDate': {'year': 2015, 'month' : 4, 'day' : 3}, - 'endDate': {'year': 2016,'month' : 6,'day' : 6} - } - headers = {'Content-type': 'application/json', 'Accept': 'text/plain'} - r = requests.post(url, data=json.dumps(data), headers=headers) - self.assertEquals(r.status_code, 403) - - def test_courseCreate_student(self): - #url = "http://localhost:8080/api/courses/create/_QA_TOKEN_TEST_LECTURER" - url=self.__class__.url_+'api/courses/create/'+__CONFIG__['TOKENS']['STUDENT'] - data = { - 'courseName': 'matan', - 'campusName': 'https://yt3.ggpht.com/--ZkWxybWGOM/AAAAAAAAAAI/AAAAAAAAAAA/_nAICC_kzzI/s88-c-k-no/photo.jpg', - 'projects': '@gay.lord.ultima.multi.omega', - 'startDate': {'year': 2015, 'month' : 4, 'day' : 3}, - 'endDate': {'year': 2016,'month' : 6,'day' : 6} - } - headers = {'Content-type': 'application/json', 'Accept': 'text/plain'} - r = requests.post(url, data=json.dumps(data), headers=headers) - self.assertEquals(r.status_code, 403) - - def test_courseCreate_invalidToken(self): - #url = "http://localhost:8080/api/courses/create/_QA_TOKEN_TEST_LECTURER" - url=self.__class__.url_+'api/courses/create/invalidToken' - data = { - 'courseName': 'matan', - 'campusName': 'https://yt3.ggpht.com/--ZkWxybWGOM/AAAAAAAAAAI/AAAAAAAAAAA/_nAICC_kzzI/s88-c-k-no/photo.jpg', - 'projects': '@gay.lord.ultima.multi.omega', - 'startDate': {'year': 2015, 'month' : 4, 'day' : 3}, - 'endDate': {'year': 2016,'month' : 6,'day' : 6} - } - headers = {'Content-type': 'application/json', 'Accept': 'text/plain'} - r = requests.post(url, data=json.dumps(data), headers=headers) - self.assertEquals(r.status_code, 403) - - def test_courseCreate_hebrewToken(self): - #url = "http://localhost:8080/api/courses/create/_QA_TOKEN_TEST_LECTURER" - url=self.__class__.url_+'api/courses/create/????' - data = { - 'courseName': 'matan', - 'campusName': 'https://yt3.ggpht.com/--ZkWxybWGOM/AAAAAAAAAAI/AAAAAAAAAAA/_nAICC_kzzI/s88-c-k-no/photo.jpg', - 'projects': '@gay.lord.ultima.multi.omega', - 'startDate': {'year': 2015, 'month' : 4, 'day' : 3}, - 'endDate': {'year': 2016,'month' : 6,'day' : 6} - } - headers = {'Content-type': 'application/json', 'Accept': 'text/plain'} - r = requests.post(url, data=json.dumps(data), headers=headers) - self.assertEquals(r.status_code, 404) - - #/api/courses/getCourseByCampusName/ - def test_getCourseByCampusName_EXSISTING_CAMPUS(self): - url=self.__class__.url_+'api/courses/getCourseByCampusName/'+__CONFIG__['CAMPUS_NAME']['JCE'] - r = requests.get(url) - self.assertEquals(r.status_code, 200) - -if __name__ == '__main__': - unittest.main() \ No newline at end of file diff --git a/templates/js/controllers/campusesController.js b/templates/js/controllers/campusesController.js index 9c251a2..30f804b 100644 --- a/templates/js/controllers/campusesController.js +++ b/templates/js/controllers/campusesController.js @@ -1,10 +1,9 @@ angular.module('SeHub') .controller('campusesController', ['$scope', '$cookies', '$cookieStore', '$window', '$location', '$mdToast', '$mdDialog', 'apiService', '$rootScope', function($scope, $cookies, $cookieStore, $window, $location, $mdToast, $mdDialog, apiService, $rootScope) { - $scope.threeSizedArray =[]; $scope.campusesEmpty = false; var token = $cookies['com.sehub.www']; - + var init = function() { $scope.threeSizedArray = []; @@ -23,9 +22,7 @@ angular.module('SeHub') } } }; - $scope.threeSizedArray.push(tempArr); - console.log($scope.threeSizedArray); // TODO REMOVE } $scope.goToCampus = function(campusId) // Will pass you to courses by specific campus @@ -45,7 +42,9 @@ angular.module('SeHub') { // TODO }); - if($scope.campuses != null) + // console.log($scope.campuses.length.toString()); + + if(!$scope.campuses) // If campuses is empty { $scope.campusesEmpty = true; } diff --git a/templates/js/controllers/homeController.js b/templates/js/controllers/homeController.js index 5dc7f83..a1c153f 100644 --- a/templates/js/controllers/homeController.js +++ b/templates/js/controllers/homeController.js @@ -95,8 +95,6 @@ angular.module('SeHub') console.log("choose project Clicked!!"); } - - // animation $scope.isEnterd = top.setIsEnterd; }]); \ No newline at end of file diff --git a/templates/js/controllers/myClassesController.js b/templates/js/controllers/myClassesController.js index ccabe30..8ee23a8 100644 --- a/templates/js/controllers/myClassesController.js +++ b/templates/js/controllers/myClassesController.js @@ -14,23 +14,6 @@ angular.module('SeHub') $scope.coursesEmpty = false; var campusId = $routeParams.campusId; - var displayCourses = function() - { - apiService.getCoursesByUser(token, campusId).success(function(data) // Get all the courses for display - { - $scope.courses = data; - console.log("success " + $scope.courses); - init(); // Executing the function to initialize course display - }).error(function(err) - { - console.log("error: " + err); - }); - if($scope.courses = null) - { - $scope.coursesEmpty = true; - } - } - $scope.goToClass = function(classId) { console.log("Done! " + $scope.courses); @@ -102,37 +85,42 @@ angular.module('SeHub') var init = function() { - var i, j, counter = 0; - var newLength = 0; - - if(($scope.courses.length % 3) === 0) - { - newLength = ($scope.courses.length / 3); - } - else - { - newLength = (Math.ceil($scope.courses.length / 3)); // Rounds number up - } - - console.log("length: " + newLength); - $scope.holdArrays.length = newLength; - - for(j = 0; j < newLength; j++) - { - $scope.holdArrays[j] = [3]; // Creating array in size of 3 in each array cell - } - - for(i = 0; i < newLength; i++) - { - for(j = 0; j < newLength; j++) - { - if($scope.courses[(3*i) + j] != null) - { - $scope.holdArrays[i][j] = $scope.courses[(3*i) + j]; + $scope.holdArrays = []; + var tempArr = []; + var sizeOfSmallArrays = 3; + for (var i = 0 ; i < $scope.courses.length ; i++) { + if(i % sizeOfSmallArrays !== 0){ + tempArr.push($scope.courses[i]); + }else{ + if(i !== 0){ + $scope.holdArrays.push(tempArr); + tempArr = []; + tempArr.push($scope.courses[i]); + }else{ + tempArr.push($scope.courses[i]); } - } - } - console.log($scope.holdArrays); + } + }; + $scope.holdArrays.push(tempArr); + } + + //$scope.courses = ["lala", "aaa", "bbb", "ccc", "rrr"]; + + var displayCourses = function() + { + apiService.getCourseByCampusName(token).success(function(data) // Shows all classes from this campus + { + $scope.courses = data; + console.log("success " + $scope.courses); + init(); // Executing the function to initialize course display + if(!$scope.courses) + { + $scope.coursesEmpty = true; + } + }).error(function(err) + { + console.log("error: " + err); + }); } diff --git a/templates/js/controllers/projectsController.js b/templates/js/controllers/projectsController.js index 0bd6b99..5e43593 100644 --- a/templates/js/controllers/projectsController.js +++ b/templates/js/controllers/projectsController.js @@ -41,37 +41,23 @@ angular.module('SeHub') var init = function() { - var i, j, counter = 0; - var newLength = 0; - - if(($scope.projects.length % 3) === 0) - { - newLength = ($scope.projects.length / 3); - } - else - { - newLength = (Math.ceil($scope.projects.length / 3)); // Rounds number up - } - - console.log("length: " + newLength); - $scope.arrayHolder.length = newLength; - - for(j = 0; j < newLength; j++) - { - $scope.arrayHolder[j] = [3]; // Creating array in size of 3 in each array cell - } - - for(i = 0; i < newLength; i++) - { - for(j = 0; j < newLength; j++) - { - if($scope.projects[(3*i) + j] != null) - { - $scope.arrayHolder[i][j] = $scope.projects[(3*i) + j]; + $scope.arrayHolder = []; + var tempArr = []; + var sizeOfSmallArrays = 3; + for (var i = 0 ; i < $scope.courses.length ; i++) { + if(i % sizeOfSmallArrays !== 0){ + tempArr.push($scope.courses[i]); + }else{ + if(i !== 0){ + $scope.arrayHolder.push(tempArr); + tempArr = []; + tempArr.push($scope.courses[i]); + }else{ + tempArr.push($scope.courses[i]); } - } - } - console.log($scope.arrayHolder); + } + }; + $scope.arrayHolder.push(tempArr); } diff --git a/templates/views/campuses.html b/templates/views/campuses.html index edb7911..b04f311 100644 --- a/templates/views/campuses.html +++ b/templates/views/campuses.html @@ -4,28 +4,27 @@
-
+
- Washed Out - -

{{campus.title}}

-
+ Washed Out + +

{{campus.title}}

+
-
- Washed Out - -

{{campus.title}}

-
+ Washed Out + +

{{campus.title}}

+
@@ -33,9 +32,9 @@
-
> - - You Are Not Related To Any Course, You Can Join A Course By Press 'Join'. +
+ + You Are Not Related To Any Campus, You May Join A Campus.
diff --git a/templates/views/myClasses.html b/templates/views/myClasses.html index d316c25..c9d2fd1 100644 --- a/templates/views/myClasses.html +++ b/templates/views/myClasses.html @@ -2,10 +2,40 @@

My Classes

- -
+ + +
+
+
+
+ + + +

{{course.title}}

+
+ +
+
+
+ + + +

{{course.title}}

+
+
+
+
+
+
+
+ You Are Not Related To Any Course, You May Join Any Course You Wish. +
+
+
+ +
-