Open
Conversation
Gwymlas
requested changes
Mar 15, 2026
There was a problem hiding this comment.
Удалить служебные файлы IDE, добавить .idea в .gitignore
Comment on lines
+105
to
+133
| if (node is null) | ||
| { | ||
| return "нет данных"; | ||
| } | ||
|
|
||
| if (node is JsonValue value) | ||
| { | ||
| if (value.TryGetValue<bool>(out var boolValue)) | ||
| { | ||
| return boolValue ? "Да" : "Нет"; | ||
| } | ||
|
|
||
| if (value.TryGetValue<double>(out var doubleValue)) | ||
| { | ||
| return doubleValue.ToString("0.00"); | ||
| } | ||
|
|
||
| if (value.TryGetValue<int>(out var intValue)) | ||
| { | ||
| return intValue.ToString(); | ||
| } | ||
|
|
||
| if (value.TryGetValue<string>(out var stringValue)) | ||
| { | ||
| return stringValue; | ||
| } | ||
| } | ||
|
|
||
| return node.ToJsonString(); |
There was a problem hiding this comment.
Можно что то такое:
return node switch
{
null => "нет данных",
JsonValue value when value.TryGetValue<bool>(out var boolValue) => boolValue ? "Да" : "Нет",
JsonValue value when value.TryGetValue<double>(out var doubleValue) => doubleValue.ToString("0.00"),
JsonValue value when value.TryGetValue<int>(out var intValue) => intValue.ToString(),
JsonValue value when value.TryGetValue<string>(out var stringValue) => stringValue,
_ => node.ToJsonString()
};
Comment on lines
+117
to
+125
| if (value.TryGetValue<double>(out var doubleValue)) | ||
| { | ||
| return doubleValue.ToString("0.00"); | ||
| } | ||
|
|
||
| if (value.TryGetValue<int>(out var intValue)) | ||
| { | ||
| return intValue.ToString(); | ||
| } |
| <UnorderedListItem>Номер <Strong>№X "Название лабораторной"</Strong></UnorderedListItem> | ||
| <UnorderedListItem>Вариант <Strong>№Х "Название варианта"</Strong></UnorderedListItem> | ||
| <UnorderedListItem>Выполнена <Strong>Фамилией Именем 65ХХ</Strong> </UnorderedListItem> | ||
| <UnorderedListItem><Link To="https://puginarug.com/">Ссылка на форк</Link></UnorderedListItem> |
| var gender = faker.PickRandom<Name.Gender>(); | ||
| var lastName = faker.Name.LastName(gender); | ||
| var firstName = faker.Name.FirstName(gender); | ||
| var patronymicBase = faker.Name.FirstName(gender); |
Comment on lines
+58
to
+74
| private static T PickWeighted<T>(Faker faker, params (T value, int weight)[] items) | ||
| { | ||
| var totalWeight = items.Sum(item => item.weight); | ||
| var roll = faker.Random.Int(1, totalWeight); | ||
| var currentWeight = 0; | ||
|
|
||
| foreach (var item in items) | ||
| { | ||
| currentWeight += item.weight; | ||
| if (roll <= currentWeight) | ||
| { | ||
| return item.value; | ||
| } | ||
| } | ||
|
|
||
| return items[^1].value; | ||
| } |
Comment on lines
+47
to
+55
| var birthDateTime = birthDate.ToDateTime(TimeOnly.MinValue); | ||
| var today = DateTime.Today; | ||
|
|
||
| if (birthDateTime >= today) | ||
| { | ||
| return birthDate; | ||
| } | ||
|
|
||
| return DateOnly.FromDateTime(faker.Date.Between(birthDateTime, today)); |
There was a problem hiding this comment.
Есть BetweenDateOnly
Тогда получится:
var today = DateOnly.FromDateTime(DateTime.Today);
return birthDate >= today ? birthDate : faker.Date.BetweenDateOnly(birthDate, today);
| }); | ||
| }); | ||
|
|
||
| builder.Services.AddScoped<MedicalPatientGenerator>(); |
There was a problem hiding this comment.
MedicalPatientGenerator можно зарегистрировать как Singleton
| .WaitFor(redis); | ||
|
|
||
| builder.AddProject<Projects.Client_Wasm>("client") | ||
| .WithReference(api) |
Comment on lines
+16
to
+17
| [HttpGet] | ||
| public async Task<ActionResult<MedicalPatient>> GetById([FromQuery] int id, CancellationToken cancellationToken) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


ФИО: Котлярский Вадим
Номер группы: 6512
Номер лабораторной: 1
Номер варианта: 24
Краткое описание предметной области: Медицинский пациент.
Краткое описание добавленных фич: Добавлена модель данных, добавлен сервис генерации, сделан endpoint, добавлен кеш, оркестратор