<commit_before>using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using JetBrains.Annotations;
using JoinRpg.Data.Interfaces;
using JoinRpg.DataModel;
using JoinRpg.Domain;
using JoinRpg.Helpers;
using JoinRpg.Portal.Controllers.Common;
using JoinRpg.Portal.Infrastructure;
using JoinRpg.Portal.Infrastructure.Authorization;
using JoinRpg.Services.Interfaces;
using JoinRpg.Web.Helpers;
using JoinRpg.Web.Models;
using JoinRpg.Web.Models.CharacterGroups;
using JoinRpg.Web.Models.Characters;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.Extensions;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;

namespace JoinRpg.Portal.Controllers
{
    [Route("{projectId}/roles/[action]")]
  public class GameGroupsController : ControllerGameBase
  {

        public GameGroupsController(
            IProjectRepository projectRepository,
            IProjectService projectService,
            IUserRepository userRepository)
            : base(projectRepository, projectService, userRepository)
        {
        }

      [HttpGet]
    public async Task<ActionResult> Index(int projectId, int? characterGroupId)
    {
      var field = await ProjectRepository.LoadGroupWithTreeAsync(projectId, characterGroupId);

      if (field == null) return NotFound();
      
      return View(
        new GameRolesViewModel
        {
          ProjectId = field.Project.ProjectId,
          ProjectName = field.Project.ProjectName,
          ShowEditControls = field.HasEditRolesAccess(CurrentUserIdOrDefault),
          HasMasterAccess = field.HasMasterAccess(CurrentUserIdOrDefault),
          Data = CharacterGroupListViewModel.GetGroups(field, CurrentUserIdOrDefault),
          Details = new CharacterGroupDetailsViewModel(field, CurrentUserIdOrDefault, GroupNavigationPage.Roles),
        });
    }

    [HttpGet, MasterAuthorize]
    public async Task<ActionResult> Report(int projectId, int? characterGroupId)
    {
      var field = await ProjectRepository.LoadGroupWithTreeAsync(projectId, characterGroupId);

      if (field == null) return NotFound();

      return View(
        new GameRolesReportViewModel<commit_msg>fix routes for game group controller once again<commit_after>using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using JetBrains.Annotations;
using JoinRpg.Data.Interfaces;
using JoinRpg.DataModel;
using JoinRpg.Domain;
using JoinRpg.Helpers;
using JoinRpg.Portal.Controllers.Common;
using JoinRpg.Portal.Infrastructure;
using JoinRpg.Portal.Infrastructure.Authorization;
using JoinRpg.Services.Interfaces;
using JoinRpg.Web.Helpers;
using JoinRpg.Web.Models;
using JoinRpg.Web.Models.CharacterGroups;
using JoinRpg.Web.Models.Characters;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.Extensions;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;

namespace JoinRpg.Portal.Controllers
{
    [Route("{projectId}/roles/{characterGroupId}/[action]")]
    public class GameGroupsController : ControllerGameBase
    {

        public GameGroupsController(
            IProjectRepository projectRepository,
            IProjectService projectService,
            IUserRepository userRepository)
            : base(projectRepository, projectService, userRepository)
        {
        }

        [HttpGet("~/{projectId}/roles/{characterGroupId?}")]
        public async Task<ActionResult> Index(int projectId, int? characterGroupId)
    {
      var field = await ProjectRepository.LoadGroupWithTreeAsync(projectId, characterGroupId);

      if (field == null) return NotFound();
      
      return View(
        new GameRolesViewModel
        {
          ProjectId = field.Project.ProjectId,
          ProjectName = field.Project.ProjectName,
          ShowEditControls = field.HasEditRolesAccess(CurrentUserIdOrDefault),
          HasMasterAccess = field.HasMasterAccess(CurrentUserIdOrDefault),
          Data = CharacterGroupListViewModel.GetGroups(field, CurrentUserIdOrDefault),
          Details = new CharacterGroupDetailsViewModel(field, CurrentUserIdOrDefault, GroupNavigationPage.Roles),
        });
    }

    [HttpGet, MasterAuthorize]
    public async Task<ActionResult> Report(int projectId, int? characterGroupId)
    {
      var field = await ProjectRepository.LoadGroupWithTreeAsync(projectId, characterGroupId);

      if (field == null) return NotFound();

      return View(
        new GameRolesReportViewModel
{'fraction_non_alphanumeric': 0.08106942647692972, 'fraction_numerical': 0.0, 'mean_word_length': 3.988172043010753, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2361828', 'n_tokens_mistral': 1228, 'n_tokens_neox': 1250, 'n_words': 256}