in src/Covi/Features/UserProfile/Components/UserStatusCard/UserStatusCardViewModel.cs [56:89]
private async void SetProfile(UserState profile)
{
if (profile != null)
{
var metadata = await _metadataContainer.GetAsync();
if (metadata != null)
{
_profile = profile;
UserName = _profile.Username;
var status = metadata.Statuses.Values.FirstOrDefault(x => x.Id == _profile.StatusId);
if (status != null)
{
Severity = status.Severity != null && Enum.IsDefined(typeof(Severity), status.Severity)
? (Severity)status.Severity
: Severity.NotRecognized;
HealthStatus = status.Name;
if (_profile.StatusChangedOn.HasValue)
{
var daysOfStatus =
Math.Round((DateTimeOffset.UtcNow - _profile.StatusChangedOn.Value).TotalDays);
StatusCountdown = string.Format(
Resources.Localization.UserStatus_StatusCountdown_TextFormat,
HealthStatus, daysOfStatus);
}
}
else
{
StatusCountdown = string.Empty;
HealthStatus = string.Empty;
}
}
}
}