@@ -64,34 +64,34 @@ export class CourseActions extends Actions<CourseState> {
64
64
this . export = bind_methods ( new ExportActions ( this ) ) ;
65
65
}
66
66
67
- public get_store ( ) : CourseStore {
67
+ get_store = ( ) : CourseStore => {
68
68
const store = this . redux . getStore < CourseState , CourseStore > ( this . name ) ;
69
69
if ( store == null ) throw Error ( "store is null" ) ;
70
70
if ( ! this . store_is_initialized ( ) )
71
71
throw Error ( "course store must be initialized" ) ;
72
72
this . state = "ready" ; // this is pretty dumb for now.
73
73
return store ;
74
- }
74
+ } ;
75
75
76
- public is_closed ( ) : boolean {
76
+ is_closed = ( ) : boolean => {
77
77
if ( this . state == "closed" ) return true ;
78
78
const store = this . redux . getStore < CourseState , CourseStore > ( this . name ) ;
79
79
if ( store == null ) {
80
80
this . state = "closed" ;
81
81
return true ;
82
82
}
83
83
return false ;
84
- }
84
+ } ;
85
85
86
- private is_loaded ( ) : boolean {
86
+ private is_loaded = ( ) : boolean => {
87
87
if ( this . syncdb == null ) {
88
88
this . set_error ( "attempt to set syncdb before loading" ) ;
89
89
return false ;
90
90
}
91
91
return true ;
92
- }
92
+ } ;
93
93
94
- private store_is_initialized ( ) : boolean {
94
+ private store_is_initialized = ( ) : boolean => {
95
95
const store = this . redux . getStore < CourseState , CourseStore > ( this . name ) ;
96
96
if ( store == null ) {
97
97
return false ;
@@ -107,7 +107,7 @@ export class CourseActions extends Actions<CourseState> {
107
107
return false ;
108
108
}
109
109
return true ;
110
- }
110
+ } ;
111
111
112
112
// Set one object in the syncdb
113
113
set = ( obj : SyncDBRecord , commit : boolean = true ) : void => {
@@ -145,7 +145,7 @@ export class CourseActions extends Actions<CourseState> {
145
145
} ;
146
146
147
147
// Get one object from this.syncdb as a Javascript object (or undefined)
148
- public get_one ( obj : SyncDBRecord ) : SyncDBRecord | undefined {
148
+ get_one = ( obj : SyncDBRecord ) : SyncDBRecord | undefined => {
149
149
if (
150
150
this . syncdb != null ? this . syncdb . get_state ( ) === "closed" : undefined
151
151
) {
@@ -154,9 +154,9 @@ export class CourseActions extends Actions<CourseState> {
154
154
const x : any = this . syncdb . get_one ( obj ) ;
155
155
if ( x == null ) return ;
156
156
return x . toJS ( ) ;
157
- }
157
+ } ;
158
158
159
- public async save ( ) : Promise < void > {
159
+ save = async ( ) : Promise < void > = > {
160
160
const store = this . get_store ( ) ;
161
161
if ( store == null ) {
162
162
return ;
@@ -179,9 +179,9 @@ export class CourseActions extends Actions<CourseState> {
179
179
this . update_unsaved_changes ( ) ;
180
180
setTimeout ( this . update_unsaved_changes . bind ( this ) , 1000 ) ;
181
181
}
182
- }
182
+ } ;
183
183
184
- public syncdb_change ( changes : TypedMap < SyncDBRecord > [ ] ) : void {
184
+ syncdb_change = ( changes : TypedMap < SyncDBRecord > [ ] ) : void => {
185
185
let t ;
186
186
const store = this . get_store ( ) ;
187
187
if ( store == null ) {
@@ -219,18 +219,18 @@ export class CourseActions extends Actions<CourseState> {
219
219
this . setState ( t ) ;
220
220
}
221
221
this . update_unsaved_changes ( ) ;
222
- }
222
+ } ;
223
223
224
- private update_unsaved_changes ( ) : void {
224
+ private update_unsaved_changes = ( ) : void => {
225
225
if ( this . syncdb == null ) {
226
226
return ;
227
227
}
228
228
const unsaved = this . syncdb . has_unsaved_changes ( ) ;
229
229
this . setState ( { unsaved } ) ;
230
- }
230
+ } ;
231
231
232
232
// important that this be bound...
233
- public handle_projects_store_update ( projects_store : ProjectsStore ) : void {
233
+ handle_projects_store_update = ( projects_store : ProjectsStore ) : void => {
234
234
const store = this . redux . getStore < CourseState , CourseStore > ( this . name ) ;
235
235
if ( store == null ) return ; // not needed yet.
236
236
let users = projects_store . getIn ( [
@@ -248,12 +248,12 @@ export class CourseActions extends Actions<CourseState> {
248
248
this . student_projects . configure_all_projects ( ) ;
249
249
}
250
250
this . last_collaborator_state = users ;
251
- }
251
+ } ;
252
252
253
253
// Set the error. Use error="" to explicitly clear the existing set error.
254
254
// If there is an error already set, then the new error is just
255
255
// appended to the existing one.
256
- public set_error ( error : string ) : void {
256
+ set_error = ( error : string ) : void => {
257
257
if ( error != "" ) {
258
258
const store = this . get_store ( ) ;
259
259
if ( store == null ) return ;
@@ -263,18 +263,18 @@ export class CourseActions extends Actions<CourseState> {
263
263
error = error . trim ( ) ;
264
264
}
265
265
this . setState ( { error } ) ;
266
- }
266
+ } ;
267
267
268
268
// ACTIVITY ACTIONS
269
- public set_activity = (
269
+ set_activity = (
270
270
opts : { id : number ; desc ?: string } | { id ?: number ; desc : string } ,
271
271
) : number => {
272
272
return this . activity . set_activity ( opts ) ;
273
273
} ;
274
274
275
- public clear_activity ( id ?: number ) : void {
275
+ clear_activity = ( id ?: number ) : void => {
276
276
this . activity . clear_activity ( id ) ;
277
- }
277
+ } ;
278
278
279
279
// CONFIGURATION ACTIONS
280
280
// These hang off of this.configuration
@@ -302,12 +302,12 @@ export class CourseActions extends Actions<CourseState> {
302
302
If something goes wrong and the finish function is defined, then
303
303
it is called with a string describing the error.
304
304
*/
305
- public resolve ( opts : {
305
+ resolve = ( opts : {
306
306
assignment_id ?: string ;
307
307
student_id ?: string ;
308
308
handout_id ?: string ;
309
309
finish ?: Function ;
310
- } ) {
310
+ } ) => {
311
311
const r : {
312
312
student ?: StudentRecord ;
313
313
assignment ?: AssignmentRecord ;
@@ -359,20 +359,20 @@ export class CourseActions extends Actions<CourseState> {
359
359
}
360
360
}
361
361
return r ;
362
- }
362
+ } ;
363
363
364
364
// Takes an item_name and the id of the time
365
365
// item_name should be one of
366
366
// ['student', 'assignment', 'peer_config', handout', 'skip_grading']
367
- public toggle_item_expansion (
367
+ toggle_item_expansion = (
368
368
item_name :
369
369
| "student"
370
370
| "assignment"
371
371
| "peer_config"
372
372
| "handout"
373
373
| "skip_grading" ,
374
374
item_id ,
375
- ) : void {
375
+ ) : void => {
376
376
let adjusted ;
377
377
const store = this . get_store ( ) ;
378
378
if ( store == null ) {
@@ -391,5 +391,5 @@ export class CourseActions extends Actions<CourseState> {
391
391
}
392
392
}
393
393
this . setState ( { [ field_name ] : adjusted } ) ;
394
- }
394
+ } ;
395
395
}
0 commit comments