diff --git a/lib/teiserver/account/libs/account_test_lib.ex b/lib/teiserver/account/libs/account_test_lib.ex index 41a52f5af..d36edea57 100644 --- a/lib/teiserver/account/libs/account_test_lib.ex +++ b/lib/teiserver/account/libs/account_test_lib.ex @@ -15,7 +15,7 @@ defmodule Teiserver.Account.AccountTestLib do email: data["email"] || "email_#{r}", colour: data["colour"] || "colour", icon: data["icon"] || "icon", - last_login: data["last_login"] || Timex.now() + last_login_timex: data["last_login_timex"] || Timex.now() }, :script ) diff --git a/lib/teiserver/account/libs/relationship_lib.ex b/lib/teiserver/account/libs/relationship_lib.ex index dcf40f535..0c5c93811 100644 --- a/lib/teiserver/account/libs/relationship_lib.ex +++ b/lib/teiserver/account/libs/relationship_lib.ex @@ -397,8 +397,8 @@ defmodule Teiserver.Account.RelationshipLib do using account_users au where au.id = ar.to_user_id and ar.from_user_id = $1 - and (au.last_login is null OR - abs(DATE_PART('day', (now()- au.last_login ))) > $2); + and (au.last_login_timex is null OR + abs(DATE_PART('day', (now()- au.last_login_timex ))) > $2); """ results = diff --git a/lib/teiserver_web/live/account/relationship/index.ex b/lib/teiserver_web/live/account/relationship/index.ex index 183bd2789..131be72eb 100644 --- a/lib/teiserver_web/live/account/relationship/index.ex +++ b/lib/teiserver_web/live/account/relationship/index.ex @@ -286,7 +286,7 @@ defmodule TeiserverWeb.Account.RelationshipLive.Index do num_friends_deleted = Enum.map(friends, fn friend -> - last_login = friend.other_user.last_login + last_login = friend.other_user.last_login_timex days = get_days_diff(last_login, now) should_delete? = days > days_cutoff @@ -514,7 +514,7 @@ defmodule TeiserverWeb.Account.RelationshipLive.Index do defp get_inactive_friend_count(friends, days_cutoff) do Enum.filter(friends, fn friend -> - last_login = friend.other_user.last_login + last_login = friend.other_user.last_login_timex days = get_days_diff(last_login, Timex.now()) days > days_cutoff end) diff --git a/test/teiserver/account/relationship_lib_test.exs b/test/teiserver/account/relationship_lib_test.exs index 1a579b298..8409b5b35 100644 --- a/test/teiserver/account/relationship_lib_test.exs +++ b/test/teiserver/account/relationship_lib_test.exs @@ -1,7 +1,5 @@ defmodule Teiserver.Account.RelationshipLibTest do use Teiserver.DataCase, async: true - alias Teiserver.Account - alias Teiserver.Account.FriendLib alias Teiserver.Account.AccountTestLib alias Teiserver.Account.RelationshipLib @@ -15,7 +13,7 @@ defmodule Teiserver.Account.RelationshipLibTest do user3 = AccountTestLib.user_fixture(%{ - "last_login" => old_login + "last_login_timex" => old_login }) assert user1.id != nil