Skip to content

Commit

Permalink
implemented escape to placement - v2
Browse files Browse the repository at this point in the history
  • Loading branch information
ritessshhh authored and ritessshhh committed Jul 9, 2024
1 parent 9b129ba commit 185da6a
Show file tree
Hide file tree
Showing 7 changed files with 147 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import cmu.xprize.comp_ask.CAsk_Data;
import cmu.xprize.comp_session.AS_CONST;
import cmu.xprize.robotutor.RoboTutor;
import cmu.xprize.robotutor.tutorengine.CTutor;
import cmu.xprize.util.CAt_Data;
import cmu.xprize.util.CPlacementTest_Tutor;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.util.Map;

import cmu.xprize.comp_ask.CAsk_Data;
import cmu.xprize.robotutor.tutorengine.CTutor;
import cmu.xprize.util.CAt_Data;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ public class PromotionMechanism {
private IStudentDataModel _studentModel; // holds the StudentDataModel
private TransitionMatrixModel _matrix; // now holds the transition map things...

public static PerformanceData performance = new PerformanceData();

public PromotionMechanism(IStudentDataModel studentModel, TransitionMatrixModel matrix) {
this._studentModel = studentModel;
this._matrix = matrix;
Expand Down Expand Up @@ -156,7 +158,6 @@ private String selectNextTutor(CTutor lastTutorPlayed, String lastSkillPlayed, b
rules = new PerformancePromotionRules();
}

PerformanceData performance = new PerformanceData();
performance.setActivityType(activeTutorId);
// look up activeSkill every time?
performance.setActiveSkill(lastSkillPlayed);
Expand All @@ -169,6 +170,8 @@ private String selectNextTutor(CTutor lastTutorPlayed, String lastSkillPlayed, b
performance.setTotalNumberQuestions(lastTutorPlayed.getTotalQuestions());




PromotionRules.PromotionDecision promotionDecision = rules.assessPerformance(performance);
RoboTutor.logManager.postEvent_I(MENU_BUG_TAG, "PerformancePromotionRules result = " + promotionDecision);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import cmu.xprize.comp_ask.CAsk_Data;
import cmu.xprize.comp_session.AS_CONST;
import cmu.xprize.robotutor.RoboTutor;
import cmu.xprize.robotutor.tutorengine.CTutor;
import cmu.xprize.robotutor.tutorengine.CTutorEngine;
import cmu.xprize.util.CAt_Data;
import cmu.xprize.util.CPlacementTest_Tutor;

Expand All @@ -26,17 +28,24 @@ public class StudentChooseMatrixActivityMenu implements IActivityMenu {

TransitionMatrixModel _matrix;
IStudentDataModel _student;
PerformanceData _performanceData;
PromotionMechanism _promotionMechanism;

public StudentChooseMatrixActivityMenu(TransitionMatrixModel matrix, IStudentDataModel student) {
this._matrix = matrix;
this._student = student;
this._promotionMechanism = new PromotionMechanism(_student, _matrix);
this._performanceData = PromotionMechanism.performance;
_promotionMechanism = new PromotionMechanism(_student, _matrix);
}

@Override
public String getLayoutName() {
return "ask_activity_selector_2x3";
if(_performanceData.getNumberAttempts() > 0
&&
_performanceData.getNumberCorrect() / _performanceData.getNumberAttempts() > PlacementPromotionRules.HIGH_PERFORMANCE_THRESHOLD)
return "ask_activity_selector_elevate";
else
return "ask_activity_selector_2x3";
}

@Override
Expand Down Expand Up @@ -72,12 +81,21 @@ public CAsk_Data initializeActiveLayout() {
activeLayout.items[2].prompt = "numbers and math";
activeLayout.items[2].help = "numbers and math";


activeLayout.items[3] = new CAskElement();
activeLayout.items[3].componentID = "Sbutton1";
activeLayout.items[3].behavior = AS_CONST.ELEVATE;
activeLayout.items[3].prompt = "escape to placement";
activeLayout.items[3].help = "escape to placement";
activeLayout.items[3] = new CAskElement();
if(_performanceData.getNumberAttempts() > 0
&&
_performanceData.getNumberCorrect() / _performanceData.getNumberAttempts() > PlacementPromotionRules.HIGH_PERFORMANCE_THRESHOLD){
activeLayout.items[3].componentID = "Sbutton1";
activeLayout.items[3].behavior = AS_CONST.ELEVATE;
activeLayout.items[3].prompt = "escape to placement";
activeLayout.items[3].help = "escape to placement";
}
else{
activeLayout.items[3].componentID = "SbuttonRepeat";
activeLayout.items[3].behavior = AS_CONST.SELECT_REPEAT;
activeLayout.items[3].prompt = "lets do it again";
activeLayout.items[3].help = "lets do it again";
}

activeLayout.items[4] = new CAskElement();
activeLayout.items[4].componentID = "SbuttonExit";
Expand All @@ -95,7 +113,14 @@ public Map<String, String> getButtonBehaviorMap() {
map.put(AS_CONST.BEHAVIOR_KEYS.SELECT_WRITING, AS_CONST.QUEUEMAP_KEYS.BUTTON_BEHAVIOR);
map.put(AS_CONST.BEHAVIOR_KEYS.SELECT_STORIES, AS_CONST.QUEUEMAP_KEYS.BUTTON_BEHAVIOR);
map.put(AS_CONST.BEHAVIOR_KEYS.SELECT_MATH, AS_CONST.QUEUEMAP_KEYS.BUTTON_BEHAVIOR);
map.put(AS_CONST.ELEVATE, AS_CONST.QUEUEMAP_KEYS.BUTTON_BEHAVIOR);
if(_performanceData.getNumberAttempts() > 0
&&
_performanceData.getNumberCorrect() / _performanceData.getNumberAttempts() > PlacementPromotionRules.HIGH_PERFORMANCE_THRESHOLD){
map.put(AS_CONST.ELEVATE, AS_CONST.QUEUEMAP_KEYS.BUTTON_BEHAVIOR);
}
else{
map.put(AS_CONST.SELECT_REPEAT, AS_CONST.QUEUEMAP_KEYS.BUTTON_BEHAVIOR);
}
map.put(AS_CONST.SELECT_EXIT, AS_CONST.QUEUEMAP_KEYS.EXIT_BUTTON_BEHAVIOR);
return map;
}
Expand Down Expand Up @@ -131,6 +156,21 @@ public CAt_Data getTutorToLaunch(String buttonBehavior) {
}
break;

case AS_CONST.SELECT_REPEAT:

RoboTutor.STUDENT_CHOSE_REPEAT = true;

String lastTutor = _student.getLastTutor(); // MENU_LOGIC why is this only called once?
if (lastTutor != null) { // for when it's the first time...s
activeTutorId = lastTutor;
}
if (activeTutorId == null) {
rootTutor = _matrix.getRootSkillByContentArea(SELECT_WRITING);
}
activeSkill = _student.getLastSkill();
transitionMap = _matrix.getTransitionMapByContentArea(activeSkill);
break;

case SELECT_WRITING:

activeSkill = SELECT_WRITING; // √
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -684,8 +684,6 @@ private void doTutorLaunchWithVideosAndStuff(CAt_Data tutorToLaunch) {
/**
* A big and cumbersome method that plays the tutor video...
*
* @param prefs
* @param activityPreferenceKey
* @param timesPlayedActivity
* @param pathToFile
*/
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/layout/ask_activity_selector_2x3.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
/>

<ImageButton
android:id="@+id/Sbutton1"
android:id="@+id/SbuttonRepeat"
android:scaleType="fitCenter"
android:layout_below="@+id/SbuttonOption2"
android:layout_toRightOf="@+id/SbuttonEmpty"
Expand All @@ -63,7 +63,7 @@
app:layout_heightPercent="50%"
app:layout_widthPercent="33%"
android:background="@null"
android:src="@drawable/button_okay_select"
android:src="@drawable/button_repeat_select"
/>

<ImageButton
Expand Down
90 changes: 90 additions & 0 deletions app/src/main/res/layout/ask_activity_selector_elevate.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.percentlayout.widget.PercentRelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="horizontal"

android:layout_centerInParent="true"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#F3FAFF">

<ImageButton
android:id="@+id/SbuttonOption1"
android:layout_width="match_parent"
android:scaleType="fitCenter"
android:padding="40dp"
app:layout_heightPercent="50%"
app:layout_widthPercent="33%"
android:background="@null"
android:src="@drawable/button_letters_select"
/>

<ImageButton
android:id="@+id/SbuttonOption2"
android:layout_toRightOf="@id/SbuttonOption1"
android:scaleType="fitCenter"
android:layout_width="match_parent"
android:padding="40dp"
app:layout_heightPercent="50%"
app:layout_widthPercent="33%"
android:background="@null"
android:src="@drawable/button_stories_select"/>

<ImageButton
android:id="@+id/SbuttonOption3"
android:layout_toRightOf="@id/SbuttonOption2"
android:scaleType="fitCenter"
android:layout_width="match_parent"
android:padding="40dp"
app:layout_heightPercent="50%"
app:layout_widthPercent="33%"
android:background="@null"
android:src="@drawable/button_math_select"/>

<ImageButton
android:id="@+id/SbuttonEmpty"
android:scaleType="fitCenter"
android:layout_below="@+id/SbuttonOption1"
android:layout_width="match_parent"
android:padding="40dp"
app:layout_heightPercent="50%"
app:layout_widthPercent="33%"
android:background="@null"
/>

<ImageButton
android:id="@+id/Sbutton1"
android:scaleType="fitCenter"
android:layout_below="@+id/SbuttonOption2"
android:layout_toRightOf="@+id/SbuttonEmpty"
android:layout_width="match_parent"
android:padding="40dp"
app:layout_heightPercent="50%"
app:layout_widthPercent="33%"
android:background="@null"
android:src="@drawable/button_okay_select"
/>

<ImageButton
android:id="@+id/SbuttonExit"
android:layout_toRightOf="@id/SbuttonOption2"
android:layout_below="@+id/SbuttonOption3"
android:scaleType="fitCenter"
android:layout_width="match_parent"
android:padding="40dp"
app:layout_heightPercent="50%"
app:layout_widthPercent="33%"
android:background="@null"
android:src="@drawable/button_exit_select"/>

<cmu.xprize.robotutor.tutorengine.widgets.core.THandAnimation
android:id="@+id/ShandAnimator"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipChildren="false"
app:scale_factor="0.3"
android:background="@null"/>


</androidx.percentlayout.widget.PercentRelativeLayout>

0 comments on commit 185da6a

Please sign in to comment.