Skip to content

Commit 67a6a9f

Browse files
Update plan service
1 parent 2d927ad commit 67a6a9f

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

DocuSign.Workspaces/DocuSign.Workspaces/Domain/CarePlans/CarePlansService.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,19 @@ public async Task<List<PhysicianModel>> GetPhysician()
2020
var workspaces = await docuSignApiProvider.Workspace2.GetWorkspacesAsync(accountRepository.AccountId);
2121
if (workspaces.Workspaces != null || workspaces.Workspaces?.Count != 0)
2222
{
23-
var physician = workspaces.Workspaces
24-
?.Where(a => physicians.Contains(a.Name + " Workspace"))
23+
var createdPhysician = workspaces.Workspaces
24+
?.Where(w =>
25+
!string.IsNullOrWhiteSpace(w.Name) &&
26+
physicians.Any(p => w.Name.StartsWith(p + " Workspace", StringComparison.OrdinalIgnoreCase)))
2527
.Select(a => new PhysicianModel
2628
{
2729
Name = a.Name,
2830
WorkspaceId = a.WorkspaceId
2931
}).ToList();
3032

31-
if (physician?.Count == physicians.Count)
33+
if (createdPhysician?.Count >= physicians.Count)
3234
{
33-
return physician;
35+
return createdPhysician.DistinctBy(a => a.Name).ToList();
3436
}
3537
}
3638

0 commit comments

Comments
 (0)