File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -152,7 +152,10 @@ func (db *DB) PrePlannedRooms(ctx context.Context) ([]*model.PrePlannedRoom, err
152152func (db * DB ) PrePlannedRoomsForExam (ctx context.Context , ancode int ) ([]* model.PrePlannedRoom , error ) {
153153 collection := db .getCollectionSemester (collectionRoomsPrePlanned )
154154
155- cur , err := collection .Find (ctx , bson.M {"ancode" : ancode })
155+ findOptions := options .Find ()
156+ findOptions .SetSort (bson.D {{Key : "roomname" , Value : 1 }})
157+
158+ cur , err := collection .Find (ctx , bson.M {"ancode" : ancode }, findOptions )
156159 if err != nil {
157160 log .Error ().Err (err ).Str ("collection" , collectionRoomsPrePlanned ).Msg ("MongoDB Find" )
158161 return nil , err
@@ -283,7 +286,10 @@ func (db *DB) PlannedRoomsForAncode(ctx context.Context, ancode int) ([]*model.P
283286
284287 filter := bson.M {"ancode" : ancode }
285288
286- cur , err := collection .Find (ctx , filter )
289+ findOptions := options .Find ()
290+ findOptions .SetSort (bson.D {{Key : "roomname" , Value : 1 }})
291+
292+ cur , err := collection .Find (ctx , filter , findOptions )
287293 if err != nil {
288294 log .Error ().Err (err ).Int ("ancode" , ancode ).Msg ("cannot find rooms for ancode" )
289295 return nil , err
You can’t perform that action at this time.
0 commit comments