Moves to next challenges

This commit is contained in:
Berkeley Martinez
2016-06-01 15:52:08 -07:00
parent 515051d817
commit cc8b608cb9
16 changed files with 327 additions and 546 deletions

View File

@@ -1,31 +0,0 @@
import { Observable } from 'rx';
import types from '../../common/app/routes/challenges/redux/types';
import { makeToast } from '../../common/app/redux/actions';
import { randomCompliment } from '../../common/app/utils/get-words';
/*
import {
updateOutput,
checkChallenge,
updateTests
} from '../../common/app/routes/challenges/redux/actions';
*/
export default function completionSaga(actions$, getState) {
return actions$
.filter(({ type }) => (
type === types.checkChallenge
))
.flatMap(() => {
const { tests } = getState().challengesApp;
if (tests.length > 1 && tests.every(test => test.pass && !test.err)) {
return Observable.of(
makeToast({
type: 'success',
message: randomCompliment()
})
);
}
return Observable.just(null);
});
}

View File

@@ -5,7 +5,6 @@ import hardGoToSaga from './hard-go-to-saga';
import windowSaga from './window-saga';
import executeChallengeSaga from './execute-challenge-saga';
import frameSaga from './frame-saga';
import completionSaga from './completion-saga';
import codeStorageSaga from './code-storage-saga';
export default [
@@ -16,6 +15,5 @@ export default [
windowSaga,
executeChallengeSaga,
frameSaga,
completionSaga,
codeStorageSaga
];