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
[#9510] Instructor: Course Page/Student List Component: Implement sorting for table headers #9624
Closed
pbrahmbhatt3
wants to merge
17
commits into
TEAMMATES:master
from
pbrahmbhatt3:issue9510-implement-sorting-of-entries
Closed
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
4067504
sorted data in course list table (instructor-courses-page.component.ts)
e6915bd
added sort feature to course page
e20da23
added sort by feature for archieve and delete tables
9d08c63
Merge branch 'master' of https://github.com/TEAMMATES/teammates into …
9639723
updated the sortByCreationDate to sort softDeleteCourses
9ded489
solved build error by removing undeclared var from html file
67f8798
solved error by removing all undeclared variables from html file
4a6b97a
Merge branch 'master' of https://github.com/TEAMMATES/teammates into …
0e1fb5c
updated sorting for sort by id
eba7b7e
updated local with recent changes
9f64ae1
Merge branch 'master' of https://github.com/TEAMMATES/teammates into …
2fdaad2
updated instructor-course-page.component.ts with proper spacing
714e417
Saving my current work
26f84dd
added sort functionality again with passing lint tests
e97cd76
removed undefined courseTabModels
9aaf278
did npm run test
3d96989
added sorting functionality for archived courses
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,9 +50,9 @@ | |
}, | ||
"devDependencies": { | ||
"@angular-builders/jest": "~7.1.2", | ||
"@angular-devkit/build-angular": "~0.11.4", | ||
"@angular-devkit/build-angular": "^0.13.7", | ||
"@angular/cli": "~7.1.4", | ||
"@angular/compiler-cli": "~7.1.4", | ||
"@angular/compiler-cli": "^7.2.11", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Revert this too |
||
"@angular/language-service": "~7.1.4", | ||
"@types/node": "~8.9.4", | ||
"codelyzer": "~4.5.0", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -223,6 +223,84 @@ export class InstructorCoursesPageComponent implements OnInit { | |
}, () => {}); | ||
} | ||
|
||
/** | ||
* Sorts the panels of courses in order. | ||
*/ | ||
sortPanelsBy(by: string): | ||
((a: ActiveCourse, b: ActiveCourse) => number) { | ||
return ((a: ActiveCourse, b: ActiveCourse): number => { | ||
let strA: string; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These variables name don't seem to be intuitive. Perhaps use a more relatable name? |
||
let strB: string; | ||
const name: string = 'name'; | ||
const id: string = 'id'; | ||
const createdAt: string = 'createdAt'; | ||
switch (by) { | ||
case name: | ||
strA = a.name; | ||
strB = b.name; | ||
break; | ||
case id: | ||
strA = a.id; | ||
strB = b.id; | ||
break; | ||
case createdAt: | ||
strA = a.createdAt; | ||
strB = b.createdAt; | ||
break; | ||
default: | ||
strA = ''; | ||
strB = ''; | ||
} | ||
return strA.localeCompare(strB); | ||
}); | ||
} | ||
|
||
/** | ||
* Sorts the panels of courses in order. | ||
*/ | ||
sortArchivedPanelsBy(by: string): | ||
((a: ArchivedCourse, b: ArchivedCourse) => number) { | ||
return ((a: ArchivedCourse, b: ArchivedCourse): number => { | ||
let strA: string; | ||
let strB: string; | ||
const name: string = 'name'; | ||
const id: string = 'id'; | ||
const createdAt: string = 'createdAt'; | ||
switch (by) { | ||
case name: | ||
strA = a.name; | ||
strB = b.name; | ||
break; | ||
case id: | ||
strA = a.id; | ||
strB = b.id; | ||
break; | ||
case createdAt: | ||
strA = a.createdAt; | ||
strB = b.createdAt; | ||
break; | ||
default: | ||
strA = ''; | ||
strB = ''; | ||
} | ||
return strA.localeCompare(strB); | ||
}); | ||
} | ||
|
||
/** | ||
* Sorts the courses according to selected option. | ||
*/ | ||
sortCoursesBy(by: string): void { | ||
this.activeCourses.sort(this.sortPanelsBy(by)); | ||
} | ||
|
||
/** | ||
* Sorts the courses according to selected option. | ||
*/ | ||
sortArchivedCoursesBy(by: string): void { | ||
this.archivedCourses.sort(this.sortArchivedPanelsBy(by)); | ||
} | ||
|
||
/** | ||
* Restores a soft-deleted course from Recycle Bin. | ||
*/ | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Revert this unrelated change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, don't forget to revert these changes