Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Let Due and Time data not set recurrence values. Fixes #858 #859

Merged
merged 1 commit into from
Sep 27, 2019
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
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@
package org.dmfs.opentaskspal.tasks;

import android.content.ContentProviderOperation;
import androidx.annotation.NonNull;

import org.dmfs.android.contentpal.RowData;
import org.dmfs.android.contentpal.TransactionContext;
import org.dmfs.rfc5545.DateTime;
import org.dmfs.tasks.contract.TaskContract;

import androidx.annotation.NonNull;


/**
* {@link RowData} for setting only the due datetime of the task, for setting start as well use {@link TimeData}.
Expand All @@ -49,14 +50,8 @@ public ContentProviderOperation.Builder updatedBuilder(@NonNull TransactionConte
.withValue(TaskContract.Tasks.DUE, mDue.getTimestamp())
.withValue(TaskContract.Tasks.TZ, mDue.isAllDay() ? "UTC" : mDue.getTimeZone().getID())
.withValue(TaskContract.Tasks.IS_ALLDAY, mDue.isAllDay() ? 1 : 0)

.withValue(TaskContract.Tasks.DTSTART, null)

.withValue(TaskContract.Tasks.DURATION, null)

.withValue(TaskContract.Tasks.RDATE, null)
.withValue(TaskContract.Tasks.RRULE, null)
.withValue(TaskContract.Tasks.EXDATE, null);
.withValue(TaskContract.Tasks.DURATION, null);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package org.dmfs.opentaskspal.tasks;

import android.content.ContentProviderOperation;
import androidx.annotation.NonNull;

import org.dmfs.android.contentpal.RowData;
import org.dmfs.android.contentpal.TransactionContext;
Expand All @@ -28,6 +27,8 @@
import org.dmfs.rfc5545.Duration;
import org.dmfs.tasks.contract.TaskContract;

import androidx.annotation.NonNull;


/**
* {@link RowData} for adding start, start+due, or start+duration times.
Expand Down Expand Up @@ -95,13 +96,7 @@ private static ContentProviderOperation.Builder doUpdateBuilder(DateTime start,
.withValue(TaskContract.Tasks.DTSTART, start.getTimestamp())
.withValue(TaskContract.Tasks.TZ, start.isAllDay() ? "UTC" : start.getTimeZone().getID())
.withValue(TaskContract.Tasks.IS_ALLDAY, start.isAllDay() ? 1 : 0)

.withValue(TaskContract.Tasks.DUE, due.isPresent() ? due.value().getTimestamp() : null)

.withValue(TaskContract.Tasks.DURATION, duration.isPresent() ? duration.value().toString() : null)

.withValue(TaskContract.Tasks.RDATE, null)
.withValue(TaskContract.Tasks.RRULE, null)
.withValue(TaskContract.Tasks.EXDATE, null);
.withValue(TaskContract.Tasks.DURATION, duration.isPresent() ? duration.value().toString() : null);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,8 @@ public void test_whenNoTimeZoneNotAllDay_setsValuesAccordingly_andNullsOtherTime
containing(Tasks.DUE, due.getTimestamp()),
containing(Tasks.TZ, "UTC"),
containing(Tasks.IS_ALLDAY, 0),

withNullValue(Tasks.DTSTART),

withNullValue(Tasks.DURATION),

withNullValue(Tasks.RDATE),
withNullValue(Tasks.RRULE),
withNullValue(Tasks.EXDATE)
withNullValue(Tasks.DURATION)
)));
}

Expand All @@ -76,14 +70,8 @@ public void test_whenHasTimeZoneNotAllDay_setsValuesAccordingly_andNullsOtherTim
containing(Tasks.DUE, due.getTimestamp()),
containing(Tasks.TZ, "GMT+04:00"),
containing(Tasks.IS_ALLDAY, 0),

withNullValue(Tasks.DTSTART),

withNullValue(Tasks.DURATION),

withNullValue(Tasks.RDATE),
withNullValue(Tasks.RRULE),
withNullValue(Tasks.EXDATE)
withNullValue(Tasks.DURATION)
)));
}

Expand All @@ -99,14 +87,8 @@ public void test_whenNoTimeZoneAndAllDay_setsValuesAccordingly_andNullsOtherTime
containing(Tasks.DUE, due.getTimestamp()),
containing(Tasks.TZ, "UTC"),
containing(Tasks.IS_ALLDAY, 1),

withNullValue(Tasks.DTSTART),

withNullValue(Tasks.DURATION),

withNullValue(Tasks.RDATE),
withNullValue(Tasks.RRULE),
withNullValue(Tasks.EXDATE)
withNullValue(Tasks.DURATION)
)));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,8 @@ public void test_whenStartAndDueAreProvided_setsThemAndNullsDuration()
containing(Tasks.DTSTART, start.getTimestamp()),
containing(Tasks.TZ, "UTC"),
containing(Tasks.IS_ALLDAY, 0),

containing(Tasks.DUE, due.getTimestamp()),

withNullValue(Tasks.DURATION),

withNullValue(Tasks.RDATE),
withNullValue(Tasks.RRULE),
withNullValue(Tasks.EXDATE)
withNullValue(Tasks.DURATION)
)));
}

Expand All @@ -82,14 +76,8 @@ public void test_whenStartAndDurationAreProvided_setsThemAndNullsDue()
containing(Tasks.DTSTART, start.getTimestamp()),
containing(Tasks.TZ, "UTC"),
containing(Tasks.IS_ALLDAY, 0),

withNullValue(Tasks.DUE),

containing(Tasks.DURATION, duration.toString()),

withNullValue(Tasks.RDATE),
withNullValue(Tasks.RRULE),
withNullValue(Tasks.EXDATE)
containing(Tasks.DURATION, duration.toString())
)));
}

Expand All @@ -105,14 +93,8 @@ public void test_whenOnlyStartIsProvided_setsItAndNullsDueAndDuration()
containing(Tasks.DTSTART, start.getTimestamp()),
containing(Tasks.TZ, "UTC"),
containing(Tasks.IS_ALLDAY, 0),

withNullValue(Tasks.DUE),

withNullValue(Tasks.DURATION),

withNullValue(Tasks.RDATE),
withNullValue(Tasks.RRULE),
withNullValue(Tasks.EXDATE)
withNullValue(Tasks.DURATION)
)));
}

Expand Down Expand Up @@ -147,14 +129,8 @@ public void test_whenStartHasDifferentTimeZoneFromDue_shiftsStartsToDue()
containing(Tasks.DTSTART, startExpected.getTimestamp()),
containing(Tasks.TZ, "GMT+06:00"),
containing(Tasks.IS_ALLDAY, 0),

containing(Tasks.DUE, due.getTimestamp()),

withNullValue(Tasks.DURATION),

withNullValue(Tasks.RDATE),
withNullValue(Tasks.RRULE),
withNullValue(Tasks.EXDATE)
withNullValue(Tasks.DURATION)
)));
}

Expand All @@ -171,14 +147,8 @@ public void test_whenStartHasAllDayFlag_correspondingValueIsOne()
containing(Tasks.DTSTART, start.getTimestamp()),
containing(Tasks.TZ, "UTC"),
containing(Tasks.IS_ALLDAY, 1),

containing(Tasks.DUE, due.getTimestamp()),

withNullValue(Tasks.DURATION),

withNullValue(Tasks.RDATE),
withNullValue(Tasks.RRULE),
withNullValue(Tasks.EXDATE)
withNullValue(Tasks.DURATION)
)));
}
}