Skip to content

Commit f3a4fae

Browse files
committed
fixes
1 parent 36a9b40 commit f3a4fae

File tree

3 files changed

+26
-8
lines changed

3 files changed

+26
-8
lines changed

services/app/apps/codebattle/assets/js/widgets/pages/stream/StreamEditorPanel.jsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ function StreamEditorPanel({
1717
testBarHeight,
1818
testBarWinGifTop,
1919
testBarProgressGifTop,
20+
progressGifSize,
21+
winGifSize,
2022
}) {
2123
const editorSelector = orientation === 'left' ? leftEditorSelector : rightEditorSelector;
2224

@@ -66,14 +68,18 @@ function StreamEditorPanel({
6668
style={{ fontSize: taskHeaderFontSize }}
6769
className="d-flex align-items-center cb-stream-widget-text italic mr-2"
6870
>
69-
{`${Math.round(output.successCount / output.assertsCount)}/100`}
71+
{`${Math.round(((output.successCount || 0) * 100) / (output.assertsCount || 1))}/100`}
7072
</div>
7173
</div>
7274
<img
7375
alt="И"
7476
src={isWinner ? '/assets/images/stream/win_bv.png' : '/assets/images/stream/progress.png'}
7577
className="position-absolute"
76-
style={{ top: (isWinner ? testBarWinGifTop : testBarProgressGifTop) }}
78+
style={{
79+
top: (isWinner ? testBarWinGifTop : testBarProgressGifTop),
80+
width: (isWinner ? winGifSize : progressGifSize),
81+
height: (isWinner ? winGifSize : progressGifSize),
82+
}}
7783
/>
7884
</div>
7985
</div>

services/app/apps/codebattle/assets/js/widgets/pages/stream/StreamFullPanel.jsx

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ function StreamFullPanel({
4040
testBarHeight,
4141
testBarWinGifTop,
4242
testBarProgressGifTop,
43+
progressGifSize,
44+
winGifSize,
4345
}) {
4446
const leftEditor = useSelector(leftEditorSelector(roomMachineState));
4547
const rightEditor = useSelector(rightEditorSelector(roomMachineState));
@@ -195,14 +197,19 @@ function StreamFullPanel({
195197
style={{ fontSize: testBarFontSize }}
196198
className="d-flex align-items-center cb-stream-widget-text italic mr-2 inverted-bar"
197199
>
198-
{`${Math.round((leftOutput.successCount || 0) / (leftOutput.assertsCount / 1))}/100`}
200+
{`${Math.round(((leftOutput.successCount || 0) * 100) / (leftOutput.assertsCount / 1))}/100`}
199201
</div>
200202
</div>
201203
<img
202204
alt="И"
203205
src={isWinnerLeft ? '/assets/images/stream/win_bv.png' : '/assets/images/stream/progress.png'}
204206
className="position-absolute"
205-
style={{ top: (isWinnerLeft ? testBarWinGifTop : testBarProgressGifTop), left: '-30px' }}
207+
style={{
208+
top: (isWinnerLeft ? testBarWinGifTop : testBarProgressGifTop),
209+
left: '-30px',
210+
width: (isWinnerLeft ? winGifSize : progressGifSize),
211+
height: (isWinnerLeft ? winGifSize : progressGifSize),
212+
}}
206213
/>
207214
</div>
208215
</div>
@@ -265,14 +272,19 @@ function StreamFullPanel({
265272
style={{ fontSize: testBarFontSize }}
266273
className="d-flex align-items-center cb-stream-widget-text italic inverted-bar mr-2"
267274
>
268-
{`${Math.round((rightOutput.successCount || 0) / (rightOutput.assertsCount || 1))}/100`}
275+
{`${Math.round(((rightOutput.successCount || 0) * 100) / (rightOutput.assertsCount || 1))}/100`}
269276
</div>
270277
</div>
271278
<img
272279
alt="И"
273280
src={isWinnerRight ? '/assets/images/stream/win_bv.png' : '/assets/images/stream/progress.png'}
274281
className="position-absolute"
275-
style={{ top: (isWinnerRight ? testBarWinGifTop : testBarProgressGifTop), left: '-30px' }}
282+
style={{
283+
top: (isWinnerRight ? testBarWinGifTop : testBarProgressGifTop),
284+
left: '-30px',
285+
width: (isWinnerRight ? winGifSize : progressGifSize),
286+
height: (isWinnerRight ? winGifSize : progressGifSize),
287+
}}
276288
/>
277289
</div>
278290
</div>

services/app/apps/codebattle/assets/js/widgets/slices/game.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ const game = createSlice({
2727
Object.assign(state.gameStatus, payload);
2828
},
2929
clearGamePlayers: state => {
30-
if (state.game?.players) {
31-
state.game.players = {};
30+
if (state.players) {
31+
state.players = {};
3232
}
3333
},
3434
updateGamePlayers: (state, { payload: { players: playersList } }) => {

0 commit comments

Comments
 (0)