diff --git a/res/layout-xlarge/studyoptions.xml b/res/layout-xlarge/studyoptions.xml
index 05b420de1a..ea242eb904 100644
--- a/res/layout-xlarge/studyoptions.xml
+++ b/res/layout-xlarge/studyoptions.xml
@@ -108,6 +108,20 @@
android:textColor="#007700" />
+
+
+
+
+
+
+
+
موافق
اسم مجموعة البطاقات
المستحق اليوم:
+ Daily load:
مجموع البطاقات الجديدة:
مجموع البطاقات:
الوقت المقدر (دقيقة):
diff --git a/res/values-fr/01-core.xml b/res/values-fr/01-core.xml
index 4acbb78f6c..d05f1c0c9e 100644
--- a/res/values-fr/01-core.xml
+++ b/res/values-fr/01-core.xml
@@ -28,6 +28,7 @@
OK
Nom du paquet
Prévues aujourd’hui :
+ Charge journalière :
Cartes inédites :
Cartes :
Durée estimée (mn) :
diff --git a/res/values/01-core.xml b/res/values/01-core.xml
index d5999b9048..74a3bd24b9 100644
--- a/res/values/01-core.xml
+++ b/res/values/01-core.xml
@@ -32,6 +32,7 @@
Deck name
Due today:
+Daily load:
Total new cards:
Total cards:
Estimated time (min):
@@ -102,8 +103,7 @@
About
-Dismiss Note...
-Bury Note
+Dismiss Note...Bury Note
Suspend Card
Suspend Note
Delete Note
@@ -180,4 +180,5 @@
help
Sync
+
diff --git a/src/com/ichi2/anki/StudyOptionsFragment.java b/src/com/ichi2/anki/StudyOptionsFragment.java
index 47a01ac00f..ee6c3cdd8e 100644
--- a/src/com/ichi2/anki/StudyOptionsFragment.java
+++ b/src/com/ichi2/anki/StudyOptionsFragment.java
@@ -142,6 +142,7 @@ public class StudyOptionsFragment extends Fragment {
private TextView mTextTotal;
private TextView mTextETA;
private LinearLayout mSmallChart;
+ private TextView mTextAvgDailyLoad;
private LinearLayout mDeckCounts;
private LinearLayout mDeckChart;
private ImageButton mAddNote;
@@ -443,6 +444,7 @@ public void onConfigurationChanged(Configuration newConfig) {
CharSequence lrnToday = mTextTodayLrn.getText();
CharSequence revToday = mTextTodayRev.getText();
CharSequence newTotal = mTextNewTotal.getText();
+ CharSequence avgDailyLoad = mTextAvgDailyLoad.getText();
CharSequence total = mTextTotal.getText();
CharSequence eta = mTextETA.getText();
// long timelimit = mCol.getTimeLimit() / 60;
@@ -460,6 +462,7 @@ public void onConfigurationChanged(Configuration newConfig) {
mTextTodayNew.setText(newToday);
mTextTodayLrn.setText(lrnToday);
mTextTodayRev.setText(revToday);
+ mTextAvgDailyLoad.setText(avgDailyLoad);
mTextNewTotal.setText(newTotal);
mTextTotal.setText(total);
mTextETA.setText(eta);
@@ -644,6 +647,7 @@ private void initAllContentViews(LayoutInflater inflater) {
mTextTotal = (TextView) mStudyOptionsView.findViewById(R.id.studyoptions_total);
mTextETA = (TextView) mStudyOptionsView.findViewById(R.id.studyoptions_eta);
mSmallChart = (LinearLayout) mStudyOptionsView.findViewById(R.id.studyoptions_mall_chart);
+ mTextAvgDailyLoad = (TextView) mStudyOptionsView.findViewById(R.id.studyoptions_forecast);
mGlobalMatBar.setVisibility(View.INVISIBLE);
mGlobalBar.setVisibility(View.INVISIBLE);
@@ -1231,6 +1235,7 @@ public void onPostExecute(DeckTask.TaskData result) {
mProgressAll = (Double) obj[6];
int eta = (Integer) obj[7];
double[][] serieslist = (double[][]) obj[8];
+ double forecast = (Double) obj[9];
updateStatisticBars();
updateChart(serieslist);
@@ -1264,6 +1269,7 @@ public void onPostExecute(DeckTask.TaskData result) {
} else {
mTextETA.setText("-");
}
+ mTextAvgDailyLoad.setText(String.valueOf(forecast));
if (mDeckCounts.getVisibility() == View.INVISIBLE) {
mDeckCounts.setVisibility(View.VISIBLE);
diff --git a/src/com/ichi2/async/DeckTask.java b/src/com/ichi2/async/DeckTask.java
index 28c98deec8..b756cded0f 100644
--- a/src/com/ichi2/async/DeckTask.java
+++ b/src/com/ichi2/async/DeckTask.java
@@ -736,14 +736,15 @@ private TaskData doInBackgroundUpdateValuesFromDeck(TaskData... params) {
int totalCount = sched.cardCount();
double progressMature = ((double) sched.matureCount()) / ((double) totalCount);
double progressAll = 1 - (((double) (totalNewCount + counts[1])) / ((double) totalCount));
- double[][] serieslist = null;
+ double[][] serieslist = null;
// only calculate stats if necessary
if ((Boolean) obj[1]) {
serieslist = Stats.getSmallDueStats(sched.getCol());
}
+ double forecast = sched.avgDailyLoad();
return new TaskData(new Object[] { counts[0], counts[1], counts[2],
totalNewCount, totalCount, progressMature, progressAll,
- sched.eta(counts), serieslist });
+ sched.eta(counts), serieslist, forecast });
} catch (RuntimeException e) {
Log.e(AnkiDroidApp.TAG, "doInBackgroundUpdateValuesFromDeck - an error occurred: " + e);
return null;
diff --git a/src/com/ichi2/libanki/Sched.java b/src/com/ichi2/libanki/Sched.java
index 7f388bcbfe..9c5bce57c0 100644
--- a/src/com/ichi2/libanki/Sched.java
+++ b/src/com/ichi2/libanki/Sched.java
@@ -2811,4 +2811,29 @@ public int compare(long[] lhs, long[] rhs) {
}
}
+ /**
+ * Compute the average cards per day, which is the sum on the inverse of the frequency of the cards.
+ * For ex: a card with freq=4 day will worth 0.25 card/day
+ * @return average cards per day
+ */
+ public double avgDailyLoad() {
+ Cursor cur = null;
+ try {
+ cur = mCol
+ .getDb()
+ .getDatabase()
+ .rawQuery(
+ "select round(sum(1./ivl),2) from cards where did IN "
+ + Utils.ids2str(mCol.getDecks().active()) + " and ivl>0 and queue!=-1", null);
+ if (!cur.moveToFirst()) {
+ return -1;
+ }
+ return cur.getDouble(0);
+ } finally {
+ if (cur != null && !cur.isClosed()) {
+ cur.close();
+ }
+ }
+ }
+
}