Commit ac56014b authored by nanahira's avatar nanahira

fix again random cloud replay

parent 3aa26a21
......@@ -101,10 +101,11 @@ export class DataManager {
.from(CloudReplay, "replay")
.getRawOne()
));
if(!minQuery || maxQuery) {
if(!minQuery || !maxQuery) {
return null;
}
const targetId = Math.floor((maxQuery.value - minQuery.value) * Math.random()) + minQuery.value;
const [maxId, minId] = [minQuery, maxQuery].map(query => parseInt(query.value));
const targetId = Math.floor((maxId - minId) * Math.random()) + minId;
return await this.db.createQueryBuilder(CloudReplay, "replay")
.where("replay.id >= :targetId", {targetId})
.orderBy("replay.id", "ASC")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment