Skip to content

Commit 3a2f01d

Browse files
committed
Merge remote-tracking branch 'origin/master'
2 parents 34690f9 + 2a4a767 commit 3a2f01d

File tree

2 files changed

+7
-12
lines changed

2 files changed

+7
-12
lines changed

src/client/problems/components/NumberOfProblems.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,22 +38,22 @@ const NumberOfProblems = (props: NumberOfProblemsProps) => (
3838
<tr>
3939
<td>Easy</td>
4040
<td>{props.easy}</td>
41-
<td>{props.easy * 10 + props.easy}</td>
41+
<td>{props.easy * 10}</td>
4242
</tr>
4343
<tr>
4444
<td>Medium</td>
4545
<td>{props.medium}</td>
46-
<td>{props.medium * 30 + props.medium}</td>
46+
<td>{props.medium * 30}</td>
4747
</tr>
4848
<tr>
4949
<td>Hard</td>
5050
<td>{props.hard}</td>
51-
<td>{props.hard * 50 + props.hard}</td>
51+
<td>{props.hard * 50}</td>
5252
</tr>
5353
<tr>
5454
<td> </td>
5555
<td>{props.easy + props.medium + props.hard}</td>
56-
<td>{props.easy * 10 + props.easy + props.medium * 30 + props.medium + props.hard * 50 + props.hard}</td>
56+
<td>{props.easy * 10 + props.medium * 30 + props.hard * 50}</td>
5757
</tr>
5858
</tbody>
5959
</Table>

src/client/ranking/actions/index.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ function setRanking(ranking: RankingEntry[]): Action {
9595
};
9696
}
9797

98-
function fetchPreviousRanking(date: string) {
98+
function fetchPreviousRanking() {
9999
const options = {
100100
headers: {
101101
Accept: 'application/json',
@@ -104,13 +104,8 @@ function fetchPreviousRanking(date: string) {
104104
method: 'get',
105105
};
106106

107-
let daysFromStart = moment().dayOfYear() - moment(date).dayOfYear();
108-
109107
let previousRankingDate = moment().subtract(1, 'days');
110108

111-
if (daysFromStart > 7) {
112-
previousRankingDate = moment().subtract(7, 'days');
113-
}
114109
let dateToFetch = previousRankingDate.format('YYYY-MM-DD');
115110

116111
return (dispatch: Dispatch<Action>) => {
@@ -123,7 +118,7 @@ function fetchPreviousRanking(date: string) {
123118
dispatch(setPreviousRanking(json as RankingEntry[]));
124119
}
125120
})
126-
.catch((error) => console.log(`[err] GET /api/ranking/api/ranking/${date}:` + error));
121+
.catch((error) => console.log(`[err] GET /api/ranking/api/ranking/${dateToFetch}:` + error));
127122
};
128123
}
129124

@@ -149,7 +144,7 @@ export function fetchRankingStartDate() {
149144
.then((date) => {
150145
if (/\d\d\d\d-\d\d-\d\d/.test(date)) {
151146
dispatch(setRankingStartDate(date as string));
152-
dispatch<any>(fetchPreviousRanking(date));
147+
dispatch<any>(fetchPreviousRanking());
153148
} else {
154149
dispatch(setErrorMessage('Incorrect format of a date: ' + date));
155150
}

0 commit comments

Comments
 (0)