< Summary

Information
Class: OzonOrdersWeb.WebServices.Orders.Grid.OrdersGridFormulaFields
Assembly: OzonOrdersWeb
File(s): /home/runner/work/Studio2Prod/Studio2Prod/OzonOrdersWeb/WebServices/Orders/Grid/OrdersGridFormulaFields.cs
Line coverage
100%
Covered lines: 53
Uncovered lines: 0
Coverable lines: 53
Total lines: 70
Line coverage: 100%
Branch coverage
100%
Covered branches: 2
Total branches: 2
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.cctor()100%11100%
ForAllowed(...)100%22100%

File(s)

/home/runner/work/Studio2Prod/Studio2Prod/OzonOrdersWeb/WebServices/Orders/Grid/OrdersGridFormulaFields.cs

#LineLine coverage
 1namespace OzonOrdersWeb.WebServices.Orders.Grid;
 2
 3/// <summary>Поле строки грида, доступное в формулах вычисляемых столбцов (ключ → поле DTO, тип, гейт колонки).</summary
 4public sealed record OrdersGridFormulaField(string Key, string Field, string Label, string Type, string? Gate);
 5
 6/// <summary>
 7/// Единый каталог полей для формул: сервер отдаёт клиенту только разрешённые пользователю (гейтинг колонок),
 8/// а при сохранении проверяет, что формула не ссылается на скрытые поля.
 9/// </summary>
 10public static class OrdersGridFormulaFields
 11{
 112    public static readonly IReadOnlyList<OrdersGridFormulaField> All =
 113    [
 114        new("shipmentNumber", "shipmentNumber", "Номер заказа", "text", "ShipmentNumber"),
 115        new("ozonClient", "ozonClient", "Клиент", "text", "OzonClient"),
 116        new("deliveryCity", "deliveryCity", "Город доставки", "text", "DeliveryCity"),
 117        new("processingDate", "processingDate", "Дата принятия", "date", "ProcessingDate"),
 118        new("shippingDate", "shippingDate", "Дата отгрузки", "date", "ShippingDate"),
 119        new("deliveryPeriod", "deliveryPeriodText", "Срок доставки (текст)", "text", "DeliveryPeriod"),
 120        new("timeLeftDays", "timeLeftDays", "Осталось дней", "number", "DeliveryPeriod"),
 121        new("deliveryOverdue", "deliveryOverdue", "Просрочена доставка", "bool", "DeliveryPeriod"),
 122        new("lastStatusChangeDate", "lastStatusChangeDate", "Дата изм. статуса", "date", "LastStatusChangeDate"),
 123        new("productKey", "productKey", "Key", "text", "ProductKey"),
 124        new("manufacturer", "manufacturer", "Производитель", "text", "Manufacturer"),
 125        new("article", "article", "Код товара", "text", "Article"),
 126        new("productName", "productName", "Наименование", "text", "ProductName"),
 127        new("category", "category", "Категория", "text", "Category"),
 128        new("volumetricWeight", "volumetricWeight", "Вес объёмный", "number", "VolumeWeight"),
 129        new("weight", "weight", "Вес", "number", "VolumeWeight"),
 130        new("clientStatus", "clientStatus", "Статус клиента", "text", "ClientStatus"),
 131        new("appStatus", "appStatus", "Наш статус", "text", "AppStatus"),
 132        new("supplierStatus", "supplierStatus", "Статус поставщика", "text", "AppStatus"),
 133        new("cartItemStatus", "cartItemStatus", "Статус корзины", "text", "AppStatus"),
 134        new("returnStatus", "returnStatusText", "Возврат", "text", "AppStatus"),
 135        new("shipmentWarehouse", "shipmentWarehouse", "Склад отгрузки", "text", "ShipmentWarehouse"),
 136        new("deliveryProvider", "deliveryProvider", "Доставка", "text", "Delivery"),
 137        new("deliveryName", "deliveryName", "Тип доставки", "text", "DeliveryType"),
 138        new("trackingNumber", "trackingNumber", "Трек-номер", "text", "TrackingNumber"),
 139        new("scanit", "scanit", "ScanIt", "text", "ShipmentNumber"),
 140        new("supplier", "supplier", "Поставщик", "text", "Supplier"),
 141        new("orderNumberToSupplier", "orderNumberToSupplier", "Номер заказа поставщику", "text", "SupplierOrderNumber"),
 142        new("sitePrice", "sitePrice", "Цена сайта", "number", "SitePrice"),
 143        new("quantity", "quantity", "Количество", "number", "Quantity"),
 144        new("price", "price", "Цена продажи", "number", "Price"),
 145        new("currency", "currency", "Валюта", "text", "Price"),
 146        new("shipmentAmount", "shipmentAmount", "Сумма отправления", "number", "ShipmentTotal"),
 147        new("purchasePrice", "purchasePrice", "Цена закупки", "number", "PurchasePrice"),
 148        new("costPrice", "costPrice", "Себестоимость", "number", "Cost"),
 149        new("extraExpenses", "extraExpenses", "Доп. расходы", "number", "Cost"),
 150        new("ozonCommissionMin", "ozonCommissionMin", "Комиссия Ozon min", "number", "OzonCommission"),
 151        new("ozonCommissionMax", "ozonCommissionMax", "Комиссия Ozon max", "number", "OzonCommission"),
 152        new("profitMin", "profitMin", "Прибыль min", "number", "Profit"),
 153        new("profitMax", "profitMax", "Прибыль max", "number", "Profit"),
 154        new("targetProfit135", "targetProfit135", "Прибыль при цели 13,5 %", "number", "Profit"),
 155        new("discountMin", "discountMin", "Наценка % min", "number", "MarkupPercent"),
 156        new("discountMax", "discountMax", "Наценка % max", "number", "MarkupPercent"),
 157        new("hasOzonPromotion", "hasOzonPromotion", "Акция Ozon", "bool", "Price"),
 158        new("isArchived", "isArchived", "В архиве", "bool", null),
 159        new("isCancelled", "isCancelled", "Отменён", "bool", null),
 160        new("isReturned", "isReturned", "Возврат оформлен", "bool", null),
 161        new("fromFile", "fromFile", "Загружен из файла", "bool", null)
 162    ];
 63
 64    /// <summary>Поля, которые видит пользователь с данным набором разрешённых колонок (FieldName из OrderListColumnCata
 65    public static IReadOnlyList<OrdersGridFormulaField> ForAllowed(IEnumerable<string> allowedColumns)
 66    {
 567        var allowed = new HashSet<string>(allowedColumns, StringComparer.OrdinalIgnoreCase);
 24568        return All.Where(f => f.Gate is null || allowed.Contains(f.Gate)).ToList();
 69    }
 70}