Skip to content

Commit 4296a88

Browse files
committed
BUGFIX:
- RestAPI: /player_info - modulestats only returned modules where kills > 1
1 parent c483eb2 commit 4296a88

File tree

2 files changed

+22
-23
lines changed

2 files changed

+22
-23
lines changed

core/utils/os.py

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,26 @@
2424

2525
from pywinauto.win32defines import SEE_MASK_NOCLOSEPROCESS, SW_HIDE, SW_SHOWMINNOACTIVE
2626

27+
class SHELLEXECUTEINFO(ctypes.Structure):
28+
_fields_ = [
29+
("cbSize", ctypes.c_ulong),
30+
("fMask", ctypes.c_ulong),
31+
("hwnd", ctypes.c_void_p),
32+
("lpVerb", ctypes.c_wchar_p),
33+
("lpFile", ctypes.c_wchar_p),
34+
("lpParameters", ctypes.c_wchar_p),
35+
("lpDirectory", ctypes.c_wchar_p),
36+
("nShow", ctypes.c_int),
37+
("hInstApp", ctypes.c_void_p),
38+
("lpIDList", ctypes.c_void_p),
39+
("lpClass", ctypes.c_wchar_p),
40+
("hkeyClass", ctypes.c_void_p),
41+
("dwHotKey", ctypes.c_ulong),
42+
("hIcon", ctypes.c_void_p),
43+
("hProcess", ctypes.c_void_p),
44+
]
45+
46+
2747
__all__ = [
2848
"find_process",
2949
"find_process_async",
@@ -313,27 +333,6 @@ def shouldRollover(self, record):
313333
return 0
314334

315335

316-
if sys.platform == 'win32':
317-
class SHELLEXECUTEINFO(ctypes.Structure):
318-
_fields_ = [
319-
("cbSize", ctypes.c_ulong),
320-
("fMask", ctypes.c_ulong),
321-
("hwnd", ctypes.c_void_p),
322-
("lpVerb", ctypes.c_wchar_p),
323-
("lpFile", ctypes.c_wchar_p),
324-
("lpParameters", ctypes.c_wchar_p),
325-
("lpDirectory", ctypes.c_wchar_p),
326-
("nShow", ctypes.c_int),
327-
("hInstApp", ctypes.c_void_p),
328-
("lpIDList", ctypes.c_void_p),
329-
("lpClass", ctypes.c_wchar_p),
330-
("hkeyClass", ctypes.c_void_p),
331-
("dwHotKey", ctypes.c_ulong),
332-
("hIcon", ctypes.c_void_p),
333-
("hProcess", ctypes.c_void_p),
334-
]
335-
336-
337336
def run_elevated(exe_path, cwd, *args):
338337
"""Start *exe_path* as Administrator and return the return code."""
339338
if sys.platform != 'win32':

plugins/restapi/commands.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -762,9 +762,9 @@ async def modulestats(self, nick: str = Form(...), date: str | None = Form(None)
762762
CASE WHEN SUM(s.deaths_planes + s.deaths_helicopters + s.deaths_ships + s.deaths_sams + s.deaths_ground) = 0
763763
THEN SUM(s.kills) ELSE SUM(s.kills)::DECIMAL / SUM((s.deaths_planes + s.deaths_helicopters + s.deaths_ships + s.deaths_sams + s.deaths_ground)::DECIMAL) END AS "kdr"
764764
FROM mv_statistics s
765-
WHERE player_ucid = %(ucid)s
765+
WHERE s.player_ucid = %(ucid)s
766766
{where}
767-
GROUP BY 1 HAVING SUM(kills) > 1
767+
GROUP BY 1 HAVING SUM(s.kills) > 0
768768
ORDER BY 2 DESC
769769
"""
770770
async with self.apool.connection() as conn:

0 commit comments

Comments
 (0)