1
1
"use strict" ;
2
2
var _types_1 = require ( './_types' ) ;
3
3
var alert_1 = require ( './alert' ) ;
4
+ var test_1 = require ( './test' ) ;
4
5
function progressPagePositionLoad ( ) {
5
6
return function ( dispatch , getState ) {
6
7
var progress = getState ( ) . progress ;
@@ -13,29 +14,37 @@ function progressLoad() {
13
14
var tutorial = getState ( ) . tutorial ;
14
15
dispatch ( { type : _types_1 . PROGRESS_LOAD , payload : { tutorial : tutorial } } ) ;
15
16
dispatch ( progressPagePositionLoad ( ) ) ;
17
+ dispatch ( test_1 . testRun ( ) ) ;
16
18
} ;
17
19
}
18
20
exports . progressLoad = progressLoad ;
19
- function completePage ( ) {
21
+ function completePage ( completed ) {
22
+ if ( completed === void 0 ) { completed = true ; }
20
23
return function ( dispatch , getState ) {
21
24
var _a = getState ( ) , pagePosition = _a . pagePosition , progress = _a . progress , tutorial = _a . tutorial ;
22
- dispatch ( { type : _types_1 . COMPLETE_PAGE , payload : { pagePosition : pagePosition , tutorial : tutorial } } ) ;
23
- if ( progress . pages . every ( function ( x ) { return x . completed ; } ) ) {
24
- dispatch ( completeTutorial ( ) ) ;
25
+ dispatch ( { type : _types_1 . COMPLETE_PAGE , payload : { pagePosition : pagePosition , tutorial : tutorial , completed : completed } } ) ;
26
+ if ( completed ) {
27
+ if ( progress . pages . every ( function ( x ) { return x . completed ; } ) ) {
28
+ dispatch ( completeTutorial ( ) ) ;
29
+ }
30
+ else {
31
+ dispatch ( alert_1 . alertToggle ( {
32
+ message : "Page " + ( pagePosition + 1 ) + " Complete" ,
33
+ action : 'pass' ,
34
+ } ) ) ;
35
+ }
25
36
}
26
- else {
27
- dispatch ( alert_1 . alertToggle ( {
28
- message : "Page " + ( pagePosition + 1 ) + " Complete" ,
29
- action : 'pass' ,
30
- } ) ) ;
37
+ else if ( progress . completed ) {
38
+ dispatch ( completeTutorial ( false ) ) ;
31
39
}
32
40
} ;
33
41
}
34
42
exports . completePage = completePage ;
35
- function completeTutorial ( ) {
43
+ function completeTutorial ( completed ) {
44
+ if ( completed === void 0 ) { completed = true ; }
36
45
return function ( dispatch , getState ) {
37
46
var tutorial = getState ( ) . tutorial ;
38
- dispatch ( { type : _types_1 . COMPLETE_TUTORIAL , payload : { tutorial : tutorial } } ) ;
47
+ dispatch ( { type : _types_1 . COMPLETE_TUTORIAL , payload : { tutorial : tutorial , completed : completed } } ) ;
39
48
dispatch ( alert_1 . alertToggle ( {
40
49
message : 'Tutorial Complete' ,
41
50
action : 'pass' ,
0 commit comments