Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use deepEqual to check if All couses are selected. Issue #6799 #6841

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

chtelmko
Copy link
Member

Issue #6799
need to find out how to compare all of the courses from the database. how they are stored.

@chtelmko chtelmko added the WIP label Jul 16, 2020
Copy link
Member

@paulbert paulbert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chtelmko See my comments, thanks!

@@ -65,7 +70,6 @@ export class CertificationsAddComponent implements OnInit, AfterViewChecked {
this.cdRef.detectChanges();
}
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please put this line back in and be careful to not remove lines.

@@ -49,6 +51,9 @@ export class CertificationsAddComponent implements OnInit, AfterViewChecked {
this.certificateForm.patchValue(certification);
this.certificateInfo._rev = certification._rev;
this.courseIds = certification.courseIds || [];
// here find out all courses in the system. compare all courses ids with this.coursesIds
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CoursesComponent already fetches all of the course system so all courses are available in this.coursesTable.dataTable.data

@@ -49,6 +51,9 @@ export class CertificationsAddComponent implements OnInit, AfterViewChecked {
this.certificateForm.patchValue(certification);
this.certificateInfo._rev = certification._rev;
this.courseIds = certification.courseIds || [];
// here find out all courses in the system. compare all courses ids with this.coursesIds
const allCourseIds = []; // find out hhow to get values for this array.
this.enableAddCourses = deepEqual(allCourseIds, this.courseIds );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is an extra space before the last parenthesis that should be removed.

Copy link
Member Author

@chtelmko chtelmko Jul 20, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am having a problem with my code, where the value of "hasAllData" variable is always "undefined" and the "if" statement does not get executed(line 62-65).

After debugging I noticed that

  1. this.courseTable does not have a dataTable.data property ( used this.courseTable.courses.data, instead)
  2. The first time you click on a course and click the edit button, the this.courseTable.courses.data is undefined. If you return back to certificate list and click on the same course again, this.courseTable.courses.data has 23 entries.
  3. The this.courseTable.courses.data must be local database data, feel like there should be more than 23 entries.
    not sure how to go forward, what to try next to fix this issue. Any help would be appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants