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

Revert "Member Stats for Private Crowd Members" #1324

Merged
merged 1 commit into from
Mar 5, 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
155 changes: 74 additions & 81 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,110 +1,103 @@
version: 2

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

install_deploysuite: &install_deploysuite
name: Installation of install_deploysuite.
# Instructions of installing aws utilities
install_awscli: &install_awscli
name: "Install awscli"
command: |
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 .
sudo pip install awscli awsebcli --upgrade
aws --version
eb --version

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
# Instructinos of deployment
deploy_steps: &deploy_steps
- attach_workspace:
at: .
- run: *install_awscli
- setup_remote_docker
- 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
- run: ./deploy.sh $DEPLOY_ENV


jobs:

build_deploy_dev:
<<: *node_env
build:
machine: true
environment:
CXX: g++-4.8
DEPLOY_ENV: "DEV"
LOGICAL_ENV: "dev"
APPNAME: "topcoder-app"
steps: *build_deploy_steps
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:
- ./

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

build_deploy_qa:
<<: *node_env
deploy_dev:
<<: *python_env
environment:
CXX: g++-4.8
DEPLOY_ENV: "QA"
LOGICAL_ENV: "qa"
APPNAME: "topcoder-app"
steps: *build_deploy_steps
DEPLOY_ENV: "DEV"
steps: *deploy_steps

deploy_qa:
<<: *python_env
environemtn:
DEPLOY_ENV: "QA"
steps: *deploy_steps

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

only: qa-integration
requires:
- build
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: 5 additions & 9 deletions app/services/profile.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,11 @@ import _ from 'lodash'
}

function getUserStats(username) {
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
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
})
}

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/?groupIds=' + CONSTANTS.DEFAULT_GROUP_ID)
.respond(200, {result: {content: [mockStats]}})
.when('GET', apiUrl + '/members/rakesh/stats/')
.respond(200, {result: {content: mockStats}})

})

Expand Down
3 changes: 1 addition & 2 deletions app/topcoder.constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,5 @@ 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,
'DEFAULT_GROUP_ID': 10
'VIDEO_DEFAULT_HEIGHT': 360
})
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.2",
"topcoder-app-r": "https://github.com/appirio-tech/topcoder-app-r.git#0.0.1",
"xml2js": "0.4.17",
"zepto": "1.0.1",
"estraverse": "4.1.0",
Expand Down