Skip to content

Commit

Permalink
Merge pull request #1404 from cisagov/feature/ACET-252
Browse files Browse the repository at this point in the history
  • Loading branch information
jekuipers authored Apr 16, 2021
2 parents 6cd7b01 + 0925438 commit 12123eb
Showing 1 changed file with 29 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -284,15 +284,38 @@ public Stream ArchiveStream(int assessmentId)
{
foreach (var standard in model.jAVAILABLE_STANDARDS)
{
if (!standard.Selected)
{
continue;
}

var set = context.SETS
.Include(s => s.NEW_QUESTION)
.Include(s => s.NEW_REQUIREMENT)
.ThenInclude(s => s.REQUIREMENT_LEVELS)
.Include(s => s.Set_Category_)
.FirstOrDefault(s => s.Set_Name == standard.Set_Name && standard.Selected);

.Where(s => s.Set_Name == standard.Set_Name).FirstOrDefault();
if (set == null || !set.Is_Custom)
{
continue;
}


var qq = from nq in context.NEW_QUESTION
join nqs in context.NEW_QUESTION_SETS on nq.Question_Id equals nqs.Question_Id
where nqs.Set_Name == standard.Set_Name
select nq;

var questions = qq.ToList();
set.NEW_QUESTION = new List<NEW_QUESTION>(questions);


var rq = context.REQUIREMENT_SETS
.Include(s => s.Requirement_)
.ThenInclude(s => s.REQUIREMENT_LEVELS)
.Where(s => s.Set_Name == standard.Set_Name)
.Select(s => s.Requirement_);

set.NEW_REQUIREMENT = new List<NEW_REQUIREMENT>(rq.ToList());



var extStandard = set.ToExternalStandard();
var setname = Regex.Replace(extStandard.ShortName, @"\W", "_");
Expand All @@ -315,7 +338,7 @@ public Stream ArchiveStream(int assessmentId)
t.Custom_Question_Guid = new Guid(new MD5CryptoServiceProvider().ComputeHash(buffer)).ToString();
}
return t;
}).Concat(model.jANSWER.Where(s => !s.Is_Requirement).GroupJoin(set.NEW_QUESTION, s => s.Question_Or_Requirement_Id, s => s.Question_Id, (t, s) =>
}).Concat(model.jANSWER.Where(s => !s.Is_Requirement).GroupJoin(questions, s => s.Question_Or_Requirement_Id, s => s.Question_Id, (t, s) =>
{
var req = s.FirstOrDefault();
if (req != null)
Expand Down

0 comments on commit 12123eb

Please sign in to comment.