diff --git a/src/Services/MissionService.cs b/src/Services/MissionService.cs
index 2f26d30..a425425 100644
--- a/src/Services/MissionService.cs
+++ b/src/Services/MissionService.cs
@@ -219,8 +219,12 @@ public class MissionService {
Schema.Task? t = mission.Tasks.Find(x => x.TaskID == task.Id);
if (t != null) {
- if (task.Completed) t.Completed = 1;
- t.Payload = task.Payload;
+ if (task.Completed) {
+ t.Completed = 1;
+ t.Payload = task.Payload ?? "\r\n\r\n true\r\n";
+ } else {
+ t.Payload = task.Payload;
+ }
}
}
@@ -249,9 +253,14 @@ public class MissionService {
}
}
- private void SetTaskProgressDB(int missionId, int taskId, int userId, bool completed, string xmlPayload) {
+ private void SetTaskProgressDB(int missionId, int taskId, int userId, bool completed, string? xmlPayload) {
Model.TaskStatus? status = ctx.TaskStatuses.FirstOrDefault(task => task.Id == taskId && task.MissionId == missionId && task.VikingId == userId);
+ // Based on the observation that no payloads on completed missions are null
+ // This is the most common task payload, so if the mission is completed with this payload we can set the payload to null and let the server autofill
+ if (completed && xmlPayload == "\r\n\r\n true\r\n")
+ xmlPayload = null;
+
if (status is null) {
status = new Model.TaskStatus {
Id = taskId,