Skip to content

Commit

Permalink
Cope with potential duplication of records
Browse files Browse the repository at this point in the history
  • Loading branch information
Rosuav committed Jun 14, 2024
1 parent 477449d commit 30ffa75
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion modules/renamed.pike
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ __async__ mapping message_params(object channel, mapping person, array param) {
}
int uid; catch {uid = await(get_user_id(user));};
if (!uid) error("Can't find that person.\n");
array names = await(G->G->DB->query_ro("select login from stillebot.user_login_sightings where twitchid = :id order by sighted",
array names = await(G->G->DB->query_ro("select distinct login from stillebot.user_login_sightings where twitchid = :id order by sighted",
(["id": uid])))->login;
string|zero foll = await(check_following(uid, channel->userid)); //FIXME: What if no perms?
string|zero follage;
Expand Down
2 changes: 1 addition & 1 deletion utils.pike
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ __async__ void lookup() {
foreach (names, string name) {
int uid = await(get_user_id(name));
if (!uid) {write(name + ": Not found\n"); continue;}
array times = await(G->G->DB->query_ro("select login, sighted from stillebot.user_login_sightings where twitchid = :id order by sighted",
array times = await(G->G->DB->query_ro("select login, min(sighted) from stillebot.user_login_sightings where twitchid = :id group by login order by 2",
(["id": uid])));
if (G->G->args->times) foreach (times, mapping t) write("[%s] %s\n", t->sighted, t->login);
else write(name + ": " + times->login * ", " + "\n");
Expand Down

0 comments on commit 30ffa75

Please sign in to comment.