Skip to content

Commit e6d3eec

Browse files
committed
Fix challenges on report to exclude selections
1 parent c42d4c9 commit e6d3eec

3 files changed

Lines changed: 17 additions & 17 deletions

File tree

src/GRA.Controllers/MissionControl/ReportingController.cs

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -337,19 +337,16 @@ await _userService
337337
}
338338
}
339339

340-
if (viewModel.PastMaxPage)
341-
{
342-
return RedirectToAction(nameof(History), new
340+
return viewModel.PastMaxPage
341+
? RedirectToAction(nameof(History), new
343342
{
344343
endDate,
345344
page = viewModel.LastPage ?? 1,
346345
reportId,
347346
requestedBy,
348347
startDate
349-
});
350-
}
351-
352-
return View(viewModel);
348+
})
349+
: View(viewModel);
353350
}
354351

355352
[HttpGet]
@@ -383,19 +380,21 @@ public async Task<IActionResult> Run(ReportCriteriaViewModel viewModel)
383380

384381
var siteId = GetCurrentSiteId();
385382

386-
var challenges = viewModel.ChallengeRequiredList;
383+
var badgeReportList = viewModel.BadgeRequiredList;
384+
var challengeReportList = viewModel.ChallengeRequiredList;
387385

388-
if (viewModel.AllChallenges)
386+
if (viewModel.AllChallengesOnly)
389387
{
390388
var challengeIds = await _challengeService.GetAllIdsAsync(siteId);
391-
challenges = string.Join(',', challengeIds);
389+
challengeReportList = string.Join(',', challengeIds);
390+
badgeReportList = string.Empty;
392391
}
393392

394393
var criterion = new ReportCriterion
395394
{
396-
BadgeRequiredList = viewModel.BadgeRequiredList,
395+
BadgeRequiredList = badgeReportList,
397396
BranchId = viewModel.BranchId,
398-
ChallengeRequiredList = challenges,
397+
ChallengeRequiredList = challengeReportList,
399398
EndDate = viewModel.EndDate,
400399
GroupInfoId = viewModel.GroupInfoId,
401400
IncludeAchieverStatus = viewModel.IncludeAchieverStatus,

src/GRA.Controllers/ViewModel/MissionControl/Reporting/ReportCriteriaViewModel.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22
using System.Collections.Generic;
33
using System.ComponentModel;
4+
using System.ComponentModel.DataAnnotations;
45
using GRA.Domain.Model;
56
using Microsoft.AspNetCore.Mvc.Rendering;
67

@@ -14,7 +15,9 @@ public class ReportCriteriaViewModel
1415
public int? BranchId { get; set; }
1516

1617
public SelectList BranchList { get; set; }
17-
public bool AllChallenges { get; set; }
18+
19+
[Display(Name = "Report on all Challenges only")]
20+
public bool AllChallengesOnly { get; set; }
1821
public string ChallengeRequiredList { get; set; }
1922

2023
[DisplayName("End Date")]

src/GRA.Web/Areas/MissionControl/Views/Reporting/BadgeCriteria.cshtml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,12 +120,10 @@
120120

121121
<div class="row mt-4">
122122
<div class="col-12 lead">
123-
<input asp-for="AllChallenges"
123+
<input asp-for="AllChallengesOnly"
124124
class="form-check-input me-1"
125125
type="checkbox">
126-
<label class="form-check-label" for="AllChallenges">
127-
Report on all Challenges only
128-
</label>
126+
<label class="form-check-label" asp-for="AllChallengesOnly"></label>
129127
</div>
130128
</div>
131129

0 commit comments

Comments
 (0)