Исправил запрос
All checks were successful
Local Deploy with Docker / build-and-deploy (push) Successful in 20s
All checks were successful
Local Deploy with Docker / build-and-deploy (push) Successful in 20s
This commit is contained in:
parent
ffcffe940a
commit
a0b9faf081
@ -36,10 +36,10 @@ public interface IUserOfTheDayRepository
|
|||||||
{
|
{
|
||||||
using (IDbConnection db = new NpgsqlConnection(_connectionString))
|
using (IDbConnection db = new NpgsqlConnection(_connectionString))
|
||||||
{
|
{
|
||||||
string query = "SELECT COUNT(1) FROM user_of_the_day WHERE chat_id = @ChatId AND date = @Date AND type = @Type";
|
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)";
|
||||||
var res = await db.ExecuteScalarAsync<int>(query, new { ChatId = chatId, Date = date, Type = type });
|
var res = await db.ExecuteScalarAsync<bool>(query, new { ChatId = chatId, Date = date, Type = type });
|
||||||
Console.WriteLine($"{chatId} : {type} : {res}");
|
Console.WriteLine($"{chatId} : {type} : {res}");
|
||||||
return res > 0;
|
return res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user