--- lbbs/src/user_stat.c 2025/10/23 04:09:33 1.1 +++ lbbs/src/user_stat.c 2025/11/11 00:28:05 1.6 @@ -1,18 +1,14 @@ -/*************************************************************************** - user_list.c - description - ------------------- - Copyright : (C) 2004-2025 by Leaflet - Email : leaflet@leafok.com - ***************************************************************************/ - -/*************************************************************************** - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 3 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ +/* SPDX-License-Identifier: GPL-3.0-or-later */ +/* + * user_stat + * - data model and basic operations of user related statistics + * + * Copyright (C) 2004-2025 Leaflet + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include "log.h" #include "section_list.h" @@ -75,13 +71,18 @@ int user_stat_map_update(USER_STAT_MAP * break; } + if (p_article->visible == 0) + { + continue; + } + if (p_article->uid > p_map->last_uid) { #ifdef _DEBUG - log_error("uid=%d of article(aid=%d) is greater than last_uid=%d, waiting for next user list update\n", + log_error("uid=%d of article(aid=%d) is greater than last_uid=%d\n", p_article->uid, p_article->aid, p_map->last_uid); #endif - break; + continue; } if (user_stat_article_cnt_inc(p_map, p_article->uid, 1) < 0) @@ -116,7 +117,7 @@ int user_stat_article_cnt_inc(USER_STAT_ mid = (left + right) / 2; if (uid < p_map->stat_list[mid].uid) { - right = mid; + right = mid - 1; } else if (uid > p_map->stat_list[mid].uid) { @@ -158,7 +159,7 @@ int user_stat_get(USER_STAT_MAP *p_map, mid = (left + right) / 2; if (uid < p_map->stat_list[mid].uid) { - right = mid; + right = mid - 1; } else if (uid > p_map->stat_list[mid].uid) {