Skip to content
This repository has been archived by the owner on Feb 19, 2021. It is now read-only.

Commit

Permalink
Disable shared flg
Browse files Browse the repository at this point in the history
  • Loading branch information
kuramochia committed Jul 12, 2020
1 parent 6b3ef73 commit 4c4aca3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 14 deletions.
1 change: 0 additions & 1 deletion Covid19Radar/Covid19Radar/Model/PositiveDiagnosisState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@ public class PositiveDiagnosisState

public DateTimeOffset DiagnosisDate { get; set; }

public bool Shared { get; set; }
}
}
9 changes: 1 addition & 8 deletions Covid19Radar/Covid19Radar/Model/UserDataModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public void AddDiagnosis(string diagnosisUid, DateTimeOffset submissionDate)
return;

// Remove ones that were not submitted as the new one is better
PositiveDiagnoses.RemoveAll(d => !d.Shared);
PositiveDiagnoses.Clear();

PositiveDiagnoses.Add(new PositiveDiagnosisState
{
Expand All @@ -128,13 +128,6 @@ public void ClearDiagnosis()

public PositiveDiagnosisState LatestDiagnosis
=> PositiveDiagnoses
.Where(d => d.Shared)
.OrderByDescending(p => p.DiagnosisDate)
.FirstOrDefault();

public PositiveDiagnosisState PendingDiagnosis
=> PositiveDiagnoses
.Where(d => !d.Shared)
.OrderByDescending(p => p.DiagnosisDate)
.FirstOrDefault();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,14 +222,14 @@ public async Task FetchExposureKeyBatchFilesFromServerAsync(Func<IEnumerable<str
// this will be called when the user is submitting a diagnosis and the local keys need to go to the server
public async Task UploadSelfExposureKeysToServerAsync(IEnumerable<TemporaryExposureKey> temporaryExposureKeys)
{
var pendingDiagnosis = userData.PendingDiagnosis;
var latestDiagnosis = userData.LatestDiagnosis;

if (pendingDiagnosis == null || string.IsNullOrEmpty(pendingDiagnosis.DiagnosisUid))
if (latestDiagnosis == null || string.IsNullOrEmpty(latestDiagnosis.DiagnosisUid))
{
throw new InvalidOperationException();
}

var selfDiag = await CreateSubmissionAsync(temporaryExposureKeys, pendingDiagnosis);
var selfDiag = await CreateSubmissionAsync(temporaryExposureKeys, latestDiagnosis);

HttpStatusCode httpStatusCode = await httpDataService.PutSelfExposureKeysAsync(selfDiag);
if (httpStatusCode == HttpStatusCode.NotAcceptable)
Expand All @@ -256,8 +256,6 @@ await UserDialogs.Instance.AlertAsync(
Resources.AppResources.ButtonOk);
throw new InvalidOperationException();
}
// Update pending status
pendingDiagnosis.Shared = true;
await userDataService.SetAsync(userData);
}

Expand Down

0 comments on commit 4c4aca3

Please sign in to comment.