Merge branch 'master' into UI

Conflicts:
	templates/js/services/apiService.js
This commit is contained in:
Sagi Dayan 2015-06-29 14:45:37 +03:00
commit 2ce04b34d9
3 changed files with 34 additions and 19 deletions

View file

@ -1,21 +1,23 @@
__author__ = 'sagi' __author__ = 'sagi'
import requests import requests
from GithubAPI.GithubAPI import GitHubAPI_Keys
githubKeys = GitHubAPI_Keys()
def get_repo_general_info(repo_url): def get_repo_general_info(repo_url):
url = 'https://api.github.com/repos/' + repo_url url = 'https://api.github.com/repos/' + repo_url + '?client_id='+githubKeys.getId()+'&client_secret=' + githubKeys.getSecret()
req = requests.get(url) req = requests.get(url)
return req.json() return req.json()
def get_repo_stats(repo_url): def get_repo_stats(repo_url):
url = 'https://api.github.com/repos/' + repo_url + '/stats/contributors' url = 'https://api.github.com/repos/' + repo_url + '/stats/contributors' + '?client_id='+githubKeys.getId()+'&client_secret=' + githubKeys.getSecret()
req = requests.get(url) req = requests.get(url)
return req.json() return req.json()
def get_repo_issues(repo_url): def get_repo_issues(repo_url):
url = 'https://api.github.com/repos/' + repo_url + '/issues' url = 'https://api.github.com/repos/' + repo_url + '/issues' + '?client_id=' + githubKeys.getId() + '&client_secret=' + githubKeys.getSecret()
req = requests.get(url) req = requests.get(url)
return req.json() return req.json()

View file

@ -18,6 +18,11 @@ angular.module('SeHub')
apiService.getCampusesByUserId(token, id).success(function(data) { apiService.getCampusesByUserId(token, id).success(function(data) {
$scope.campuses = data; $scope.campuses = data;
console.log(data); console.log(data);
apiService.getCoursesByUserID(token, id).success(function(data){
$scope.courses = data;
}).error(function(err){
console.error('In apiService.getCoursesByUserID', err);
})
$scope.loadingData = false; $scope.loadingData = false;
}).error(function(err) { }).error(function(err) {
@ -53,22 +58,22 @@ angular.module('SeHub')
/** /**
* DEBUG DATA * DEBUG DATA
*/ */
$scope.courses = [{ // $scope.courses = [{
"courseName": "Advance Math", // "courseName": "Advance Math",
"campusName": "JCE", // "campusName": "JCE",
"startDate": { // "startDate": {
"year": 2015, // "year": 2015,
"month": 4, // "month": 4,
"day": 3 // "day": 3
}, // },
"endDate": { // "endDate": {
"year": 2016, // "year": 2016,
"month": 5, // "month": 5,
"day": 14 // "day": 14
}, // },
"taskFlag": false, // "taskFlag": false,
"campus_avatar": "https://yt3.ggpht.com/--ZkWxybWGOM/AAAAAAAAAAI/AAAAAAAAAAA/_nAICC_kzzI/s88-c-k-no/photo.jpg" // "campus_avatar": "https://yt3.ggpht.com/--ZkWxybWGOM/AAAAAAAAAAI/AAAAAAAAAAA/_nAICC_kzzI/s88-c-k-no/photo.jpg"
}]; // }];
// $scope.campuses = [{ // $scope.campuses = [{
// 'title': 'JCE', // 'title': 'JCE',

View file

@ -177,6 +177,14 @@ service.factory('apiService', ['$http', function($http) {
data: payLoad data: payLoad
}; };
return $http(req); return $http(req);
},
getCoursesByUserID: function(token, userId){
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/courses/getCoursesByUser/" + token + "/" + userId;
req = {
method : "GET",
url : url
};
return $http(req);
} }
}; };
}]); }]);