Skip to content

Commit

Permalink
Fixed indexing of secondary stimuli in log files, added more log item…
Browse files Browse the repository at this point in the history
…s (answer_correct, answer_incorrect, hit_floor, hit_ceiling, reached_maximum_floor_ceiling_hits), added count to ignored_response log item.
  • Loading branch information
davidlawson committed Aug 6, 2016
1 parent 0946d6c commit a80dc71
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
2 changes: 1 addition & 1 deletion PsyPad/Supporting Files/PsyPad-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>27</string>
<string>28</string>
<key>Fabric</key>
<dict>
<key>APIKey</key>
Expand Down
1 change: 1 addition & 0 deletions PsyPad/Test/TestViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
@property (weak, nonatomic) IBOutlet UIImageView *overlayImageView;
@property (nonatomic) int overlayIndex;
@property (nonatomic) int secondaryPressedIndex;
@property (nonatomic) int ignoredCount;

- (IBAction)beginConfiguration;
- (IBAction)pressExitButton:(id)sender;
Expand Down
21 changes: 19 additions & 2 deletions PsyPad/Test/TestViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,8 @@ - (IBAction)beginConfiguration
self.view.backgroundColor = [UIColor colorWithHexString:self.currentConfiguration.background_colour];
UIImage *bgImage = self.currentConfiguration.sequence.backgroundImage;
self.backgroundImageView.image = bgImage;

self.ignoredCount = 0;

if (self.currentConfiguration.show_exit_buttonValue)
{
Expand Down Expand Up @@ -402,7 +404,8 @@ - (void)pressTestButton:(id)sender

if (self.currentConfiguration.enable_secondary_stimuliValue && self.overlayIndex != self.secondaryPressedIndex)
{
[self log:@"ignored_response" info:nil];
self.ignoredCount++;
[self log:@"ignored_response" info:@"%d", self.ignoredCount];

if (!self.currentConfiguration.use_staircase_methodValue)
{
Expand Down Expand Up @@ -432,6 +435,8 @@ - (void)pressTestButton:(id)sender
self.currentStaircase.numTimesIncorrect = 0;

[self playAudio:self.correctAudioPlayer];

[self log:@"answer_correct" info:nil];
}
else
{
Expand All @@ -441,20 +446,28 @@ - (void)pressTestButton:(id)sender
self.currentStaircase.numTimesCorrect = 0;

[self playAudio:self.incorrectAudioPlayer];

[self log:@"answer_incorrect" info:nil];
}

if (answerCorrect && self.currentStaircase.currentLevel == self.currentStaircase.minLevel)
{
self.currentStaircase.numHitsFloor++;

[self log:@"hit_floor" info:nil];
}
else if (!answerCorrect && self.currentStaircase.currentLevel == self.currentStaircase.maxLevel)
{
self.currentStaircase.numHitsCeiling++;

[self log:@"hit_ceiling" info:nil];
}

if (self.currentStaircase.numHitsFloor == self.currentStaircase.floorCeilingHits
|| self.currentStaircase.numHitsCeiling == self.currentStaircase.floorCeilingHits)
{
[self log:@"reached_maximum_floor_ceiling_hits" info:nil];

[self.staircases removeObject:self.currentStaircase];
self.currentStaircase = nil;
[self prepareNextQuestion];
Expand Down Expand Up @@ -521,10 +534,14 @@ - (void)pressTestButton:(id)sender
if ([[imageButton.dbImage.name substringToIndex:2] isEqualToString:[NSString stringWithFormat:@"%d_", pressedButton.number]])
{
[self playAudio:self.correctAudioPlayer];

[self log:@"answer_correct" info:nil];
}
else
{
[self playAudio:self.incorrectAudioPlayer];

[self log:@"answer_incorrect" info:nil];
}
}

Expand Down Expand Up @@ -610,7 +627,7 @@ - (void)showSecondaryStimuli
break;
}
[self.view bringSubviewToFront:self.overlayImageView];
[self log:@"presented_secondary_image" info:@"%d", self.overlayIndex];
[self log:@"presented_secondary_image" info:@"%d", self.overlayIndex + 1];
}
}

Expand Down

0 comments on commit a80dc71

Please sign in to comment.