mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-08-09 05:18:47 +00:00
Fix infinite loop for newest slots
This commit is contained in:
parent
88e77e1c73
commit
741ef15714
1 changed files with 5 additions and 5 deletions
|
@ -41,16 +41,16 @@ namespace LBPUnion.ProjectLighthouse.Controllers {
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("slots")]
|
[HttpGet("slots")]
|
||||||
public IActionResult NewestSlots([FromQuery] int pageStart, [FromQuery] int pageSize) {
|
public async Task<IActionResult> NewestSlots([FromQuery] int pageStart, [FromQuery] int pageSize) {
|
||||||
string response = Enumerable.Aggregate(this.database.Slots
|
IQueryable<Slot> slots = this.database.Slots
|
||||||
.Include(s => s.Creator)
|
.Include(s => s.Creator)
|
||||||
.Include(s => s.Location)
|
.Include(s => s.Location)
|
||||||
.OrderBy(s => s.FirstUploaded)
|
.OrderBy(s => s.FirstUploaded)
|
||||||
.Skip(pageStart - 1)
|
.Skip(pageStart - 1)
|
||||||
.Take(Math.Min(pageSize, 30))
|
.Take(Math.Min(pageSize, 30));
|
||||||
, string.Empty, (current, slot) => current + slot.Serialize());
|
string response = Enumerable.Aggregate(slots, string.Empty, (current, slot) => current + slot.Serialize());
|
||||||
|
|
||||||
return this.Ok(LbpSerializer.TaggedStringElement("slots", response, "total", 1));
|
return this.Ok(LbpSerializer.TaggedStringElement("slots", response, "hint_start", pageStart + Math.Min(pageSize, 30)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue