From e328cee63ea916fbbf50f6847b7ad488aca1e532 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrej=20Rama=C5=A1euski?= <andrej@x2.cz> Date: Fri, 25 Dec 2020 21:04:35 +0100 Subject: [PATCH] Zmena logiky pocitani uzivatelu --- lib/CF/Controller/Websockets.pm | 2 +- lib/CF/Schema/Result/Socket.pm | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/CF/Controller/Websockets.pm b/lib/CF/Controller/Websockets.pm index 119cefb..ab3b44e 100644 --- a/lib/CF/Controller/Websockets.pm +++ b/lib/CF/Controller/Websockets.pm @@ -36,7 +36,7 @@ sub main { ip => $ip, keepalive => \'now()', user_id => $user_id, - }, { key => 'primary'} ); + }, { key => $user_id ? 'primary':'user'} ); my $all = $c->schema->resultset('Socket_view')->count( { is_alive => 't', } diff --git a/lib/CF/Schema/Result/Socket.pm b/lib/CF/Schema/Result/Socket.pm index 84f86f1..943bc77 100644 --- a/lib/CF/Schema/Result/Socket.pm +++ b/lib/CF/Schema/Result/Socket.pm @@ -20,4 +20,8 @@ __PACKAGE__->add_columns( __PACKAGE__->set_primary_key('id'); +__PACKAGE__->add_unique_constraint( + 'user' => [qw(user_id)] +); + 1; -- GitLab