Исправил запрос
All checks were successful
Local Deploy with Docker / build-and-deploy (push) Successful in 44s

This commit is contained in:
Dmitrii Prokudin 2024-12-27 00:24:16 +03:00
parent a0b9faf081
commit 3b8121afad

View File

@ -36,7 +36,7 @@ public interface IUserOfTheDayRepository
{
using (IDbConnection db = new NpgsqlConnection(_connectionString))
{
string query = "SELECT CAST(CASE WHEN EXISTS (SELECT 1 FROM user_of_the_day WHERE chat_id = @ChatId AND date = @Date AND type = @Type) THEN 1 ELSE 0 END as BIT)";
string query = "SELECT CAST(CASE WHEN EXISTS (SELECT COUNT(1) FROM user_of_the_day WHERE chat_id = @ChatId AND date = @Date AND type = @Type) THEN 1 ELSE 0 END as BIT)";
var res = await db.ExecuteScalarAsync<bool>(query, new { ChatId = chatId, Date = date, Type = type });
Console.WriteLine($"{chatId} : {type} : {res}");
return res;