Skip to content

Commit

Permalink
LOG: some fixes to performance logging
Browse files Browse the repository at this point in the history
  • Loading branch information
kevindeland committed Oct 29, 2018
1 parent 15488bf commit 953e22f
Show file tree
Hide file tree
Showing 12 changed files with 54 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ public class CTutor implements ILoadableObject2, IEventSource {
public String navigatorType;
public HashMap<String,CMediaPackage> soundMap;

public String matrix;

public String engineLanguage;

private int index = 0; // test debug
Expand All @@ -129,7 +131,7 @@ public class CTutor implements ILoadableObject2, IEventSource {



public CTutor(Context context, String name, String tutorId, ITutorManager tutorContainer, ILogManager logManager, TScope rootScope, String tarLanguage, String featSet) {
public CTutor(Context context, String name, String tutorId, ITutorManager tutorContainer, ILogManager logManager, TScope rootScope, String tarLanguage, String featSet, String matrix) {

mTutorScope = new TScope(this, name, rootScope);
mContext = context;
Expand All @@ -138,6 +140,8 @@ public CTutor(Context context, String name, String tutorId, ITutorManager tutorC
mTutorContainer = tutorContainer;
mTutorLogManager = logManager;

this.matrix = matrix;

mAssetManager = context.getAssets();
// GRAY_SCREEN_BUG this is where Media Manager is initialized
Log.d(TCONST.DEBUG_GRAY_SCREEN_TAG, "p1: Initializing tutor: " + mTutorName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ static public void startSessionManager() {
}
}

createAndLaunchTutor(defTutor, RoboTutor.SELECTOR_MODE, null, tutorBindings); // where Activity Selector is launched
createAndLaunchTutor(defTutor, RoboTutor.SELECTOR_MODE, null, tutorBindings, null); // where Activity Selector is launched
}

/**
Expand All @@ -260,7 +260,7 @@ static public void quickLaunch(String tutorVariant, String tutorId, String tutor

initializeBindingPattern(tutorBinding, tutorFile);

createAndLaunchTutor(tutorDescriptor.tutorName , tutorDescriptor.features, tutorId, tutorBinding);
createAndLaunchTutor(tutorDescriptor.tutorName , tutorDescriptor.features, tutorId, tutorBinding, null);
}

/**
Expand Down Expand Up @@ -334,7 +334,7 @@ static public void killActiveTutor() {
* @param tutorName
* @param features
*/
static private void createAndLaunchTutor(String tutorName, String features, String tutorId, defdata_tutor dataSource) {
static private void createAndLaunchTutor(String tutorName, String features, String tutorId, defdata_tutor dataSource, String matrix) {

Log.d(TCONST.DEBUG_GRAY_SCREEN_TAG, "r4: killActiveTutor called from createAndLaunchTutor(" + tutorName + ")");
killActiveTutor();
Expand All @@ -353,7 +353,7 @@ static private void createAndLaunchTutor(String tutorName, String features, Stri
// GRAY_SCREEN_BUG CTutor created --> Media Manager created --> added to map
Log.d(TCONST.DEBUG_GRAY_SCREEN_TAG, "p2: Initializing tutor: " + tutorName);

activeTutor = new CTutor(Activity, tutorName, tutorId, (ITutorManager)tutorContainer, TutorLogManager, mRootScope, language, features);
activeTutor = new CTutor(Activity, tutorName, tutorId, (ITutorManager)tutorContainer, TutorLogManager, mRootScope, language, features, matrix);

activeTutor.launchTutor(dataSource);
}
Expand Down Expand Up @@ -518,7 +518,7 @@ static private void initializeBindingPattern(defdata_tutor bindingPattern, Strin
* @param tutorVariant
* @param intentType
*/
static public void launch(String intentType, String tutorVariant, String dataSource, String tutorId) {
static public void launch(String intentType, String tutorVariant, String dataSource, String tutorId, String matrix) {

Log.d(TAG, "launch: tutorId=" + tutorId);

Expand All @@ -543,7 +543,7 @@ static public void launch(String intentType, String tutorVariant, String dataSou
case "native":

Log.d(TCONST.DEBUG_GRAY_SCREEN_TAG, "p3b: Creating Tutor in 'CTutor.launch': " + tutorDescriptor.tutorName);
createAndLaunchTutor(tutorDescriptor.tutorName, tutorDescriptor.features, tutorId, tutorBinding);
createAndLaunchTutor(tutorDescriptor.tutorName, tutorDescriptor.features, tutorId, tutorBinding, matrix);
break;

case "browser":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ public void doDebugTagLaunchAction(String tag) {
file = ROBO_DEBUG_FILE_BPOP;
}

doLaunch(intent, TCONST.TUTOR_NATIVE, TCONST.DEBUG_FILE_PREFIX + file, "DEBUGGER");
doLaunch(intent, TCONST.TUTOR_NATIVE, TCONST.DEBUG_FILE_PREFIX + file, "DEBUGGER", null);
}


Expand Down Expand Up @@ -524,7 +524,7 @@ private void doTutorLaunchWithVideosAndStuff(CAt_Data tutorToLaunch) {
}

CLogManager.setTutor(activeTutorId);
doLaunch(tutorToLaunch.tutor_desc, TCONST.TUTOR_NATIVE, tutorToLaunch.tutor_data, tutorToLaunch.tutor_id);
doLaunch(tutorToLaunch.tutor_desc, TCONST.TUTOR_NATIVE, tutorToLaunch.tutor_data, tutorToLaunch.tutor_id, tutorToLaunch.skill);
}

/**
Expand Down Expand Up @@ -558,7 +558,7 @@ private void playTutorDemoVid(final CAt_Data tutorToLaunch, final String timesPl
// if an error occurs with media player, we don't want to freeze the app completely
CLogManager.setTutor(tutorToLaunch.tutor_id);

doLaunch(tutorToLaunch.tutor_desc, TCONST.TUTOR_NATIVE, tutorToLaunch.tutor_data, tutorToLaunch.tutor_id);
doLaunch(tutorToLaunch.tutor_desc, TCONST.TUTOR_NATIVE, tutorToLaunch.tutor_data, tutorToLaunch.tutor_id, tutorToLaunch.skill);
}


Expand All @@ -581,7 +581,7 @@ public void onCompletion(MediaPlayer mediaPlayer) {
Log.d("VID_LAUNCH", timesPlayedId + ": " + timesPlayedActivity + " --> " + increment);

CLogManager.setTutor(tutorToLaunch.tutor_id);
doLaunch(tutorToLaunch.tutor_desc, TCONST.TUTOR_NATIVE, tutorToLaunch.tutor_data, tutorToLaunch.tutor_id);
doLaunch(tutorToLaunch.tutor_desc, TCONST.TUTOR_NATIVE, tutorToLaunch.tutor_data, tutorToLaunch.tutor_id, tutorToLaunch.skill);
}
});
}
Expand All @@ -598,7 +598,7 @@ public void onCompletion(MediaPlayer mediaPlayer) {
* @param intentData
*/
@Override
public void doLaunch(String intent, String intentData, String dataSource, String tutorId) {
public void doLaunch(String intent, String intentData, String dataSource, String tutorId, String matrix) {

Log.wtf("WARRIOR_MAN", "doLaunch: tutorId = " + tutorId);

Expand All @@ -615,7 +615,7 @@ public void doLaunch(String intent, String intentData, String dataSource, String

// (2.6)
//applyBehavior(LAUNCH_EVENT); // (2.6) this was collapsed into the following command
CTutorEngine.launch(intentData, intent, dataSource, tutorId);
CTutorEngine.launch(intentData, intent, dataSource, tutorId, matrix);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1176,6 +1176,7 @@ private void trackAndLogPerformance(String task, boolean correct) {
event.setTutorName(mTutor.getTutorName());
Log.wtf("WARRIOR_MAN", mTutor.getTutorId());
event.setTutorId(mTutor.getTutorId());
event.setMatrixNameBySkillId(mTutor.matrix);
event.setPromotionMode(RoboTutor.getPromotionMode(event.getMatrixName()));
event.setLevelName(task);
event.setTaskName("story");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,7 @@ protected void trackAndLogPerformance(boolean isCorrect, String selectedSyllable
event.setExpectedAnswer(_word.get(_currentLetterIndex));
event.setUserResponse(selectedSyllable);
event.setCorrectness(isCorrect ? TCONST.LOG_CORRECT : TCONST.LOG_INCORRECT);
event.setPromotionMode(RoboTutor.getPromotionMode(event.getMatrixName()));

event.setTimestamp(System.currentTimeMillis());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ class CustomDebugClickListener implements OnClickListener {

@Override
public void onClick(View view) {
mButtonController.doLaunch(tutor.tutor_desc, TCONST.TUTOR_NATIVE, tutor.tutor_data, tutor.tutor_id);
mButtonController.doLaunch(tutor.tutor_desc, TCONST.TUTOR_NATIVE, tutor.tutor_data, tutor.tutor_id, null);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ public void transferHotLogs(String hotPath, String readyPath) {
}

for (File f : hotDir.listFiles()) {
Log.w("LOG_DEBUG", "Transferring file " + f.getName());
Log.w("LOG_DEBUG", "Moving file " + f.getName() + " between folders.");

if (f.isDirectory()) {
// do nothing... there should not be any directories
Expand All @@ -179,7 +179,7 @@ public void transferHotLogs(String hotPath, String readyPath) {
}
}
} catch (IOException e) {
CErrorManager.logEvent(TAG, "Transfer Error:", e, false);
CErrorManager.logEvent(TAG, "Moving file Error:", e, false);
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public String toString() {
* TODO even better, just pass the "skills" variable
* @param tutorId
*/
private void setMatrixName(String tutorId) {
private void setMatrixNameByTutorId(String tutorId) {

if (isAlwaysMathTutor(tutorId)) {
matrixName = MATH_MATRIX;
Expand Down Expand Up @@ -132,7 +132,10 @@ private void setMatrixStory(String tutorName) {
|| tutorName.contains("letters_alphabet_song")
|| tutorName.contains("comm")
|| tutorName.contains("ltr")
|| tutorName.contains("syl")) {
|| tutorName.contains("syl")
|| tutorName.contains("nafasi")
|| tutorName.contains("herufi_kubwa")
|| tutorName.contains("kituo")){
matrixName = LITERACY_MATRIX;

} else if (tutorName.contains("1..4")
Expand Down Expand Up @@ -322,7 +325,27 @@ public void setTutorId(String tutorId) {


if(tutorId != null) {
setMatrixName(tutorId);
setMatrixNameByTutorId(tutorId);
}
}

public void setMatrixNameBySkillId(String skill) {
if (skill == null) {
return;
}
switch (skill) {

case "letters":
matrixName = LITERACY_MATRIX;
break;

case "numbers":
matrixName = MATH_MATRIX;
break;

case "stories":
matrixName = STORIES_MATRIX;
break;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -556,21 +556,22 @@ public boolean onTouch(View view, MotionEvent event) {
break;
case MotionEvent.ACTION_UP:
disableImageButtons();
String[] options = new String[] {mWord1Text.getText().toString(), mWord2Text.getText().toString(), mWord3Text.getText().toString(), mWord4Text.getText().toString()};
if (_wordTextView.getText().toString().equals(clozeTarget)){
mParent.updateViewColor(_wordFrame, Color.GREEN);
mParent.retractFeature(TCONST.CLOZE_WRONG);
mParent.publishFeature(TCONST.CLOZE_CORRECT);
mParent.publishValue(SHOW_CLOZE, TCONST.FALSE);
mParent.logClozePerformance(true, clozeTarget, _wordTextView.getText().toString(),
new String[] {mWord1Text.getText().toString(), mWord2Text.getText().toString(), mWord3Text.getText().toString(), mWord4Text.getText().toString()}, mCurrPage);
options, mCurrPage);
isClozePage = false;
replayCloze = true;
}else{
mParent.updateViewColor(_wordFrame, Color.RED);
mParent.retractFeature(TCONST.CLOZE_CORRECT);
mParent.publishFeature(TCONST.CLOZE_WRONG);
mParent.logClozePerformance(false, clozeTarget, _wordTextView.getText().toString(),
new String[]{mWord1Text.getText().toString(), mWord2Text.getText().toString(), mWord3Text.getText().toString(), mWord4Text.getText().toString()}, mCurrPage);
options, mCurrPage);
}
mParent.nextNode();
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public void doAskButtonAction(String actionid) {
* @param intent
* @param intentData
*/
public void doLaunch(String intent, String intentData, String dataSource, String tutorId) {
public void doLaunch(String intent, String intentData, String dataSource, String tutorId, String matrix) {
}

// IButtonController Interface END
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public void setButtonController(IButtonController controller) {

public void launchTutor(String tutorDesc, String tutorNative, String tutorData) {

mButtonController.doLaunch(tutorDesc, tutorNative, tutorData, null); // WARRIOR_MAN what is this???
mButtonController.doLaunch(tutorDesc, tutorNative, tutorData, null, null); // WARRIOR_MAN what is this???
}

private void buildInterface() {
Expand Down
2 changes: 1 addition & 1 deletion util/src/main/java/cmu/xprize/util/IButtonController.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ public interface IButtonController {
public void doButtonBehavior(String buttonid);
public void doAskButtonAction(String actionid);

public void doLaunch(String intent, String intentData, String dataSource, String tutorId); // WARRIOR_MAN
public void doLaunch(String intent, String intentData, String dataSource, String tutorId, String matrix); // WARRIOR_MAN
}

0 comments on commit 953e22f

Please sign in to comment.