Skip to content

Commit f3f09bd

Browse files
committed
F2F: Misc fixes
Submission #519850 by asmn to the challenge http://www.topcoder.com/challenge-details/30060416/?type=develop Fixes #552 Fixes #565
1 parent a9fb133 commit f3f09bd

File tree

7 files changed

+20
-22
lines changed

7 files changed

+20
-22
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":1510232400,"base":"USD","rates":{"AED":3.672973,"AFN":68.693,"ALL":114.67,"AMD":487.355,"ANG":1.786317,"AOA":165.9225,"ARS":17.5155,"AUD":1.301917,"AWG":1.786752,"AZN":1.6985,"BAM":1.68149,"BBD":2,"BDT":83.082859,"BGN":1.681948,"BHD":0.377928,"BIF":1757.9,"BMD":1,"BND":1.359101,"BOB":6.940316,"BRL":3.247701,"BSD":1,"BTC":0.000138976672,"BTN":65.009917,"BWP":10.556232,"BYN":1.989602,"BZD":2.017204,"CAD":1.269837,"CDF":1574.900794,"CHF":0.996758,"CLF":0.02344,"CLP":630.82,"CNH":6.647182,"CNY":6.6375,"COP":3033.86,"CRC":572.32,"CUC":1,"CUP":25.5,"CVE":95.4,"CZK":21.957065,"DJF":178.97,"DKK":6.398976,"DOP":48.062655,"DZD":115.204,"EGP":17.6707,"ERN":15.336062,"ETB":27.354259,"EUR":0.859734,"FJD":2.060195,"FKP":0.76219,"GBP":0.76219,"GEL":2.556754,"GGP":0.76219,"GHS":4.4309,"GIP":0.76219,"GMD":47.26,"GNF":9050.65,"GTQ":7.338877,"GYD":207.715,"HKD":7.79945,"HNL":23.573158,"HRK":6.4818,"HTG":63.244399,"HUF":268.323,"IDR":13509.080047,"ILS":3.513474,"IMP":0.76219,"INR":65.0006,"IQD":1167.9,"IRR":34668.946723,"ISK":103.3,"JEP":0.76219,"JMD":126.547743,"JOD":0.709001,"JPY":113.32666667,"KES":103.6,"KGS":69.056478,"KHR":4041.95,"KMF":424.740182,"KPW":900,"KRW":1118.0225,"KWD":0.302872,"KYD":0.833938,"KZT":333.34,"LAK":8333.15,"LBP":1506.787443,"LKR":153.6,"LRD":121.8,"LSL":14.130775,"LYD":1.370307,"MAD":9.506186,"MDL":17.548,"MGA":3162.3,"MKD":52.943563,"MMK":1356.5,"MNT":2451.859147,"MOP":8.038161,"MRO":355.26,"MUR":34.447,"MVR":15.359567,"MWK":725.565,"MXN":19.106134,"MYR":4.193137,"MZN":60.875,"NAD":14.131049,"NGN":360.26,"NIO":30.771513,"NOK":8.128678,"NPR":104.03,"NZD":1.436307,"OMR":0.384943,"PAB":1,"PEN":3.270568,"PGK":3.207158,"PHP":51.24,"PKR":105.1875,"PLN":3.639715,"PYG":5657.35,"QAR":3.82285,"RON":3.988823,"RSD":102.005,"RUB":59.3633,"RWF":836.833477,"SAR":3.749848,"SBD":7.792911,"SCR":14.042,"SDG":6.68162,"SEK":8.37219,"SGD":1.360174,"SHP":0.76219,"SLL":7643.328121,"SOS":578.95,"SRD":7.448,"SSP":130.2634,"STD":20931.500286,"SVC":8.756454,"SYP":514.98999,"SZL":14.130185,"THB":33.102,"TJS":8.81315,"TMT":3.50998,"TND":2.51405,"TOP":2.254482,"TRY":3.8658,"TTD":6.7562,"TWD":30.196535,"TZS":2253.6,"UAH":26.559197,"UGX":3632.6,"USD":1,"UYU":29.192808,"UZS":8073.6,"VEF":10.785743,"VND":22718.953308,"VUV":105.843332,"WST":2.54744,"XAF":563.948828,"XAG":0.05845568,"XAU":0.00077699,"XCD":2.70255,"XDR":0.713343,"XOF":563.948828,"XPD":0.00097728,"XPF":102.593609,"XPT":0.00106953,"YER":250.25,"ZAR":14.216327,"ZMW":9.973,"ZWL":322.355011}}
1+
{"disclaimer":"Usage subject to terms: https://openexchangerates.org/terms","license":"https://openexchangerates.org/license","timestamp":1510660800,"base":"USD","rates":{"AED":3.673035,"AFN":68.597,"ALL":113.85,"AMD":486.63,"ANG":1.781857,"AOA":165.9225,"ARS":17.4983,"AUD":1.310161,"AWG":1.786752,"AZN":1.6985,"BAM":1.675741,"BBD":2,"BDT":83.182854,"BGN":1.668204,"BHD":0.3771,"BIF":1749.6,"BMD":1,"BND":1.361332,"BOB":6.897686,"BRL":3.275566,"BSD":1,"BTC":0.000153485025,"BTN":65.285278,"BWP":10.652864,"BYN":1.991423,"BZD":2.00644,"CAD":1.272935,"CDF":1562.881563,"CHF":0.994715,"CLF":0.02337,"CLP":628.8,"CNH":6.642966,"CNY":6.6377,"COP":3016.02,"CRC":568.605,"CUC":1,"CUP":25.5,"CVE":94.875,"CZK":21.80415,"DJF":178.935,"DKK":6.34693,"DOP":47.937867,"DZD":114.839,"EGP":17.6438,"ERN":15.191062,"ETB":27.169609,"EUR":0.852965,"FJD":2.074747,"FKP":0.762659,"GBP":0.762659,"GEL":2.537872,"GGP":0.762659,"GHS":4.4458,"GIP":0.762659,"GMD":47.29,"GNF":9013.95,"GTQ":7.326984,"GYD":207.46247,"HKD":7.80295,"HNL":23.606507,"HRK":6.441595,"HTG":63.603697,"HUF":265.94,"IDR":13534.080047,"ILS":3.547927,"IMP":0.762659,"INR":65.505,"IQD":1164.9,"IRR":34716.946723,"ISK":103.37,"JEP":0.762659,"JMD":126.505,"JOD":0.709001,"JPY":113.65166667,"KES":103.575,"KGS":69.131479,"KHR":4032.45,"KMF":422,"KPW":900,"KRW":1114.6325,"KWD":0.302158,"KYD":0.831775,"KZT":332.5,"LAK":8311.2,"LBP":1513.25,"LKR":153.61,"LRD":123.1,"LSL":14.476277,"LYD":1.365546,"MAD":9.458954,"MDL":17.649228,"MGA":3154.35,"MKD":52.554726,"MMK":1352.75,"MNT":2450.285781,"MOP":8.018738,"MRO":354.53,"MUR":34.22,"MVR":15.390384,"MWK":725.575,"MXN":19.07835,"MYR":4.189799,"MZN":60.664443,"NAD":14.3872,"NGN":359.36,"NIO":30.693726,"NOK":8.183736,"NPR":104.452204,"NZD":1.455646,"OMR":0.384948,"PAB":1,"PEN":3.24124,"PGK":3.199082,"PHP":51.1545,"PKR":105.22,"PLN":3.612257,"PYG":5645.8,"QAR":3.641458,"RON":3.962907,"RSD":101.01,"RUB":59.7679,"RWF":853.025,"SAR":3.750377,"SBD":7.792911,"SCR":13.404244,"SDG":6.664846,"SEK":8.428474,"SGD":1.360954,"SHP":0.762659,"SLL":7643.328121,"SOS":577.475,"SRD":7.448,"SSP":130.2634,"STD":20847.000286,"SVC":8.734183,"SYP":514.98999,"SZL":14.483364,"THB":33.075,"TJS":8.794373,"TMT":3.499972,"TND":2.503786,"TOP":2.268632,"TRY":3.86834,"TTD":6.750494,"TWD":30.173,"TZS":2247.4,"UAH":26.453,"UGX":3631.5,"USD":1,"UYU":29.244046,"UZS":8053.2,"VEF":10.069908,"VND":22717.219974,"VUV":106.743333,"WST":2.54764,"XAF":559.508266,"XAG":0.05904939,"XAU":0.00078548,"XCD":2.70255,"XDR":0.712471,"XOF":559.508266,"XPD":0.00100912,"XPF":101.785782,"XPT":0.00107586,"YER":250.294142,"ZAR":14.377882,"ZMW":9.907,"ZWL":322.355011}}

src/shared/components/Terms/index.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ export default class Terms extends React.Component {
148148
};
149149

150150
return (
151-
<div styleName="container">
151+
<div styleName="container" key={(selectedTerm || {}).termsOfUseId}>
152152
<Modal
153153
onCancel={onCancel}
154154
theme={{ container: style['modal-container'] }}

src/shared/components/challenge-detail/Winners/index.jsx

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,28 +13,19 @@ import Lock from '../icons/lock.svg';
1313
import './style.scss';
1414

1515
function getId(submissions, winner) {
16-
const found = _.find(submissions, s => ((s.submitter || s.handle) === winner.handle &&
17-
(s.submissionTime || s.submissionDate) === winner.submissionDate)) || {};
16+
const found = _.find(submissions, s => (s.placement === winner.placement)) || {};
1817
return found.submissionId;
1918
}
2019

2120
export default function Winners(props) {
2221
const {
23-
results,
22+
winners,
2423
prizes,
2524
submissions,
2625
viewable,
2726
isDesign,
2827
} = props;
2928

30-
const maxPlace = Number.MAX_SAFE_INTEGER;
31-
if (results) {
32-
results.sort((a, b) => (_.isNumber(a.placement) ? a.placement : maxPlace) -
33-
(_.isNumber(b.placement) ? b.placement : maxPlace));
34-
}
35-
36-
const winners = results && results.slice(0, prizes.length);
37-
3829
return (
3930
<div styleName="container">
4031
{
@@ -99,15 +90,15 @@ export default function Winners(props) {
9990
}
10091

10192
Winners.defaultProps = {
102-
results: [],
93+
winners: [],
10394
prizes: [],
10495
submissions: [],
10596
viewable: false,
10697
isDesign: false,
10798
};
10899

109100
Winners.propTypes = {
110-
results: PT.arrayOf(PT.shape()),
101+
winners: PT.arrayOf(PT.shape()),
111102
prizes: PT.arrayOf(PT.number),
112103
submissions: PT.arrayOf(PT.shape()),
113104
viewable: PT.bool,

src/shared/containers/challenge-detail/index.jsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,7 @@ class ChallengeDetailPageContainer extends React.Component {
146146
if (this.props.isLoadingChallenge || this.props.isLoadingTerms) {
147147
return <LoadingPagePlaceholder />;
148148
}
149-
150-
const numWinners = (challenge.winners && challenge.winners.filter(winner =>
151-
winner.type === 'final').length) || 0;
149+
const winners = challenge.winners || [];
152150

153151
return (
154152
<div styleName="outer-container">
@@ -175,7 +173,7 @@ class ChallengeDetailPageContainer extends React.Component {
175173
challenge={challenge}
176174
challengeId={this.props.challengeId}
177175
challengesUrl={challengesUrl}
178-
numWinners={numWinners}
176+
numWinners={winners.length}
179177
showDeadlineDetail={this.state.showDeadlineDetail}
180178
onToggleDeadlines={this.onToggleDeadlines}
181179
onSelectorClicked={this.props.onSelectorClicked}
@@ -235,7 +233,7 @@ class ChallengeDetailPageContainer extends React.Component {
235233
{
236234
!isEmpty && this.props.selectedTab === DETAIL_TABS.WINNERS &&
237235
<Winners
238-
results={results}
236+
winners={winners}
239237
prizes={this.props.challenge.prizes}
240238
submissions={this.props.challenge.submissions}
241239
viewable={this.props.challenge.submissionsViewable === 'true'}

src/shared/containers/tc-communities/Loader.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ class Loader extends React.Component {
7474

7575
const visitorGroupIds = visitorGroups ? visitorGroups.map(g => g.id) : [];
7676

77-
const member = visitorGroups && meta.groupIds
78-
&& Boolean(_.intersection(meta.groupIds, visitorGroupIds.length));
77+
const member = Boolean(visitorGroups && meta.groupIds
78+
&& _.intersection(meta.groupIds, visitorGroupIds).length);
7979

8080
/* Community does not require authorization. */
8181
if (!meta.authorizedGroupIds) return Community({ member, meta });

src/shared/reducers/auth.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
*/
44

55
import actions from 'actions/auth';
6+
import communityActions from 'actions/tc-communities';
67
import { handleActions } from 'redux-actions';
78
import { decodeToken } from 'tc-accounts';
89
import { toFSA } from 'utils/redux';
@@ -38,6 +39,13 @@ function create(initialState) {
3839
tokenV3: payload,
3940
user: payload ? decodeToken(payload) : null,
4041
}),
42+
[communityActions.tcCommunity.joinDone]: (state, { payload }) => ({
43+
...state,
44+
profile: {
45+
...state.profile,
46+
groups: state.profile.groups.concat({ id: payload.groupId.toString() }),
47+
},
48+
}),
4149
}, initialState || {
4250
authenticating: true,
4351
});

src/shared/routes/Communities/index.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { requireWeak, resolveWeak, SplitRoute } from 'utils/router';
1212
export default function ChunkLoader({ base, communityId, member, meta }) {
1313
return (
1414
<SplitRoute
15+
key={member}
1516
chunkName="communities/chunk"
1617
renderClientAsync={() =>
1718
import(

0 commit comments

Comments
 (0)