# new InvestigationSortingHelper()
Methods
# applyGrouping(data, group, sortConfig) → {object}
Applies grouping to investigation data
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
data |
object
|
Data containing items or sections |
|
items |
Array.<IInvestigationListItemDto>
|
<optional> |
Optional items array |
sections |
Array.<IInvestigationSection>
|
<optional> |
Optional sections array |
group |
GroupType
|
The group type to apply |
|
sortConfig |
IInvestigationSearchDto
|
Search configuration with sort options |
Data with grouping applied
object
# buildAuthorSections(items, sortConfig, currentUserIdopt) → {Array.<IInvestigationSection>}
Builds sections grouped by author with current user first
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
items |
Array.<IInvestigationListItemDto>
|
Array of items to group |
|
sortConfig |
IInvestigationSearchDto
|
Search configuration with sort options |
|
currentUserId |
string
|
<optional> |
Optional current user ID to prioritize |
Array of sections grouped by author
Array.<IInvestigationSection>
# buildCurriculumGradeSections(items, sortConfig) → {Array.<IInvestigationSection>}
Builds sections grouped by curriculum and grade
Parameters:
| Name | Type | Description |
|---|---|---|
items |
Array.<IInvestigationListItemDto>
|
Array of items to group |
sortConfig |
IInvestigationSearchDto
|
Search configuration with sort options |
Array of sections grouped by curriculum and grade
Array.<IInvestigationSection>
# buildCurriculumStatusSections(items, sortConfig) → {Array.<IInvestigationSection>}
Builds sections grouped by curriculum and status
Parameters:
| Name | Type | Description |
|---|---|---|
items |
Array.<IInvestigationListItemDto>
|
Array of items to group |
sortConfig |
IInvestigationSearchDto
|
Search configuration with sort options |
Array of sections grouped by curriculum and status
Array.<IInvestigationSection>
# buildGradeSections(items, sortConfig) → {Array.<IInvestigationSection>}
Builds sections grouped by grade only
Parameters:
| Name | Type | Description |
|---|---|---|
items |
Array.<IInvestigationListItemDto>
|
Array of items to group |
sortConfig |
IInvestigationSearchDto
|
Search configuration with sort options |
Array of sections grouped by grade
Array.<IInvestigationSection>
# buildSections(items, section, sortConfig) → {Array.<IInvestigationSection>}
Builds sections based on section type
Parameters:
| Name | Type | Description |
|---|---|---|
items |
Array.<IInvestigationListItemDto>
|
Array of items to group into sections |
section |
SectionType
|
The section type |
sortConfig |
IInvestigationSearchDto
|
Search configuration with sort options |
Array of sections
Array.<IInvestigationSection>
# compareGrades(a, b) → {number}
Compares two grades for sorting
Parameters:
| Name | Type | Description |
|---|---|---|
a |
string
|
First grade to compare |
b |
string
|
Second grade to compare |
Comparison result
number
# compareUnitGrades(gradeA, gradeB) → {number}
Compares two unit grades
Parameters:
| Name | Type | Description |
|---|---|---|
gradeA |
string
|
First grade to compare |
gradeB |
string
|
Second grade to compare |
Comparison result
number
# extractUnitIdentifier(unitStr) → {string|null}
Extracts unit identifier: "Unit 4.1: Title" → "4.1"
Parameters:
| Name | Type | Description |
|---|---|---|
unitStr |
string
|
null
|
undefined
|
The unit string to parse |
The unit identifier or null
string
|
null
# formatStatusDisplay(status) → {string}
Formats status for display
Parameters:
| Name | Type | Description |
|---|---|---|
status |
string
|
The status code |
Human-readable status string
string
# getSubjectOrder() → {Record.<string, number>}
Returns subject ordering map
Map of subject names to sort order
Record.<string, number>
# getSurnameFromName(name) → {string}
Extracts surname from full name
Parameters:
| Name | Type | Description |
|---|---|---|
name |
string
|
null
|
The full name |
The surname or empty string
string
# getUnitGradeSortType(grade) → {number}
Gets sort type for unit grade: 0=K, 1=numeric, 2=other, 3=empty
Parameters:
| Name | Type | Description |
|---|---|---|
grade |
string
|
The grade string |
The sort type number
number
# gradeToSortValue(grade) → {number}
Converts grade to a sortable numeric value. Order: K=0, 1-12=1-12, P=13, B=14, C=15, other=99, empty=999
Parameters:
| Name | Type | Description |
|---|---|---|
grade |
string
|
null
|
undefined
|
The grade string |
Numeric sort value
number
# parseUnitGrade(unitStr) → {string}
Extracts grade from unit string: "Unit 4.1: Title" → "4"
Parameters:
| Name | Type | Description |
|---|---|---|
unitStr |
string
|
null
|
undefined
|
The unit string to parse |
The grade string or empty string
string
# parseUnitNumber(unitStr) → {number}
Parses unit number from unit string
Parameters:
| Name | Type | Description |
|---|---|---|
unitStr |
string
|
null
|
undefined
|
The unit string to parse |
The unit number or 999 if not found
number
# sortAuthorProfiles(profiles, currentUserIdopt) → {Array.<T>}
Sorts author profiles: current user first, then by surname A→Z
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
profiles |
Array.<T>
|
Array of profiles to sort |
|
currentUserId |
string
|
<optional> |
Optional current user ID to prioritize |
Sorted array of profiles
Array.<T>
# sortInvestigationItems(items, searchDto) → {Array.<IInvestigationListItemDto>}
Sorts investigation items based on search criteria
Parameters:
| Name | Type | Description |
|---|---|---|
items |
Array.<IInvestigationListItemDto>
|
Array of items to sort |
searchDto |
IInvestigationSearchDto
|
Search configuration with sort options |
Sorted array of items
Array.<IInvestigationListItemDto>