Commit fdbfcdbf authored by Marcel Nellesen's avatar Marcel Nellesen
Browse files

Fixed small error in the quota calculation (coscine/issues#1308)

parent eca4920d
......@@ -378,11 +378,9 @@ namespace Coscine.Api.Project.Controllers
return BadRequest($"Cannot set quota ({updateProjectQuotaObject.Allocated}) below the used value ({used}).");
}
var projectQuotaForAll = _projectQuotaModel.GetAllWhere(x => x.ProjectId == projectGuid).Sum(x => x.Quota);
if(projectQuotaForAll - projectQuotaForCurrent.Quota + updateProjectQuotaObject.Allocated > _maxAvailable)
if(updateProjectQuotaObject.Allocated > _maxAvailable)
{
return BadRequest($"Cannot set quota to {updateProjectQuotaObject.Allocated}. In combination with the other quotas ({projectQuotaForAll - projectQuotaForCurrent.Quota}), it would exceed the limit of {_maxAvailable}");
return BadRequest($"Cannot set quota to {updateProjectQuotaObject.Allocated}. It would exceed the limit of {_maxAvailable}");
}
projectQuotaForCurrent.Quota = updateProjectQuotaObject.Allocated;
......
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