Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ repositories {
// Added the custom Maven repository for utilcode
maven {
url 'http://maven.xdja.com:8081/nexus3/repository/aliyun/'
allowInsecureProtocol = true
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ public String mapSoundPackage(CTutor tTutor, String packageName, String langOver
catch(Exception e) {
soundPackage = autoLang;
}

Log.d(TAG, "Resolved soundPackage = " + soundPackage);
return soundPackage;
}

Expand Down Expand Up @@ -285,7 +285,7 @@ public String mapPackagePath(CTutor tTutor, String packageName) {
catch(Exception e) {
packagePath = TCONST.BASE_ASSETS;
}

Log.d(TAG, "Resolved packagePath = " + packagePath);
return packagePath;
}

Expand Down Expand Up @@ -324,7 +324,7 @@ public String mapPackageLocation(CTutor tTutor, String packageName) {
catch(Exception e) {
packageLocation = TCONST.EXTERNAL;
}

Log.d(TAG, "Resolved packageLocation = " + packageLocation);
return packageLocation;
}

Expand Down

Large diffs are not rendered by default.

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

public static final PerformanceData performance; // `final` ensures it can't be changed

// Static block to initialize `performance` if it needs to be done in a specific way
static {
performance = new PerformanceData(); // Initialize here, can be any valid initialization
}

public PromotionMechanism(IStudentDataModel studentModel, TransitionMatrixModel matrix) {
this._studentModel = studentModel;
this._matrix = matrix;
Expand Down Expand Up @@ -156,7 +163,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 Down Expand Up @@ -286,8 +292,8 @@ private String getNextPlacementTutor(String activeTutorId, boolean useMathPlacem
// student has made it to the end
CPlacementTest_Tutor lastPlacementTest = _matrix.mathPlacement[mathPlacementIndex]; // off-by-one??? they'll never reach it :)
// update our preferences to exit PLACEMENT mode
_studentModel.updateMathPlacement(false, false);
_studentModel.updateMathPlacementIndex(null, false);
_studentModel.updateMathPlacement(true, true); //reached end -> jump to promotion
_studentModel.updateMathPlacementIndex(null, true);


_studentModel.saveAll();
Expand Down Expand Up @@ -317,8 +323,8 @@ private String getNextPlacementTutor(String activeTutorId, boolean useMathPlacem
CPlacementTest_Tutor lastPlacementTest = _matrix.writePlacement[writingPlacementIndex]; // off-by-one??? they'll never reach it :)
// update our preferences to exit PLACEMENT mode

_studentModel.updateWritingPlacement(false, false);
_studentModel.updateWritingPlacementIndex(null, false); //editor.remove("WRITING_PLACEMENT_INDEX");
_studentModel.updateWritingPlacement(true, true); // once they reach index lenght, jump to promotion
_studentModel.updateWritingPlacementIndex(null, true); //editor.remove("WRITING_PLACEMENT_INDEX");

_studentModel.saveAll();
return lastPlacementTest.fail; // go to beginning of last level
Expand Down Expand Up @@ -353,15 +359,15 @@ private String getNextPlacementTutor(String activeTutorId, boolean useMathPlacem
// set prefs.usesThingy to false
if(useMathPlacement) {
lastPlacementTest = _matrix.mathPlacement[placementIndex];
_studentModel.updateMathPlacement(false, false); // editor.putBoolean(placementKey, false); // no more placement
_studentModel.updateMathPlacementIndex(null, false);
_studentModel.updateMathPlacement(true, true); // editor.putBoolean(placementKey, false); // no more placement
_studentModel.updateMathPlacementIndex(null, true);

}
// useWritePlacement only other option
else {
lastPlacementTest = _matrix.writePlacement[placementIndex];
_studentModel.updateWritingPlacement(false, false); // editor.putBoolean(placementKey, false); // no more placement
_studentModel.updateWritingPlacementIndex(null, false); // editor.remove(placementIndexKey);
_studentModel.updateWritingPlacement(true, true); //jump to promotion
_studentModel.updateWritingPlacementIndex(null, true); // editor.remove(placementIndexKey);
}

_studentModel.saveAll();
Expand All @@ -372,4 +378,4 @@ private String getNextPlacementTutor(String activeTutorId, boolean useMathPlacem
}

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,27 @@ public class StudentChooseMatrixActivityMenu implements IActivityMenu {

TransitionMatrixModel _matrix;
IStudentDataModel _student;

PromotionMechanism _promotionMechanism;
private static final int MIN_NUM_ATTEMPTS = 3;

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

@Override
public String getLayoutName() {
return "ask_activity_selector_2x3";
if(this._promotionMechanism.performance.getNumberAttempts() >= MIN_NUM_ATTEMPTS
&&
this._promotionMechanism.performance.getTotalNumberQuestions() >= 3
&&
this._promotionMechanism.performance.getNumberCorrect() /this._promotionMechanism.performance.getNumberAttempts() > PlacementPromotionRules.HIGH_PERFORMANCE_THRESHOLD

)
return "ask_activity_selector_2x3_elevate";
else
return "ask_activity_selector_2x3";
}

@Override
Expand Down Expand Up @@ -70,11 +82,23 @@ public CAsk_Data initializeActiveLayout() {
activeLayout.items[2].help = "numbers and math";


activeLayout.items[3] = new CAskElement();
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[3] = new CAskElement();
if(this._promotionMechanism.performance.getNumberAttempts() >= MIN_NUM_ATTEMPTS
&&
this._promotionMechanism.performance.getTotalNumberQuestions() >= 3
&&
this._promotionMechanism.performance.getNumberCorrect() / this._promotionMechanism.performance.getNumberAttempts() > PlacementPromotionRules.HIGH_PERFORMANCE_THRESHOLD){
activeLayout.items[3].componentID = "Sbutton1";
activeLayout.items[3].behavior = AS_CONST.ELEVATE;
activeLayout.items[3].prompt = "something harder";
activeLayout.items[3].help = "something harder";
}
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 @@ -92,7 +116,16 @@ 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.SELECT_REPEAT, AS_CONST.QUEUEMAP_KEYS.BUTTON_BEHAVIOR);
if(this._promotionMechanism.performance.getNumberAttempts() >= MIN_NUM_ATTEMPTS
&&
this._promotionMechanism.performance.getTotalNumberQuestions() >= 3
&&
this._promotionMechanism.performance.getNumberCorrect() / this._promotionMechanism.performance.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 All @@ -103,11 +136,31 @@ public CAt_Data getTutorToLaunch(String buttonBehavior) {
String activeTutorId = null;
HashMap transitionMap = null;
String rootTutor = null;

String activeSkill = null;

// this could seriously be cleaned up...
switch (buttonBehavior.toUpperCase()) {
case AS_CONST.ELEVATE:

activeSkill = _student.getLastSkill();
transitionMap = _matrix.getTransitionMapByContentArea(activeSkill);
activeTutorId = _student.getLastTutor();

if(activeSkill != null){
// If the last activity is not null then go to that activity but update the placement index by 1
if(activeSkill.equals(SELECT_MATH)) {
rootTutor = _matrix.getRootSkillByContentArea(SELECT_MATH);
CAt_Data transitionData = (CAt_Data) transitionMap.get(activeTutorId);
activeTutorId = transitionData.harder;
}
if(activeSkill.equals(SELECT_WRITING)) {
rootTutor = _matrix.getRootSkillByContentArea(SELECT_WRITING);
CAt_Data transitionData = (CAt_Data) transitionMap.get(activeTutorId);
activeTutorId = transitionData.harder;
}
}

break;

case AS_CONST.SELECT_REPEAT:

Expand Down Expand Up @@ -168,4 +221,4 @@ public CAt_Data getTutorToLaunch(String buttonBehavior) {
public String getDebugMenuSkill() {
return _student.getActiveSkill();
}
}
}
68 changes: 68 additions & 0 deletions app/src/main/res/layout/ask_activity_selector_2x2_elevate.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<?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">

<cmu.xprize.comp_ask.CImageButton
android:id="@+id/SbuttonOption1"
android:layout_width="match_parent"
android:scaleType="fitCenter"
android:padding="40dp"
app:layout_heightPercent="50%"
app:layout_widthPercent="50%"
android:background="@null"
android:src="@drawable/pentagon"
/>

<cmu.xprize.comp_ask.CImageButton
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="50%"
android:background="@null"
android:src="@drawable/triangle"/>


<cmu.xprize.comp_ask.CImageButton
android:id="@+id/Sbutton1"
android:scaleType="fitCenter"
android:layout_below="@+id/SbuttonOption1"
android:layout_toRightOf="@+id/SbuttonEmpty"
android:layout_width="match_parent"
android:padding="40dp"
app:layout_heightPercent="50%"
app:layout_widthPercent="50%"
android:background="@null"
android:src="@drawable/button_okay_select" />

<cmu.xprize.comp_ask.CImageButton
android:id="@+id/SbuttonExit"
android:layout_toRightOf="@id/Sbutton1"
android:layout_below="@+id/SbuttonOption2"
android:scaleType="fitCenter"
android:layout_width="match_parent"
android:padding="40dp"
app:layout_heightPercent="50%"
app:layout_widthPercent="50%"
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>
90 changes: 90 additions & 0 deletions app/src/main/res/layout/ask_activity_selector_2x3_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>
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public static final class BEHAVIOR_KEYS {
public static final String SELECT_AUTO_DIFFICULTY = "SELECT_AUTO_DIFFICULTY"; // get rid of me
public static final String SELECT_REPEAT = "SELECT_REPEAT";
public static final String SELECT_EXIT = "SELECT_EXIT";

public static final String ELEVATE = "ELEVATE_TO_PLACEMENT";
public static final String SELECT_NONE = "SELECT_NONE";

public static final String VAR_BUTTONID = ".buttonid";
Expand Down
Loading