Skip to content

Золотилов Никита Лаб. 1 Группа 6513#70

Open
Chuck-man wants to merge 1 commit intoitsecd:mainfrom
Chuck-man:main
Open

Золотилов Никита Лаб. 1 Группа 6513#70
Chuck-man wants to merge 1 commit intoitsecd:mainfrom
Chuck-man:main

Conversation

@Chuck-man
Copy link

ФИО: Золотилов Никита
Номер группы: 6513
Номер лабораторной: 1
Номер варианта: 40
Краткое описание предметной области: Сотрудник компании
Краткое описание добавленных фич: Добавлен сервис генерации, кэширование и логирование

@github-actions github-actions bot added In progress Код в процессе проверки Lab 1 Лабораторная №1. Кэширование labels Mar 19, 2026
@github-actions github-actions bot requested a review from alxmcs March 19, 2026 14:40
Comment on lines +13 to +17
public CacheService(IDistributedCache cache, ILogger<CacheService> logger)
{
_cache = cache;
_logger = logger;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Здесь и далее по коду:
Использовать праймари конструкторы

_logger = logger;
}

public async Task<Employee?> RetrieveFromCache(int id)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Здесь и далее по коду:
Добавить саммари ко всем классам, методам, публичным проперти. Если они описаны в базовом классе или интерфейсе - использовать ///<inheritdoc/>

/// <returns>Оклад</returns>
private static decimal CalculateSalary(string position)
{
Faker faker = new();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

имхо var faker = new Faker(); будет предпочтительнее в современном шарпе

/// <summary>
/// Справочник категорий суффиксов должностей
/// </summary>
private static readonly string[] _suffexies = { "Junior", "Middle", "Senior", "Lead" };
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_suffexies
о вы из англии

Comment on lines +42 to +53
return position switch
{
var p when p.Contains("Junior") =>
Math.Round(faker.Random.Decimal(30000m, 60000m), 2),
var p when p.Contains("Middle") =>
Math.Round(faker.Random.Decimal(60000m, 120000m), 2),
var p when p.Contains("Senior") =>
Math.Round(faker.Random.Decimal(120000m, 200000m), 2),
var p when p.Contains("Lead") =>
Math.Round(faker.Random.Decimal(150000m, 250000m), 2),
_ => Math.Round(faker.Random.Decimal(40000m, 100000m), 2)
};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Как будто бы эту логику можно было бы реализовать попроще и, возможно, даже в рамках инлайн лямбды, если бы _suffexies не массивом строк, а словарем с ключами в виде должностей и значениями в виде границ зп

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

In progress Код в процессе проверки Lab 1 Лабораторная №1. Кэширование

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants