Skip to content

Commit a9d56ea

Browse files
committed
Fixes critical before the merge with "develop" branch
1 parent 0f5fd83 commit a9d56ea

File tree

13 files changed

+111
-167
lines changed

13 files changed

+111
-167
lines changed

.exchange-rates.cache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"disclaimer":"Usage subject to terms: https://openexchangerates.org/terms","license":"https://openexchangerates.org/license","timestamp":1505930400,"base":"USD","rates":{"AED":3.673018,"AFN":68.656569,"ALL":111.44,"AMD":478.524504,"ANG":1.780058,"AOA":165.9215,"ARS":17.1918,"AUD":1.237099,"AWG":1.795494,"AZN":1.7,"BAM":1.6299,"BBD":2,"BDT":80.744036,"BGN":1.628849,"BHD":0.377242,"BIF":1745,"BMD":1,"BND":1.343932,"BOB":6.910011,"BRL":3.118843,"BSD":1,"BTC":0.000250862204,"BTN":64.297439,"BWP":10.168588,"BYN":1.936496,"BZD":2.01576,"CAD":1.224481,"CDF":1561,"CHF":0.960967,"CLF":0.02304,"CLP":620.7,"CNH":6.564588,"CNY":6.578274,"COP":2891.57,"CRC":576.185,"CUC":1,"CUP":25.5,"CVE":92.3,"CZK":21.729067,"DJF":178.57,"DKK":6.194406,"DOP":47.725,"DZD":111.27,"EGP":17.644487,"ERN":15.331258,"ETB":23.6,"EUR":0.832486,"FJD":2.005257,"FKP":0.735598,"GBP":0.735598,"GEL":2.47365,"GGP":0.735598,"GHS":4.416,"GIP":0.735598,"GMD":45.99,"GNF":9000,"GTQ":7.294791,"GYD":207.79088,"HKD":7.798183,"HNL":23.394859,"HRK":6.227232,"HTG":62.924,"HUF":257.1675,"IDR":13274.524737,"ILS":3.500145,"IMP":0.735598,"INR":64.35,"IQD":1183.5,"IRR":33345,"ISK":106.94,"JEP":0.735598,"JMD":130.733525,"JOD":0.708997,"JPY":111.36833333,"KES":103.395,"KGS":68.46186,"KHR":4058.6,"KMF":410.375,"KPW":900,"KRW":1127.58,"KWD":0.301307,"KYD":0.83331,"KZT":341,"LAK":8305.5,"LBP":1510.5,"LKR":152.844139,"LRD":117.2,"LSL":13.235,"LYD":1.355,"MAD":9.3273,"MDL":17.608826,"MGA":3015,"MKD":51.28,"MMK":1363.1,"MNT":2467.964653,"MOP":8.038032,"MRO":364,"MUR":33.411,"MVR":15.409873,"MWK":725.38,"MXN":17.651,"MYR":4.187519,"MZN":61.499992,"NAD":13.23625,"NGN":356,"NIO":30.34,"NOK":7.791998,"NPR":102.835,"NZD":1.35051,"OMR":0.385011,"PAB":1,"PEN":3.243489,"PGK":3.1975,"PHP":50.82,"PKR":105.385,"PLN":3.559467,"PYG":5665.2,"QAR":3.717528,"RON":3.826506,"RSD":99.183482,"RUB":57.8311,"RWF":835,"SAR":3.75015,"SBD":7.785588,"SCR":13.549114,"SDG":6.675,"SEK":7.938334,"SGD":1.342854,"SHP":0.735598,"SLL":7550.000256,"SOS":588,"SRD":7.438,"SSP":126.175,"STD":20456.065836,"SVC":8.749337,"SYP":514.98999,"SZL":13.235,"THB":33.07,"TJS":8.797608,"TMT":3.499986,"TND":2.424711,"TOP":2.208494,"TRY":3.476708,"TTD":6.754956,"TWD":30.13,"TZS":2241.65,"UAH":26.165,"UGX":3618.833069,"USD":1,"UYU":28.843697,"UZS":8090,"VEF":10.16465,"VND":22726.641005,"VUV":103.797249,"WST":2.495435,"XAF":546.07514,"XAG":0.05775363,"XAU":0.00076107,"XCD":2.70255,"XDR":0.701882,"XOF":546.07514,"XPD":0.0010959,"XPF":99.342027,"XPT":0.00105877,"YER":250.25,"ZAR":13.240692,"ZMW":9.525,"ZWL":322.355011}}
1+
{"disclaimer":"Usage subject to terms: https://openexchangerates.org/terms","license":"https://openexchangerates.org/license","timestamp":1506888001,"base":"USD","rates":{"AED":3.67304,"AFN":68.671,"ALL":113.870562,"AMD":481.658804,"ANG":1.790817,"AOA":165.9215,"ARS":17.556721,"AUD":1.275165,"AWG":1.792249,"AZN":1.68525,"BAM":1.665744,"BBD":2,"BDT":82.808961,"BGN":1.65936,"BHD":0.379507,"BIF":1759.35,"BMD":1,"BND":1.3655,"BOB":7.007198,"BRL":3.164872,"BSD":1,"BTC":0.000231700681,"BTN":65.367042,"BWP":10.361384,"BYN":1.97054,"BZD":2.027943,"CAD":1.248955,"CDF":1574.900794,"CHF":0.96829,"CLF":0.02376,"CLP":640.1,"CNH":6.647985,"CNY":6.6525,"COP":2936.91,"CRC":576.194261,"CUC":1,"CUP":25.5,"CVE":93.7,"CZK":22.033,"DJF":178.97,"DKK":6.309359,"DOP":48.055714,"DZD":113.760984,"EGP":17.675,"ERN":15.332621,"ETB":23.639913,"EUR":0.84796,"FJD":2.024752,"FKP":0.747231,"GBP":0.747231,"GEL":2.47065,"GGP":0.747231,"GHS":4.433011,"GIP":0.747231,"GMD":47.35,"GNF":9048.55,"GTQ":7.379029,"GYD":207.42747,"HKD":7.81132,"HNL":23.548227,"HRK":6.381207,"HTG":63.462522,"HUF":264.275,"IDR":13498.158815,"ILS":3.53425,"IMP":0.747231,"INR":65.3033,"IQD":1176.086141,"IRR":33482.5,"ISK":106.1,"JEP":0.747231,"JMD":130.991002,"JOD":0.7086,"JPY":112.649,"KES":103.866643,"KGS":68.645752,"KHR":4074.55,"KMF":417.125,"KPW":900,"KRW":1147.5,"KWD":0.303898,"KYD":0.838314,"KZT":342.53341,"LAK":8343.8,"LBP":1517.25,"LKR":154.010818,"LRD":117.662332,"LSL":13.586291,"LYD":1.379274,"MAD":9.479793,"MDL":17.574784,"MGA":3046.35,"MKD":52.11,"MMK":1372.75,"MNT":2459.308235,"MOP":8.094148,"MRO":367.14129,"MUR":33.98,"MVR":15.409873,"MWK":729.93295,"MXN":18.249844,"MYR":4.22244,"MZN":62.008262,"NAD":13.586291,"NGN":359.708899,"NIO":30.544456,"NOK":7.974222,"NPR":105.151062,"NZD":1.383952,"OMR":0.387495,"PAB":1,"PEN":3.286661,"PGK":3.213892,"PHP":50.981395,"PKR":106.010974,"PLN":3.6583,"PYG":5689.4,"QAR":3.66285,"RON":3.889289,"RSD":101.522947,"RUB":57.5892,"RWF":837.363477,"SAR":3.7502,"SBD":7.848531,"SCR":13.391885,"SDG":6.717258,"SEK":8.164529,"SGD":1.357997,"SHP":0.747231,"SLL":7603.75,"SOS":582.924833,"SRD":7.438,"SSP":126.8534,"STD":20820.5,"SVC":8.80296,"SYP":514.94999,"SZL":13.465,"THB":33.3855,"TJS":8.84842,"TMT":3.499986,"TND":2.477994,"TOP":2.22345,"TRY":3.562514,"TTD":6.793774,"TWD":30.33,"TZS":2266.250904,"UAH":26.751304,"UGX":3626.9,"USD":1,"UYU":29.321769,"UZS":8117.9,"VEF":10.15575,"VND":22770.766667,"VUV":104.889999,"WST":2.5127,"XAF":556.225298,"XAG":0.06004933,"XAU":0.00078121,"XCD":2.70255,"XDR":0.707566,"XOF":556.225298,"XPD":0.00106535,"XPF":101.188544,"XPT":0.00109532,"YER":250.3,"ZAR":13.503994,"ZMW":9.723815,"ZWL":322.355011}}

Dockerfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ WORKDIR /opt/app
99
COPY . .
1010

1111
RUN npm install
12-
# tests are failing so this is commented for now to be able to create the container
13-
#RUN npm test
12+
RUN npm test
1413
RUN npm run build
1514
ENV NODE_ENV=$NODE_ENV
1615

__tests__/shared/components/__snapshots__/Content.jsx.snap

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,36 @@ exports[`Matches shallow shapshot 1`] = `
236236
; the link here leads to a test challenge.
237237
</li>
238238
</ul>
239+
<h3>
240+
TCO Assets
241+
</h3>
242+
<ul>
243+
<li>
244+
TCO Scoreboard demo is mounted on
245+
<code>
246+
/scoreboard/:id
247+
</code>
248+
, where
249+
<code>
250+
:id
251+
</code>
252+
is the competition ID, not related to the regular challenge IDs. Here are two demo links for the scoreboards for the competitions created by the scoreboard init script: ‌
253+
<Link
254+
replace={false}
255+
to="/scoreboard/123"
256+
>
257+
ID = 123
258+
</Link>
259+
, ‌
260+
<Link
261+
replace={false}
262+
to="/scoreboard/1234"
263+
>
264+
ID = 1234
265+
</Link>
266+
.
267+
</li>
268+
</ul>
239269
<h3>
240270
Separate Topcoder Communities
241271
</h3>

bin/init-scoreboard-data

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env node
2+
3+
/* Script for intialization of test scoreboard data in DB. */
4+
5+
/* Enables Babel for the server-side code (with exception of this very file). */
6+
require('babel-register')({
7+
ignore: /node_modules\/(?!appirio-tech.*|topcoder|tc-)/,
8+
});
9+
10+
/* Runs the script itself. */
11+
require('../src/server/tco/scoreboard/init-data.js');

config/default.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@
101101
"SWIFT_PROGRAM_ID": 3445,
102102

103103
"SCOREBOARD":{
104-
"DB": "postgres://scoreboard:p@ssword123@localhost:5432/scoreboard",
104+
"DB": "postgres://postgres:postgres@localhost:5432/scoreboard",
105105
"ADMIN_ROLE": "administrator"
106106
}
107107
}

docker-compose.yml

Lines changed: 0 additions & 17 deletions
This file was deleted.

package-lock.json

Lines changed: 1 addition & 97 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"lint:scss": "stylelint **/*.scss --syntax scss",
1616
"start": "cross-env BABEL_ENV=production node ./bin/www",
1717
"test": "npm run lint && npm run jest",
18-
"init-scoreboard-data": "babel-node src/server/tco/scoreboard/init-data.js"
18+
"init-scoreboard-data": "node ./bin/init-scoreboard-data"
1919
},
2020
"repository": {
2121
"type": "git",
@@ -105,7 +105,6 @@
105105
"xml2json": "^0.11.0"
106106
},
107107
"devDependencies": {
108-
"babel-cli": "^6.26.0",
109108
"babel-eslint": "^7.2.3",
110109
"babel-loader": "^7.1.2",
111110
"babel-plugin-dynamic-import-node": "^1.0.2",

src/server/tco/scoreboard/init-data.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ async function init() {
4848
submissionCode: {
4949
codeField1: 'Best',
5050
codeField2: 'Done',
51-
codeField3: 40
52-
}
51+
codeField3: 40,
52+
},
5353
});
5454

5555
await SubmissionService.create({
@@ -58,8 +58,8 @@ async function init() {
5858
submissionCode: {
5959
codeField1: 'Good',
6060
codeField2: 'Final Submission',
61-
codeField3: 30
62-
}
61+
codeField3: 30,
62+
},
6363
});
6464

6565
// create submissions
@@ -69,8 +69,8 @@ async function init() {
6969
submissionDesign: {
7070
designField1: 'RUX',
7171
designField2: '48h',
72-
designField3: 40
73-
}
72+
designField3: 40,
73+
},
7474
});
7575

7676
// create submissions
@@ -80,8 +80,8 @@ async function init() {
8080
submissionDesign: {
8181
designField1: 'FAST',
8282
designField2: '24h',
83-
designField3: 30
84-
}
83+
designField3: 30,
84+
},
8585
});
8686

8787
// clear challenge competitors

src/server/tco/scoreboard/models/SubmissionDesign.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
* @author TCSCODER
88
* @version 1.0
99
*/
10-
import Sequelize from 'sequelize';
1110
import helper from '../common/helper';
1211
import designFields from '../config/submissionDesignFields.json';
1312

src/server/tco/scoreboard/services/ChallengeService.js

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,31 @@ const ChallengeSchema = Joi.object().keys({
3030
})),
3131
});
3232

33+
/**
34+
* creates the competitors for a challenge.
35+
* @param {Integer} challengeId the challenge id
36+
* @param {Array} competitors the list of competitors
37+
*/
38+
async function handleChallengeCompetitors(challengeId, competitors) {
39+
if (competitors) {
40+
// Remove any potential connection from the challenge to competitors
41+
// This is neeeded in case competitors are updated.
42+
await ChallengeCompetitor.destroy({ where: { challengeId } });
43+
44+
_.each(competitors, async (competitor) => {
45+
let existingCompetitor = await Competitor.findOne({ where: { handle: competitor.handle } });
46+
if (!existingCompetitor) {
47+
existingCompetitor = await Competitor.create(competitor);
48+
}
49+
50+
await ChallengeCompetitor.create({
51+
challengeId,
52+
handle: existingCompetitor.handle,
53+
});
54+
});
55+
}
56+
}
57+
3358
/**
3459
* Create a Challenge
3560
* @param {Object} challenge the challenge
@@ -57,7 +82,7 @@ create.schema = { challenge: ChallengeSchema };
5782
function get(id) {
5883
return helper.ensureExists(Challenge, {
5984
where: { id },
60-
include: [{ model: models.Submission, include : [{ all: true }] }, {
85+
include: [{ model: models.Submission, include: [{ all: true }] }, {
6186
model: Competitor, through: { attributes: [] },
6287
}],
6388
}, true);
@@ -97,31 +122,6 @@ update.schema = {
97122
challenge: ChallengeSchema,
98123
};
99124

100-
/**
101-
* creates the competitors for a challenge.
102-
* @param {Integer} challengeId the challenge id
103-
* @param {Array} competitors the list of competitors
104-
*/
105-
async function handleChallengeCompetitors(challengeId, competitors) {
106-
if (competitors) {
107-
// Remove any potential connection from the challenge to competitors
108-
// This is neeeded in case competitors are updated.
109-
await ChallengeCompetitor.destroy({ where: { challengeId: challengeId } });
110-
111-
_.each(competitors, async (competitor) => {
112-
let existingCompetitor = await Competitor.findOne({ where: { handle: competitor.handle } });
113-
if (!existingCompetitor) {
114-
existingCompetitor = await Competitor.create(competitor);
115-
}
116-
117-
await ChallengeCompetitor.create({
118-
challengeId: challengeId,
119-
handle: existingCompetitor.handle
120-
});
121-
});
122-
}
123-
}
124-
125125
module.exports = {
126126
create,
127127
get,

0 commit comments

Comments
 (0)