From 960aeaac99c367523f458eaaad9bef64c2863be9 Mon Sep 17 00:00:00 2001
From: "jvanboxtel@wisc.edu" <jvanboxtel@wisc.edu>
Date: Thu, 22 Aug 2019 13:26:36 -0500
Subject: [PATCH] ROENROLL-1977 what if degree plan fix

---
 .../new-what-if-audit-dialog.component.ts     | 21 ++++++++++---------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/src/app/dars/new-what-if-audit-dialog/new-what-if-audit-dialog.component.ts b/src/app/dars/new-what-if-audit-dialog/new-what-if-audit-dialog.component.ts
index 59b755e..2a301a8 100644
--- a/src/app/dars/new-what-if-audit-dialog/new-what-if-audit-dialog.component.ts
+++ b/src/app/dars/new-what-if-audit-dialog/new-what-if-audit-dialog.component.ts
@@ -256,8 +256,14 @@ export class NewWhatIfAuditDialogComponent implements OnInit {
 
   public degreePlannerPlanName<T>(fallback: T): string | T {
     const control = this.chosenAuditSettings.get('degreePlan');
-    if (control && control.value !== null) {
-      return control.value.name;
+    const coursesControl = this.chosenAuditSettings.get('includeCoursesFrom');
+
+    if (coursesControl && coursesControl.value === 'planned') {
+      if (control && control.value !== null) {
+        return control.value.name;
+      } else {
+        return fallback;
+      }
     } else {
       return fallback;
     }
@@ -274,14 +280,9 @@ export class NewWhatIfAuditDialogComponent implements OnInit {
 
   // If a degree plan name is included in the request we do not need this property
   public includeCoursesFrom<T>(fallback: T): string | T {
-    const controlDegreePlan = this.chosenAuditSettings.get('degreePlan');
-    if (controlDegreePlan && controlDegreePlan.status === 'DISABLED') {
-      const control = this.chosenAuditSettings.get('includeCoursesFrom');
-      if (control !== null) {
-        return control.value.toString();
-      } else {
-        return fallback;
-      }
+    const control = this.chosenAuditSettings.get('includeCoursesFrom');
+    if (control && control.value !== 'planned') {
+      return control.value.toString();
     } else {
       return fallback;
     }
-- 
GitLab