public void UpdateProgressReportToReflectSubmission(string guid) { var reports = _progressReportCache.GetReport(guid); if (IsFirstTimeSubmission(guid, reports)) { // First time submission _progressReportCache.AddProgressReport(guid, _progressReportModelManager.BuildTemplateProgressReport(guid)); } else { reports.ToList().Find(x => x.Schema == _userJustCompletedStepCache.GetSchema(guid)).SetFirstStepToCompletedAndSecondToInProgress(); _progressReportCache.AddProgressReports(guid, reports.ToHashSet()); } }
public SiccarStatusCacheResponse BuildSiccarStatusCacheResponseForUser(string userId) { var responses = new List <SiccarStatusCacheProcessResponse>(); var schemas = _processSchemaCache.GetSchemas(userId); foreach (var schema in schemas) { var attributes = new List <KeyValuePair <string, string> >(); // The first tx is actually the last the way the results from the server var authorisedTransaction = schema.stepStatuses[0].stepTransactionId; if (authorisedTransaction != null) { var fatributes = _siccarTransactionCache.GetTransaction(authorisedTransaction).Attributes; attributes.AddRange(fatributes); // Only add the last transactions if the first ones have been added var userApplicationTransaction = schema.stepStatuses[schema.stepStatuses.Count - 1].stepTransactionId; if (userApplicationTransaction != null) { var uatributes = _siccarTransactionCache.GetTransaction(userApplicationTransaction).Attributes; attributes.AddRange(uatributes); } } var status = GetStatusOfProcess(schema, userId); var atrs = attributes.ToHashSet().ToList(); var schemaId = schema.schemaId; var statusCacheResponse = new SiccarStatusCacheProcessResponse(schemaId, status, atrs); responses.Add(statusCacheResponse); } var response = new SiccarStatusCacheResponse() { ProgressReports = _progressReportCache.GetReport(userId), ProcessResponses = responses.ToHashSet() }; return(response); }