(input_type, check_missed = False)
| 3248 | self.label.text = ''.join(str_list) |
| 3249 | |
| 3250 | def check_match(input_type, check_missed = False): |
| 3251 | current = 0 |
| 3252 | back_data = '' |
| 3253 | operation = 0 |
| 3254 | # FIXME: I'm not going to think about whether crab_back will work with |
| 3255 | # cfg.VARIABLE_NBACK yet, since I don't actually understand how the latter works |
| 3256 | |
| 3257 | if mode.flags[mode.mode]['crab'] == 1: |
| 3258 | back = 1 + 2*((mode.trial_number-1) % mode.back) |
| 3259 | else: |
| 3260 | back = mode.back |
| 3261 | |
| 3262 | if cfg.VARIABLE_NBACK: |
| 3263 | nback_trial = mode.trial_number - mode.variable_list[mode.trial_number - back - 1] - 1 |
| 3264 | else: |
| 3265 | nback_trial = mode.trial_number - back - 1 |
| 3266 | |
| 3267 | if len(stats.session['position1']) < mode.back: |
| 3268 | return 'unknown' |
| 3269 | |
| 3270 | if input_type in ('visvis', 'visaudio', 'image'): |
| 3271 | current = mode.current_stim['vis'] |
| 3272 | elif input_type in ('audiovis', ): |
| 3273 | current = mode.current_stim['audio'] |
| 3274 | if input_type in ('visvis', 'audiovis', 'image'): |
| 3275 | back_data = 'vis' |
| 3276 | elif input_type in ('visaudio', ): |
| 3277 | back_data = 'audio' |
| 3278 | elif input_type == 'arithmetic': |
| 3279 | current = mode.current_stim['number'] |
| 3280 | back_data = stats.session['numbers'][nback_trial] |
| 3281 | operation = mode.current_operation |
| 3282 | else: |
| 3283 | current = mode.current_stim[input_type] |
| 3284 | back_data = input_type |
| 3285 | |
| 3286 | if input_type == 'arithmetic': |
| 3287 | if operation == 'add': |
| 3288 | correct_answer = back_data + current |
| 3289 | elif operation == 'subtract': |
| 3290 | correct_answer = back_data - current |
| 3291 | elif operation == 'multiply': |
| 3292 | correct_answer = back_data * current |
| 3293 | elif operation == 'divide': |
| 3294 | correct_answer = Decimal(back_data) / Decimal(current) |
| 3295 | if correct_answer == arithmeticAnswerLabel.parse_answer(): |
| 3296 | return 'correct' |
| 3297 | else: |
| 3298 | # Catch accesses past list end |
| 3299 | try: |
| 3300 | if current == stats.session[back_data][nback_trial]: |
| 3301 | if check_missed: |
| 3302 | return 'missed' |
| 3303 | else: |
| 3304 | return 'correct' |
| 3305 | except Exception as e: |
| 3306 | print(e) |
| 3307 | return 'incorrect' |
no test coverage detected