Skip to content
This repository has been archived by the owner on Aug 18, 2024. It is now read-only.

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
hayato24s committed Mar 8, 2024
1 parent 84da2f9 commit 14cc90a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions module/timetable/repository/search.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package timetablerepository

import (
"context"
"sort"
"strings"
"sync"
"time"
Expand Down Expand Up @@ -66,6 +67,11 @@ func (r *impl) SearchCourses(ctx context.Context, conds timetableport.SearchCour
})
}

// Sort by code
sort.Slice(courses, func(i, j int) bool {
return courses[i].Code.String() < courses[j].Code.String()
})

// Apply offset
courses = courses[lo.Clamp(conds.Offset, 0, len(courses)):]

Expand Down

0 comments on commit 14cc90a

Please sign in to comment.