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

Member Stats Changes #1327

Merged
merged 17 commits into from
Mar 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
157 changes: 82 additions & 75 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,103 +1,110 @@
version: 2

# Python image to run aws utilities
python_env: &python_env
# node image to run aws utilities
node_env: &node_env
docker:
- image: circleci/python:2.7-stretch-browsers
- image: circleci/node:8.16.0-jessie-browsers

# Instructions of installing aws utilities
install_awscli: &install_awscli
name: "Install awscli"
install_deploysuite: &install_deploysuite
name: Installation of install_deploysuite.
command: |
sudo pip install awscli awsebcli --upgrade
aws --version
eb --version
git clone --branch v1.4.2 https://github.com/topcoder-platform/tc-deploy-scripts ../buildscript
cp ./../buildscript/master_deploy.sh .
cp ./../buildscript/buildenv.sh .
cp ./../buildscript/awsconfiguration.sh .

# Instructinos of deployment
deploy_steps: &deploy_steps
- attach_workspace:
at: .
- run: *install_awscli
install_build_dependencies: &install_build_dependencies
name: Install g++-4.8 and Install node-5.12.0
command: |
sudo apt-get update -y
sudo apt-get install g++-4.8 -y
sudo apt-get install python-pip -y
sudo pip install awscli --upgrade
sudo apt install jq -y
sudo apt install phantomjs -y
aws --version

build_npm_steps: &build_npm_steps
name: "configuring environment building environment"
command: |
./awsconfiguration.sh $DEPLOY_ENV
source awsenvconf
./buildenv.sh -e $DEPLOY_ENV -b ${LOGICAL_ENV}-${APPNAME}-buildvar
source buildenvvar
npm rebuild node-sass
npm run lint && npm run build
#npm test

build_deploy_steps: &build_deploy_steps
- run: *install_build_dependencies
- checkout
- run: *install_deploysuite
- restore_cache:
key: node-modules-{{ checksum "package-lock.json" }}
- run: npm install
- save_cache:
key: node-modules-{{ checksum "package-lock.json" }}
paths:
- node_modules
- run: *build_npm_steps
- setup_remote_docker
- run: ./deploy.sh $DEPLOY_ENV

- deploy:
name: Running MasterScript.
command: |
# ./deploy.sh $DEPLOY_ENV
# ./awsconfiguration.sh $DEPLOY_ENV
source awsenvconf
./buildenv.sh -e $DEPLOY_ENV -b ${LOGICAL_ENV}-${APPNAME}-deployvar
source buildenvvar
./master_deploy.sh -d CFRONT -e $DEPLOY_ENV -c true

jobs:
build:
machine: true

build_deploy_dev:
<<: *node_env
environment:
CXX: g++-4.8
steps:
- run:
name: Install g++-4.8
command: |
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
sudo apt-get update -y
sudo apt-get install g++-4.8 -y
- run:
name: Install node-5.12.0
command: |
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | sudo bash
source ~/.bashrc
nvm install 5.12.0
node --version
npm --version
nvm --version

- checkout
- restore_cache:
key: node-modules-{{ checksum "package-lock.json" }}
- run: npm install
- save_cache:
key: node-modules-{{ checksum "package-lock.json" }}
paths:
- node_modules
- run: ls node_modules/*
- run: npm run lint && npm run build
- run: npm test
- persist_to_workspace:
root: .
paths:
- ./
DEPLOY_ENV: "DEV"
LOGICAL_ENV: "dev"
APPNAME: "topcoder-app"
steps: *build_deploy_steps

deploy_prod:
<<: *python_env
build_deploy_prod:
<<: *node_env
environment:
CXX: g++-4.8
DEPLOY_ENV: "PROD"
steps: *deploy_steps
LOGICAL_ENV: "prod"
APPNAME: "topcoder-app"
steps: *build_deploy_steps

deploy_dev:
<<: *python_env
build_deploy_qa:
<<: *node_env
environment:
DEPLOY_ENV: "DEV"
steps: *deploy_steps

deploy_qa:
<<: *python_env
environemtn:
CXX: g++-4.8
DEPLOY_ENV: "QA"
steps: *deploy_steps
LOGICAL_ENV: "qa"
APPNAME: "topcoder-app"
steps: *build_deploy_steps


workflows:
version: 2
build-and-deploy:
jobs:
- build
- deploy_dev:
- build_deploy_dev:
context : org-global
filters:
branches:
only: [ dev, dev-circleci2 ]
requires:
- build
- deploy_prod:
only: [ dev ]
- build_deploy_qa:
context : org-global
filters:
branches:
only: master
requires:
- build
- deploy_qa:
only: qa-integration
- build_deploy_prod:
context : org-global
filters:
branches:
only: qa-integration
requires:
- build
only: master

2 changes: 1 addition & 1 deletion app/profile/profile.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('Profile Controller', function() {

var profileService = {
getUserStats: function() {
return $q.when({result: {content: mockStats}})
return $q.when({result: {content: [mockStats]}})
},
getUserSkills: function() {
return $q.when({result: {content: mockSkills}})
Expand Down
14 changes: 9 additions & 5 deletions app/services/profile.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,15 @@ import _ from 'lodash'
}

function getUserStats(username) {
return restangular.one('members', username).one('stats').get().then(function(data) {
if (data && !data.DEVELOP) data.DEVELOP = {challenges: 0, wins: 0, subTracks: []}
if (data && !data.DESIGN) data.DESIGN = {challenges: 0, wins: 0, subTracks: []}
if (data && !data.DATA_SCIENCE) data.DATA_SCIENCE = {challenges: 0, wins: 0, SRM: {}, MARATHON_MATCH: {}}
return data
return restangular.one('members', username).one('stats').get({ groupIds: CONSTANTS.DEFAULT_GROUP_ID }).then(function(data) {
var stats = {}
if (Array.isArray(data) && data.length) {
stats = data[0]
if (!stats.DEVELOP) stats.DEVELOP = {challenges: 0, wins: 0, subTracks: []}
if (!stats.DESIGN) stats.DESIGN = {challenges: 0, wins: 0, subTracks: []}
if (!stats.DATA_SCIENCE) stats.DATA_SCIENCE = {challenges: 0, wins: 0, SRM: {}, MARATHON_MATCH: {}}
}
return stats
})
}

Expand Down
4 changes: 2 additions & 2 deletions app/services/profile.service.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ describe('Profile Service', function() {
.respond(200, {result: {content: mockProfile}})
// mock stats
$httpBackend
.when('GET', apiUrl + '/members/rakesh/stats/')
.respond(200, {result: {content: mockStats}})
.when('GET', apiUrl + '/members/rakesh/stats/?groupIds=' + CONSTANTS.DEFAULT_GROUP_ID)
.respond(200, {result: {content: [mockStats]}})

})

Expand Down
3 changes: 2 additions & 1 deletion app/topcoder.constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,6 @@ angular.module('CONSTANTS', []).constant('CONSTANTS', {
'STATUS_COMPLETED_WITHOUT_WIN' : 'Completed Without Win',
'CHALLENGES_LOADING_CHUNK' : 36,
'INFINITE_SCROLL_OFFSET' : '400', // footer is 300px and challenge tile is 400px
'VIDEO_DEFAULT_HEIGHT': 360
'VIDEO_DEFAULT_HEIGHT': 360,
'DEFAULT_GROUP_ID': 10
})
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
"restangular": "1.6.1",
"tc-accounts": "https://github.com/appirio-tech/accounts-app.git#0.0.7",
"tc-angular-ellipsis": "0.1.6",
"topcoder-app-r": "https://github.com/appirio-tech/topcoder-app-r.git#0.0.1",
"topcoder-app-r": "https://github.com/appirio-tech/topcoder-app-r.git#0.0.2",
"xml2js": "0.4.17",
"zepto": "1.0.1",
"estraverse": "4.1.0",
Expand Down