Don't set repeat count to 0

pull/2204/head
Alex Baker 1 year ago
parent fe87eac962
commit 32eed65f04

@ -565,7 +565,7 @@ class Task : Parcelable {
const val TRANS_REMINDERS = "reminders"
const val TRANS_RANDOM = "random"
private val INVALID_COUNT = ";?COUNT=-1".toRegex()
private val INVALID_COUNT = ";?COUNT=(-1|0)".toRegex()
/**
* Creates due date for this task. If this due date has no time associated, we move it to the last

@ -463,7 +463,6 @@ public class CustomRecurrenceDialog extends DialogFragment {
}
if (position == 0) {
rrule.setUntil(null);
rrule.setCount(0);
updateRepeatUntilOptions();
} else if (position == 1) {
repeatUntilClick();

@ -0,0 +1,22 @@
package org.tasks.repeats
import junit.framework.TestCase.assertEquals
import org.junit.Test
class RecurrenceUtilsTest {
@Test
fun shouldRemoveZeroCount() {
assertEquals(
"FREQ=WEEKLY;INTERVAL=1;BYDAY=FR",
RecurrenceUtils.newRecur("FREQ=WEEKLY;COUNT=0;INTERVAL=1;BYDAY=FR").toString()
)
}
@Test
fun shouldRemoveNegativeCount() {
assertEquals(
"FREQ=WEEKLY;INTERVAL=1;BYDAY=FR",
RecurrenceUtils.newRecur("FREQ=WEEKLY;COUNT=-1;INTERVAL=1;BYDAY=FR").toString()
)
}
}
Loading…
Cancel
Save