<commit_before>﻿@using JoinRpg.DataModel
@using JoinRpg.Web.Models
@model CharacterListViewModel
  @{
      ViewBag.Title = Model.Title;
  }

<h2>@Model.Title</h2>

@Html.Partial("_ListOperationsDropdown", Model)

@{
  var firstItem = Model.Items.FirstOrDefault();
}

<p>@DisplayCount.OfX(Model.Items.Count(), "персонаж", "персонажа", "персонажей")</p>

<table class="table">
    <tr>
        <th rowspan="2">
            @Html.DisplayNameFor(model => firstItem.Name)
        </th>
        <th rowspan="2">
            @Html.DisplayNameFor(model => firstItem.Player)
        </th>
        <th rowspan="2">
            @Html.DisplayNameFor(model => firstItem.Groups)
        </th>
        
        <th rowspan="2">@Html.DisplayNameFor(model => firstItem.Problems)</th>
        <th colspan="2">Загрузы (готовых/всего)</th>
        @foreach (var field in Model.Fields)
        {
            switch (field.FieldType)
            {
                case ProjectFieldType.Text:
                    continue;
                case ProjectFieldType.String:
                case ProjectFieldType.Dropdown:
                case ProjectFieldType.Checkbox:
                case ProjectFieldType.MultiSelect:
            <th rowspan="2">@field.FieldName</th>
                    break;
                case ProjectFieldType.Header:
            <th rowspan="2">&nbsp;</th>
                    break;
                default:
                    throw new ArgumentOutOfRangeException();
            }
        }

    </tr>
    <tr>
        <th>Личные</th>
        <th>Коллективные</th>
    </tr>

    @foreach (var item in Model.Items.OrderBy(c => c.BusyStatus).ThenBy(c => c.Name))
    {
        <tr>
            <td>
                <a href="@Url.Action("Edit", "Character", new {Model.ProjectId, item.CharacterId}, null)">
                    @item.Name
                </a>
            </td>
            <td>
                @switch (item.BusyStatus)
                {
                    case CharacterBusyStatusView.HasPlayer:
                        <a href="@Url.Action("Edit", "Claim", new {Model.ProjectId, ClaimId = item.ApprovedClaimId}, null)">
                            @Html.DisplayFor(modelItem => item.Player.DisplayName)
                        </a>
                        break;
                    default:
                        @Html.DisplayFor(modelItem => item.BusyStatus)
                        break;
                }
            </td>
            <td>
                @Html.DisplayFor(model => item.Groups)
            </td>
            <td>
                @foreach (var pr in item.Problems)
                {
                    @Html.DisplayFor(modelItem => pr)
                }
            </td>
            <td>
                @item.IndReadyPlotsCount / @item.IndAllPlotsCount
            </td>
            <td><commit_msg>Fix view<commit_after>﻿@using JoinRpg.DataModel
@using JoinRpg.Domain
@using JoinRpg.Web.Models
@model CharacterListViewModel
  @{
      ViewBag.Title = Model.Title;
  }

<h2>@Model.Title</h2>

@Html.Partial("_ListOperationsDropdown", Model)

@{
  var firstItem = Model.Items.FirstOrDefault();
}

<p>@DisplayCount.OfX(Model.Items.Count(), "персонаж", "персонажа", "персонажей")</p>

<table class="table">
    <tr>
        <th rowspan="2">
            @Html.DisplayNameFor(model => firstItem.Name)
        </th>
        <th rowspan="2">
            @Html.DisplayNameFor(model => firstItem.Player)
        </th>
        <th rowspan="2">
            @Html.DisplayNameFor(model => firstItem.Groups)
        </th>
        
        <th rowspan="2">@Html.DisplayNameFor(model => firstItem.Problems)</th>
        <th colspan="2">Загрузы (готовых/всего)</th>
        @foreach (var field in Model.Fields)
        {
            switch (field.FieldType)
            {
                case ProjectFieldType.Text:
                    continue;
                case ProjectFieldType.String:
                case ProjectFieldType.Dropdown:
                case ProjectFieldType.Checkbox:
                case ProjectFieldType.MultiSelect:
            <th rowspan="2">@field.FieldName</th>
                    break;
                case ProjectFieldType.Header:
            <th rowspan="2">&nbsp;</th>
                    break;
                default:
                    throw new ArgumentOutOfRangeException();
            }
        }

    </tr>
    <tr>
        <th>Личные</th>
        <th>Коллективные</th>
    </tr>

    @foreach (var item in Model.Items.OrderBy(c => c.BusyStatus).ThenBy(c => c.Name))
    {
        <tr>
            <td>
                <a href="@Url.Action("Edit", "Character", new {Model.ProjectId, item.CharacterId}, null)">
                    @item.Name
                </a>
            </td>
            <td>
                @switch (item.BusyStatus)
                {
                    case CharacterBusyStatusView.HasPlayer:
                        <a href="@Url.Action("Edit", "Claim", new {Model.ProjectId, ClaimId = item.ApprovedClaimId}, null)">
                            @Html.DisplayFor(modelItem => item.Player.DisplayName)
                        </a>
                        break;
                    default:
                        @Html.DisplayFor(modelItem => item.BusyStatus)
                        break;
                }
            </td>
            <td>
                @Html.DisplayFor(model => item.Groups)
            </td>
            <td>
                @foreach (var pr in item.Problems)
                {

                    var style = "";
                    switch (pr.Severity)
                    {
                        case ProblemSeverity.Hint:
                            style = "label-info";
                            break;
                        case ProblemSeverity.Warning:
                            style = "label-warning";
                            break;
                        case ProblemSeverity.Error:
                        case ProblemSeverity.Fatal:
                            style = "label-danger";
                            break;
                        default:
                            throw new ArgumentOutOfRangeException();
                    }

                    <div class="label @style">
                        @if (pr.Severity == ProblemSeverity.Fatal)
                        {
                            <span class="glyphicon glyphicon-exclamation-sign" title="Обратитесь в поддержку сайта"></span>
                        }
                        @Html.DisplayFor(modelItem => pr.ProblemType)
                        @if (pr.ProblemTime != null)
                        {
                            @Html.DisplayFor(modelItem => pr.ProblemTime, "EventTime")
                        }
                        @if (!string.IsNullOrWhiteSpace(pr.Extra))
                        {
                            <text>: @pr.Extra</text>
                        }
                    </div>
                    <br/>
                }
            </td>
            <td>
                @item.IndReadyPlotsCount / @item.IndAllPlotsCount
            </td>
            <td>
{'fraction_non_alphanumeric': 0.11538461538461539, 'fraction_numerical': 0.0025266704098820887, 'mean_word_length': 1.174908424908425, 'pattern_counts': {'":': 0, '<': 96, '<?xml version=': 0, '>': 117, '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': '1069659', 'n_tokens_mistral': 1985, 'n_tokens_neox': 1894, 'n_words': 324}