This commit is contained in:
Ruidy Nemausat 2020-02-09 10:28:57 +01:00
parent ebd3679651
commit 4428762398
2 changed files with 5 additions and 2 deletions

View file

@ -32,7 +32,10 @@ namespace TicketManager.Controllers
[HttpGet("{id}")] [HttpGet("{id}")]
public async Task<ActionResult<Project>> GetProject(int id) public async Task<ActionResult<Project>> GetProject(int id)
{ {
var project = await _context.Projects.FindAsync(id); var project = await _context.Projects
.Include(p => p.Assignments)
.FirstOrDefaultAsync(p => p.Id == id);
// .FindAsync(id);
if (project == null) if (project == null)
{ return NotFound(); } { return NotFound(); }

View file

@ -15,7 +15,7 @@ namespace TicketManager.Models
{ {
get get
{ {
return (float)this.Tickets. return Tickets.Count() == 0 ? 0 : (float)this.Tickets.
Where(t => t.Status == Status.Done).Count() Where(t => t.Status == Status.Done).Count()
/ this.Tickets.Count() / this.Tickets.Count()
* 100; * 100;