Methods
# applyGrouping(data, group, sortConfig) → {object}
Applies grouping to investigation data
Parameters:
| Name | Type | Description |
|---|---|---|
data |
object
|
Data containing items or sections |
items |
Array.<IInvestigationListItemDto>
|
Optional flat list of investigation items |
sections |
Array.<IInvestigationSection>
|
Optional sections with items |
group |
GroupType
|
Type of grouping to apply |
sortConfig |
IInvestigationSearchDto
|
Sort configuration |
Grouped data with sections or subsections
object
# applyGroupingToSection(section, group, sortConfig) → {IInvestigationSection}
Applies grouping to a section by converting items to subsections
Parameters:
| Name | Type | Description |
|---|---|---|
section |
IInvestigationSection
|
Section to group |
group |
GroupType
|
Type of grouping |
sortConfig |
IInvestigationSearchDto
|
Sort configuration |
Section with grouped subsections
IInvestigationSection
# applyGroupingToSubsection(subsection, group, sortConfig) → {IInvestigationSubsection}
Applies grouping to a subsection by converting items to groups
Parameters:
| Name | Type | Description |
|---|---|---|
subsection |
IInvestigationSubsection
|
Subsection to group |
group |
GroupType
|
Type of grouping |
sortConfig |
IInvestigationSearchDto
|
Sort configuration |
Subsection with grouped items
IInvestigationSubsection
# buildAuthorSections(items, sortConfig, currentUserId) → {Array.<IInvestigationSection>}
Builds sections grouped by author with current user first
Parameters:
| Name | Type | Description |
|---|---|---|
items |
Array.<IInvestigationListItemDto>
|
Array of investigation items |
sortConfig |
IInvestigationSearchDto
|
Sort configuration |
currentUserId |
string
|
Optional ID of the current user |
Array of sections organized by author
Array.<IInvestigationSection>
# buildCurriculumGradeSections(items, sortConfig) → {Array.<IInvestigationSection>}
Builds sections grouped by curriculum and grade Headers look like "OpenSciEd, Grade 1", "Generic, Grade 8" Sorted a→z by curricula, inside 1→12 by grade
Parameters:
| Name | Type | Description |
|---|---|---|
items |
Array.<IInvestigationListItemDto>
|
Array of investigation items |
sortConfig |
IInvestigationSearchDto
|
Sort configuration |
Array of sections grouped by curriculum+grade combination
Array.<IInvestigationSection>
# buildCurriculumStatusSections(items, sortConfig) → {Array.<IInvestigationSection>}
Builds sections grouped by curriculum and status Sorted a→z by curricula, inside alphabetically by status
Parameters:
| Name | Type | Description |
|---|---|---|
items |
Array.<IInvestigationListItemDto>
|
Array of investigation items |
sortConfig |
IInvestigationSearchDto
|
Sort configuration |
Array of sections grouped by curriculum+status combination
Array.<IInvestigationSection>
# buildGradeSections(items, sortConfig) → {Array.<IInvestigationSection>}
Builds sections grouped by grade
Parameters:
| Name | Type | Description |
|---|---|---|
items |
Array.<IInvestigationListItemDto>
|
Array of investigation items |
sortConfig |
IInvestigationSearchDto
|
Sort configuration |
Array of sections organized by grade
Array.<IInvestigationSection>
# buildSections(items, section, sortConfig) → {Array.<IInvestigationSection>}
Builds sections based on the specified section type
Parameters:
| Name | Type | Description |
|---|---|---|
items |
Array.<IInvestigationListItemDto>
|
Array of investigation items |
section |
SectionType
|
Type of section to build |
sortConfig |
IInvestigationSearchDto
|
Sort configuration |
Array of investigation sections
Array.<IInvestigationSection>
# formatStatusDisplay(status) → {string}
Formats investigation status for display
Parameters:
| Name | Type | Description |
|---|---|---|
status |
string
|
Raw status string |
Human-readable status text
string
# getSubjectOrder() → {SubjectOrderMap}
Returns predefined ordering for science subjects Based on the unique values from subjectsFactory TypeScript will error if any subject from subjectsFactory is missing
Object mapping subject names to their sort order
SubjectOrderMap
# getSurnameFromName(name) → {string}
Extracts the surname from a full name
Parameters:
| Name | Type | Description |
|---|---|---|
name |
string
|
null
|
Full name string |
Surname (last word in the name)
string
# groupBySubjects(items, sortConfig) → {Array.<IInvestigationSection>}
Groups items by subject into sections
Parameters:
| Name | Type | Description |
|---|---|---|
items |
Array.<IInvestigationListItemDto>
|
Array of investigation items |
sortConfig |
IInvestigationSearchDto
|
Sort configuration |
Array of sections grouped by subject
Array.<IInvestigationSection>
# groupByUnits(items, sortConfig) → {Array.<IInvestigationSection>}
Groups items by unit into sections
Parameters:
| Name | Type | Description |
|---|---|---|
items |
Array.<IInvestigationListItemDto>
|
Array of investigation items |
sortConfig |
IInvestigationSearchDto
|
Sort configuration |
Array of sections grouped by unit
Array.<IInvestigationSection>
# groupByUnitsLessons(items, sortConfig) → {Array.<IInvestigationSection>}
Groups items by unit and lesson into sections
Parameters:
| Name | Type | Description |
|---|---|---|
items |
Array.<IInvestigationListItemDto>
|
Array of investigation items |
sortConfig |
IInvestigationSearchDto
|
Sort configuration |
Array of sections grouped by unit and lesson
Array.<IInvestigationSection>
# groupFlatItems(items, group, sortConfig) → {Array.<IInvestigationSection>}
Groups flat list of items into sections
Parameters:
| Name | Type | Description |
|---|---|---|
items |
Array.<IInvestigationListItemDto>
|
Array of investigation items |
group |
GroupType
|
Type of grouping |
sortConfig |
IInvestigationSearchDto
|
Sort configuration |
Array of sections
Array.<IInvestigationSection>
# groupItemsBySubjects(items, sortConfig) → {Array.<IInvestigationGroup>}
Groups items by subject into investigation groups
Parameters:
| Name | Type | Description |
|---|---|---|
items |
Array.<IInvestigationListItemDto>
|
Array of investigation items |
sortConfig |
IInvestigationSearchDto
|
Sort configuration |
Array of groups organized by subject
Array.<IInvestigationGroup>
# groupItemsByUnits(items, sortConfig) → {Array.<IInvestigationGroup>}
Groups items by unit into investigation groups
Parameters:
| Name | Type | Description |
|---|---|---|
items |
Array.<IInvestigationListItemDto>
|
Array of investigation items |
sortConfig |
IInvestigationSearchDto
|
Sort configuration |
Array of groups organized by unit
Array.<IInvestigationGroup>
# groupItemsByUnitsLessons(items, sortConfig) → {Array.<IInvestigationGroup>}
Groups items by unit and lesson into investigation groups
Parameters:
| Name | Type | Description |
|---|---|---|
items |
Array.<IInvestigationListItemDto>
|
Array of investigation items |
sortConfig |
IInvestigationSearchDto
|
Sort configuration |
Array of groups organized by unit and lesson
Array.<IInvestigationGroup>
# groupItemsToGroups(items, group, sortConfig) → {Array.<IInvestigationGroup>}
Groups items into investigation groups
Parameters:
| Name | Type | Description |
|---|---|---|
items |
Array.<IInvestigationListItemDto>
|
Array of investigation items |
group |
GroupType
|
Type of grouping |
sortConfig |
IInvestigationSearchDto
|
Sort configuration |
Array of investigation groups
Array.<IInvestigationGroup>
# parseGradeValue(gradeStr) → {number}
Parses grade string to numeric value for sorting
Parameters:
| Name | Type | Description |
|---|---|---|
gradeStr |
string
|
null
|
undefined
|
Grade string |
Numeric grade value
number
# parseUnitNumber(unitStr) → {number}
Parses unit number from unit string for sorting
Parameters:
| Name | Type | Description |
|---|---|---|
unitStr |
string
|
null
|
undefined
|
Unit string (e.g., "8.1: Weather", "K.2: Science") |
Unit number
number
# sortInvestigationItems(items, searchDto) → {Array.<IInvestigationListItemDto>}
Sorts investigation items based on search criteria Default: Date Modified (updatedAt), Earlier → Later can be reversed to Later → Earlier
Parameters:
| Name | Type | Description |
|---|---|---|
items |
Array.<IInvestigationListItemDto>
|
Array of investigation items to sort |
searchDto |
IInvestigationSearchDto
|
Search configuration containing sort field and order |
Sorted array of investigation items
Array.<IInvestigationListItemDto>