Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

Commit c165b9a

Browse files
Merge pull request #1327 from appirio-tech/dev
Member Stats Changes
2 parents c7ea9b4 + ccb58f0 commit c165b9a

File tree

6 files changed

+97
-85
lines changed

6 files changed

+97
-85
lines changed

.circleci/config.yml

Lines changed: 82 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,103 +1,110 @@
11
version: 2
22

3-
# Python image to run aws utilities
4-
python_env: &python_env
3+
# node image to run aws utilities
4+
node_env: &node_env
55
docker:
6-
- image: circleci/python:2.7-stretch-browsers
6+
- image: circleci/node:8.16.0-jessie-browsers
77

8-
# Instructions of installing aws utilities
9-
install_awscli: &install_awscli
10-
name: "Install awscli"
8+
install_deploysuite: &install_deploysuite
9+
name: Installation of install_deploysuite.
1110
command: |
12-
sudo pip install awscli awsebcli --upgrade
13-
aws --version
14-
eb --version
11+
git clone --branch v1.4.2 https://github.com/topcoder-platform/tc-deploy-scripts ../buildscript
12+
cp ./../buildscript/master_deploy.sh .
13+
cp ./../buildscript/buildenv.sh .
14+
cp ./../buildscript/awsconfiguration.sh .
1515
16-
# Instructinos of deployment
17-
deploy_steps: &deploy_steps
18-
- attach_workspace:
19-
at: .
20-
- run: *install_awscli
16+
install_build_dependencies: &install_build_dependencies
17+
name: Install g++-4.8 and Install node-5.12.0
18+
command: |
19+
sudo apt-get update -y
20+
sudo apt-get install g++-4.8 -y
21+
sudo apt-get install python-pip -y
22+
sudo pip install awscli --upgrade
23+
sudo apt install jq -y
24+
sudo apt install phantomjs -y
25+
aws --version
26+
27+
build_npm_steps: &build_npm_steps
28+
name: "configuring environment building environment"
29+
command: |
30+
./awsconfiguration.sh $DEPLOY_ENV
31+
source awsenvconf
32+
./buildenv.sh -e $DEPLOY_ENV -b ${LOGICAL_ENV}-${APPNAME}-buildvar
33+
source buildenvvar
34+
npm rebuild node-sass
35+
npm run lint && npm run build
36+
#npm test
37+
38+
build_deploy_steps: &build_deploy_steps
39+
- run: *install_build_dependencies
40+
- checkout
41+
- run: *install_deploysuite
42+
- restore_cache:
43+
key: node-modules-{{ checksum "package-lock.json" }}
44+
- run: npm install
45+
- save_cache:
46+
key: node-modules-{{ checksum "package-lock.json" }}
47+
paths:
48+
- node_modules
49+
- run: *build_npm_steps
2150
- setup_remote_docker
22-
- run: ./deploy.sh $DEPLOY_ENV
23-
51+
- deploy:
52+
name: Running MasterScript.
53+
command: |
54+
# ./deploy.sh $DEPLOY_ENV
55+
# ./awsconfiguration.sh $DEPLOY_ENV
56+
source awsenvconf
57+
./buildenv.sh -e $DEPLOY_ENV -b ${LOGICAL_ENV}-${APPNAME}-deployvar
58+
source buildenvvar
59+
./master_deploy.sh -d CFRONT -e $DEPLOY_ENV -c true
2460
2561
jobs:
26-
build:
27-
machine: true
62+
63+
build_deploy_dev:
64+
<<: *node_env
2865
environment:
2966
CXX: g++-4.8
30-
steps:
31-
- run:
32-
name: Install g++-4.8
33-
command: |
34-
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
35-
sudo apt-get update -y
36-
sudo apt-get install g++-4.8 -y
37-
- run:
38-
name: Install node-5.12.0
39-
command: |
40-
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | sudo bash
41-
source ~/.bashrc
42-
nvm install 5.12.0
43-
node --version
44-
npm --version
45-
nvm --version
46-
47-
- checkout
48-
- restore_cache:
49-
key: node-modules-{{ checksum "package-lock.json" }}
50-
- run: npm install
51-
- save_cache:
52-
key: node-modules-{{ checksum "package-lock.json" }}
53-
paths:
54-
- node_modules
55-
- run: ls node_modules/*
56-
- run: npm run lint && npm run build
57-
- run: npm test
58-
- persist_to_workspace:
59-
root: .
60-
paths:
61-
- ./
67+
DEPLOY_ENV: "DEV"
68+
LOGICAL_ENV: "dev"
69+
APPNAME: "topcoder-app"
70+
steps: *build_deploy_steps
6271

63-
deploy_prod:
64-
<<: *python_env
72+
build_deploy_prod:
73+
<<: *node_env
6574
environment:
75+
CXX: g++-4.8
6676
DEPLOY_ENV: "PROD"
67-
steps: *deploy_steps
77+
LOGICAL_ENV: "prod"
78+
APPNAME: "topcoder-app"
79+
steps: *build_deploy_steps
6880

69-
deploy_dev:
70-
<<: *python_env
81+
build_deploy_qa:
82+
<<: *node_env
7183
environment:
72-
DEPLOY_ENV: "DEV"
73-
steps: *deploy_steps
74-
75-
deploy_qa:
76-
<<: *python_env
77-
environemtn:
84+
CXX: g++-4.8
7885
DEPLOY_ENV: "QA"
79-
steps: *deploy_steps
86+
LOGICAL_ENV: "qa"
87+
APPNAME: "topcoder-app"
88+
steps: *build_deploy_steps
89+
8090

8191
workflows:
8292
version: 2
8393
build-and-deploy:
8494
jobs:
85-
- build
86-
- deploy_dev:
95+
- build_deploy_dev:
96+
context : org-global
8797
filters:
8898
branches:
89-
only: [ dev, dev-circleci2 ]
90-
requires:
91-
- build
92-
- deploy_prod:
99+
only: [ dev ]
100+
- build_deploy_qa:
101+
context : org-global
93102
filters:
94103
branches:
95-
only: master
96-
requires:
97-
- build
98-
- deploy_qa:
104+
only: qa-integration
105+
- build_deploy_prod:
106+
context : org-global
99107
filters:
100108
branches:
101-
only: qa-integration
102-
requires:
103-
- build
109+
only: master
110+

app/profile/profile.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ describe('Profile Controller', function() {
1818

1919
var profileService = {
2020
getUserStats: function() {
21-
return $q.when({result: {content: mockStats}})
21+
return $q.when({result: {content: [mockStats]}})
2222
},
2323
getUserSkills: function() {
2424
return $q.when({result: {content: mockSkills}})

app/services/profile.service.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,15 @@ import _ from 'lodash'
8080
}
8181

8282
function getUserStats(username) {
83-
return restangular.one('members', username).one('stats').get().then(function(data) {
84-
if (data && !data.DEVELOP) data.DEVELOP = {challenges: 0, wins: 0, subTracks: []}
85-
if (data && !data.DESIGN) data.DESIGN = {challenges: 0, wins: 0, subTracks: []}
86-
if (data && !data.DATA_SCIENCE) data.DATA_SCIENCE = {challenges: 0, wins: 0, SRM: {}, MARATHON_MATCH: {}}
87-
return data
83+
return restangular.one('members', username).one('stats').get({ groupIds: CONSTANTS.DEFAULT_GROUP_ID }).then(function(data) {
84+
var stats = {}
85+
if (Array.isArray(data) && data.length) {
86+
stats = data[0]
87+
if (!stats.DEVELOP) stats.DEVELOP = {challenges: 0, wins: 0, subTracks: []}
88+
if (!stats.DESIGN) stats.DESIGN = {challenges: 0, wins: 0, subTracks: []}
89+
if (!stats.DATA_SCIENCE) stats.DATA_SCIENCE = {challenges: 0, wins: 0, SRM: {}, MARATHON_MATCH: {}}
90+
}
91+
return stats
8892
})
8993
}
9094

app/services/profile.service.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ describe('Profile Service', function() {
2020
.respond(200, {result: {content: mockProfile}})
2121
// mock stats
2222
$httpBackend
23-
.when('GET', apiUrl + '/members/rakesh/stats/')
24-
.respond(200, {result: {content: mockStats}})
23+
.when('GET', apiUrl + '/members/rakesh/stats/?groupIds=' + CONSTANTS.DEFAULT_GROUP_ID)
24+
.respond(200, {result: {content: [mockStats]}})
2525

2626
})
2727

app/topcoder.constants.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,6 @@ angular.module('CONSTANTS', []).constant('CONSTANTS', {
4747
'STATUS_COMPLETED_WITHOUT_WIN' : 'Completed Without Win',
4848
'CHALLENGES_LOADING_CHUNK' : 36,
4949
'INFINITE_SCROLL_OFFSET' : '400', // footer is 300px and challenge tile is 400px
50-
'VIDEO_DEFAULT_HEIGHT': 360
50+
'VIDEO_DEFAULT_HEIGHT': 360,
51+
'DEFAULT_GROUP_ID': 10
5152
})

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
"restangular": "1.6.1",
7474
"tc-accounts": "https://github.com/appirio-tech/accounts-app.git#0.0.7",
7575
"tc-angular-ellipsis": "0.1.6",
76-
"topcoder-app-r": "https://github.com/appirio-tech/topcoder-app-r.git#0.0.1",
76+
"topcoder-app-r": "https://github.com/appirio-tech/topcoder-app-r.git#0.0.2",
7777
"xml2js": "0.4.17",
7878
"zepto": "1.0.1",
7979
"estraverse": "4.1.0",

0 commit comments

Comments
 (0)