Base maximum freeslotId off max of id (in name) and id

develop
Thomas Lynch 1 year ago
parent 4247d6c9ac
commit b57015937f
  1. 5
      controllers/maps.js

@ -250,7 +250,10 @@ exports.patchMapForm = async (req, res, next) => {
const serverIds = servers
.map(s => parseInt(s.id))
.sort((a, b) => a-b);
return serverIds[serverIds.length-1]+1;
const serverNameIds = servers
.map(s => parseInt(s.name.substr(6)))
.sort((a, b) => a-b);
return Math.max(serverIds[serverIds.length-1], serverNameIds[serverNameIds.length-1])+1;
}
return 1;
});

Loading…
Cancel
Save