aa-pilotstats 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- aa_pilotstats-0.1.0/.gitignore +8 -0
- aa_pilotstats-0.1.0/LICENSE +21 -0
- aa_pilotstats-0.1.0/PKG-INFO +250 -0
- aa_pilotstats-0.1.0/README.md +201 -0
- aa_pilotstats-0.1.0/aa_pilotstats/__init__.py +4 -0
- aa_pilotstats-0.1.0/aa_pilotstats/admin.py +221 -0
- aa_pilotstats-0.1.0/aa_pilotstats/app_settings.py +60 -0
- aa_pilotstats-0.1.0/aa_pilotstats/apps.py +29 -0
- aa_pilotstats-0.1.0/aa_pilotstats/auth_hooks.py +55 -0
- aa_pilotstats-0.1.0/aa_pilotstats/checks.py +29 -0
- aa_pilotstats-0.1.0/aa_pilotstats/discord.py +433 -0
- aa_pilotstats-0.1.0/aa_pilotstats/fleets.py +208 -0
- aa_pilotstats-0.1.0/aa_pilotstats/forms.py +40 -0
- aa_pilotstats-0.1.0/aa_pilotstats/leaderboard.py +327 -0
- aa_pilotstats-0.1.0/aa_pilotstats/legacy_urls.py +27 -0
- aa_pilotstats-0.1.0/aa_pilotstats/migration_ops.py +94 -0
- aa_pilotstats-0.1.0/aa_pilotstats/migrations/0001_initial.py +117 -0
- aa_pilotstats-0.1.0/aa_pilotstats/migrations/0002_esi_zkill_fleets.py +171 -0
- aa_pilotstats-0.1.0/aa_pilotstats/migrations/0003_discord.py +49 -0
- aa_pilotstats-0.1.0/aa_pilotstats/migrations/__init__.py +0 -0
- aa_pilotstats-0.1.0/aa_pilotstats/models.py +632 -0
- aa_pilotstats-0.1.0/aa_pilotstats/parsing.py +281 -0
- aa_pilotstats-0.1.0/aa_pilotstats/payouts.py +135 -0
- aa_pilotstats-0.1.0/aa_pilotstats/providers.py +50 -0
- aa_pilotstats-0.1.0/aa_pilotstats/static/pilotstats/css/pilotstats.css +330 -0
- aa_pilotstats-0.1.0/aa_pilotstats/static/pilotstats/js/dropzone.js +45 -0
- aa_pilotstats-0.1.0/aa_pilotstats/static/pilotstats/js/scanner.js +447 -0
- aa_pilotstats-0.1.0/aa_pilotstats/tasks.py +299 -0
- aa_pilotstats-0.1.0/aa_pilotstats/templates/pilotstats/base.html +58 -0
- aa_pilotstats-0.1.0/aa_pilotstats/templates/pilotstats/dashboard_widget.html +63 -0
- aa_pilotstats-0.1.0/aa_pilotstats/templates/pilotstats/events.html +92 -0
- aa_pilotstats-0.1.0/aa_pilotstats/templates/pilotstats/fleet_detail.html +80 -0
- aa_pilotstats-0.1.0/aa_pilotstats/templates/pilotstats/fleets.html +56 -0
- aa_pilotstats-0.1.0/aa_pilotstats/templates/pilotstats/includes/feed_line.html +39 -0
- aa_pilotstats-0.1.0/aa_pilotstats/templates/pilotstats/includes/session_dashboard.html +121 -0
- aa_pilotstats-0.1.0/aa_pilotstats/templates/pilotstats/leaderboard.html +109 -0
- aa_pilotstats-0.1.0/aa_pilotstats/templates/pilotstats/my_uploads.html +81 -0
- aa_pilotstats-0.1.0/aa_pilotstats/templates/pilotstats/session_detail.html +77 -0
- aa_pilotstats-0.1.0/aa_pilotstats/templates/pilotstats/upload.html +73 -0
- aa_pilotstats-0.1.0/aa_pilotstats/templatetags/__init__.py +0 -0
- aa_pilotstats-0.1.0/aa_pilotstats/templatetags/pilotstats.py +35 -0
- aa_pilotstats-0.1.0/aa_pilotstats/tests/__init__.py +0 -0
- aa_pilotstats-0.1.0/aa_pilotstats/tests/test_discord.py +259 -0
- aa_pilotstats-0.1.0/aa_pilotstats/tests/test_leaderboard.py +137 -0
- aa_pilotstats-0.1.0/aa_pilotstats/tests/test_migrations.py +48 -0
- aa_pilotstats-0.1.0/aa_pilotstats/tests/test_parsing.py +227 -0
- aa_pilotstats-0.1.0/aa_pilotstats/tests/test_scanner_api.py +157 -0
- aa_pilotstats-0.1.0/aa_pilotstats/tests/test_sources.py +529 -0
- aa_pilotstats-0.1.0/aa_pilotstats/tests/test_upgrade.py +197 -0
- aa_pilotstats-0.1.0/aa_pilotstats/tests/test_views.py +460 -0
- aa_pilotstats-0.1.0/aa_pilotstats/typenames.py +101 -0
- aa_pilotstats-0.1.0/aa_pilotstats/urls.py +23 -0
- aa_pilotstats-0.1.0/aa_pilotstats/views.py +736 -0
- aa_pilotstats-0.1.0/aa_pilotstats/zkill.py +130 -0
- aa_pilotstats-0.1.0/pyproject.toml +39 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Thrainkrilleve
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: aa-pilotstats
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Pilot and fleet stats for Alliance Auth: upload EVE combat logs, attribute stats to characters and mains, and see a fleet leaderboard.
|
|
5
|
+
Project-URL: Homepage, https://github.com/Thrainkrilleve/PilotStats
|
|
6
|
+
Project-URL: Repository, https://github.com/Thrainkrilleve/PilotStats
|
|
7
|
+
Project-URL: Bug Tracker, https://github.com/Thrainkrilleve/PilotStats/issues
|
|
8
|
+
Author: Thrainkrilleve
|
|
9
|
+
License: MIT License
|
|
10
|
+
|
|
11
|
+
Copyright (c) 2026 Thrainkrilleve
|
|
12
|
+
|
|
13
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
14
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
15
|
+
in the Software without restriction, including without limitation the rights
|
|
16
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
17
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
18
|
+
furnished to do so, subject to the following conditions:
|
|
19
|
+
|
|
20
|
+
The above copyright notice and this permission notice shall be included in all
|
|
21
|
+
copies or substantial portions of the Software.
|
|
22
|
+
|
|
23
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
24
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
25
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
26
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
27
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
28
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
29
|
+
SOFTWARE.
|
|
30
|
+
License-File: LICENSE
|
|
31
|
+
Keywords: allianceauth,combat log,dps,eve online,leaderboard,logi
|
|
32
|
+
Classifier: Environment :: Web Environment
|
|
33
|
+
Classifier: Framework :: Django
|
|
34
|
+
Classifier: Framework :: Django :: 5.2
|
|
35
|
+
Classifier: Intended Audience :: Developers
|
|
36
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
37
|
+
Classifier: Operating System :: OS Independent
|
|
38
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
39
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
40
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
41
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
42
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
43
|
+
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
|
|
44
|
+
Requires-Python: >=3.10
|
|
45
|
+
Requires-Dist: allianceauth<6,>=5.0.0
|
|
46
|
+
Requires-Dist: django-esi>=9.0
|
|
47
|
+
Requires-Dist: requests>=2.28
|
|
48
|
+
Description-Content-Type: text/markdown
|
|
49
|
+
|
|
50
|
+
# Pilot Stats
|
|
51
|
+
|
|
52
|
+
> Pilot and fleet stats for [Alliance Auth](https://allianceauth.readthedocs.io/): upload EVE combat logs, attribute stats to characters (and roll alts up to mains), and see a fleet leaderboard.
|
|
53
|
+
|
|
54
|
+
Pilot Stats was called **PvE Tracker** (`aa-pvetracker`) up to v0.0.11. To upgrade an existing install, see [Upgrading from PvE Tracker](#upgrading-from-pve-tracker). Your stored sessions and upload permissions carry over.
|
|
55
|
+
|
|
56
|
+
Each EVE client's combat log only ever records damage *involving that pilot*, so no single file shows a whole fleet's damage. Pilot Stats solves this the same way FAT solves fleet attendance: every pilot uploads their own combat log, the app verifies the log actually belongs to a character on their Alliance Auth account, and the results roll up into one fleet-wide leaderboard.
|
|
57
|
+
|
|
58
|
+
## Status
|
|
59
|
+
|
|
60
|
+
Alliance Auth 5.x only (`allianceauth>=5.0.0,<6`). Alliance Auth 4 is not supported. Combat stats still come from uploaded EVE Gamelog `.txt` files. The current version is in [`aa_pilotstats/__init__.py`](aa_pilotstats/__init__.py), and changes are listed in the [changelog](CHANGELOG.md).
|
|
61
|
+
|
|
62
|
+
Any logged-in member can view the leaderboard, a stored session, and the events list. Uploading and deleting logs needs `pilotstats.basic_access`.
|
|
63
|
+
|
|
64
|
+
A note on naming: the installable/importable package is `aa_pilotstats` (distributed as `aa-pilotstats`), and the Django app *label* is the shorter `pilotstats`. The label is what you see in permission strings (`pilotstats.basic_access`), the URL namespace (`{% url 'pilotstats:...' %}`), table names, and migrations. Test discovery follows the import package, so the suite is `manage.py test aa_pilotstats`, not `pilotstats`.
|
|
65
|
+
|
|
66
|
+
## Features
|
|
67
|
+
|
|
68
|
+
- **Drag-and-drop upload** of one or more Gamelog `.txt` files (from `Documents\EVE\logs\Gamelogs`). It falls back to a plain file picker with no JS. Upload and delete require `pilotstats.basic_access`.
|
|
69
|
+
- **Gamelog folder scanning** on the Upload page, with no install:
|
|
70
|
+
- **Chrome / Edge**: pick the Gamelogs folder once. While the tab stays open, it's rescanned every minute and new or grown logs are uploaded, so an ongoing session refreshes about once a minute. The folder is remembered, so the next visit is one "Resume" click (the browser asks for permission again each visit).
|
|
71
|
+
- **Firefox / Safari**: "Scan a folder once" does the same pass a single time.
|
|
72
|
+
- Logs are read on the pilot's computer, and only logs whose `Listener:` is one of the user's own characters are sent; the server re-checks ownership anyway.
|
|
73
|
+
- By default only logs from the last 7 days go up. A checkbox includes older logs for a one-time backfill.
|
|
74
|
+
- **Ownership-verified attribution** — a log is only accepted if its `Listener:` character is one the uploading user actually owns on Alliance Auth.
|
|
75
|
+
- **Main/alt roll-up** — leaderboard rows are grouped by each user's designated main character, with a per-character breakdown on expand. The grouping lives in `aa_pilotstats.leaderboard` so later Discord and ISK/kill columns can use the same buckets.
|
|
76
|
+
- **Re-uploading a growing log updates the same session.** The EVE client keeps writing to one file per client session. A session is identified by its character plus the log header's `Session Started:` time, so uploading a longer copy replaces that session's totals instead of counting the fight twice.
|
|
77
|
+
- **Fleet leaderboard** for the last 7 days, last 30 days, or all time, with rank badges and sortable damage and rep columns. The 7- and 30-day windows go by when the fight happened (the log's first combat line, in EVE time / UTC), not by when the log was uploaded.
|
|
78
|
+
- **Session page** — the upload-result dashboard (tiles, hit-quality bars, top targets and attackers, recent activity) has a stable URL, linked from My Uploads. Any logged-in member can open it.
|
|
79
|
+
- **My Uploads** shows duration, your last session, and your 30-day damage rank.
|
|
80
|
+
- **Events** lists recent lines from uploaded sessions. One checkbox hides your sessions from that list; leaderboard totals are unchanged. Live tailing is not in this version.
|
|
81
|
+
- **Dashboard widget** with your last-7-days damage and reps, last session, and 7-day damage rank.
|
|
82
|
+
- **Shared section nav** on every page: Leaderboard, Upload, My Uploads, Events. Upload and My Uploads are shown only when you can upload.
|
|
83
|
+
|
|
84
|
+
## Known limitations
|
|
85
|
+
|
|
86
|
+
- **Near-live, not live.** The folder scanner re-uploads a growing log about once a minute while its tab is open; there's no line-by-line live view yet, and closing the tab stops scanning. A desktop watcher that doesn't need an open tab is planned.
|
|
87
|
+
- Sessions uploaded before the "same session" matching was added have no header time stored, so a re-upload of one of those logs is stored as a new session; delete the old one from My Uploads.
|
|
88
|
+
- **Only the combat log has DPS.** ESI has no combat or damage data. Payouts, rat counts, killmails and fleet rosters sit next to the Gamelog numbers. Damage, payout ISK, and kill value are never added together.
|
|
89
|
+
- **Payouts lag up to an hour.** ESI caches the wallet journal for an hour, and the journal only goes back 30 days, so payouts from before a pilot connected their wallet (older than 30 days) can't be fetched.
|
|
90
|
+
- **Killmails are mostly PvP.** Killing rats makes no killmail, so the kill columns don't reflect ratting; "Rats" (from bounty ticks) does. Killmail damage is only damage on killmails.
|
|
91
|
+
- **`reps_given_total` is an estimate.** The regex for a logi pilot's own *outgoing* remote-repair line was written by mirroring the incoming-rep line shape, since a real logi pilot's log was not available to test against. If the numbers look off, open an issue with a sample line (amounts and names redacted is fine).
|
|
92
|
+
- **Trust model**: a log's *character* has to be one you own via Alliance Auth, but the *numbers in it* are still whatever that client wrote to disk.
|
|
93
|
+
|
|
94
|
+
## Requirements
|
|
95
|
+
|
|
96
|
+
- Python >= 3.10
|
|
97
|
+
- Alliance Auth >= 5.0.0, < 6
|
|
98
|
+
- Redis (Alliance Auth already requires it)
|
|
99
|
+
|
|
100
|
+
## Installation
|
|
101
|
+
|
|
102
|
+
1. Install the package:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
pip install aa-pilotstats
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
2. Add `"aa_pilotstats"` to `INSTALLED_APPS` in your Alliance Auth settings file (e.g. `local.py`).
|
|
109
|
+
|
|
110
|
+
3. Rebuild the image, run migrations, and collect static files:
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
docker compose build
|
|
114
|
+
docker compose exec allianceauth_gunicorn bash -c "auth migrate && auth collectstatic --noinput"
|
|
115
|
+
docker compose up -d
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
4. Grant `pilotstats.basic_access` to the group(s) that should upload and delete logs. Viewing does not need it: any logged-in member can open the leaderboard, sessions, and events.
|
|
119
|
+
|
|
120
|
+
5. Schedule the background tasks in `local.py`:
|
|
121
|
+
|
|
122
|
+
```python
|
|
123
|
+
from celery.schedules import crontab
|
|
124
|
+
|
|
125
|
+
CELERYBEAT_SCHEDULE["pilotstats_pull_wallet_journals"] = {
|
|
126
|
+
"task": "aa_pilotstats.tasks.pull_all_wallet_journals",
|
|
127
|
+
"schedule": crontab(minute="7"), # hourly; ESI caches the journal for an hour
|
|
128
|
+
}
|
|
129
|
+
CELERYBEAT_SCHEDULE["pilotstats_drain_r2z2"] = {
|
|
130
|
+
"task": "aa_pilotstats.tasks.drain_r2z2",
|
|
131
|
+
"schedule": crontab(minute="*"), # zKill killmails, every minute
|
|
132
|
+
}
|
|
133
|
+
CELERYBEAT_SCHEDULE["pilotstats_poll_tracked_fleets"] = {
|
|
134
|
+
"task": "aa_pilotstats.tasks.poll_tracked_fleets",
|
|
135
|
+
"schedule": crontab(minute="*"), # fleet rosters, every minute (idle when none tracked)
|
|
136
|
+
}
|
|
137
|
+
CELERYBEAT_SCHEDULE["pilotstats_purge_old_payouts"] = {
|
|
138
|
+
"task": "aa_pilotstats.tasks.purge_old_payouts",
|
|
139
|
+
"schedule": crontab(minute="23", hour="4"),
|
|
140
|
+
}
|
|
141
|
+
CELERYBEAT_SCHEDULE["pilotstats_post_discord_daily"] = {
|
|
142
|
+
"task": "aa_pilotstats.tasks.post_discord_daily",
|
|
143
|
+
"schedule": crontab(minute="*/5"), # posts once a day at the time set in admin
|
|
144
|
+
}
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
Skip a task to turn its source off. The Gamelog features don't need any of them.
|
|
148
|
+
|
|
149
|
+
## Data sources
|
|
150
|
+
|
|
151
|
+
| Source | What it adds | How it's collected | Needs |
|
|
152
|
+
|---|---|---|---|
|
|
153
|
+
| Gamelog | DPS, hit quality, reps | Upload, drag-and-drop, or the folder scanner | `pilotstats.basic_access` |
|
|
154
|
+
| ESI wallet journal | Payout ISK (bounty, ESS, mission), rats killed | Hourly per character that connected its wallet | Optional per pilot: `esi-wallet.read_character_wallet.v1` |
|
|
155
|
+
| zKillboard R2Z2 | Kills, losses, ISK destroyed/lost, killmail damage | Every minute from zKill's public feed | Nothing from pilots |
|
|
156
|
+
| ESI fleet | Who was in a fleet, hull, combat-log coverage | Every minute while a fleet is tracked | Optional, fleet boss only: `esi-fleets.read_fleet.v1` |
|
|
157
|
+
|
|
158
|
+
**What's stored, and what isn't:**
|
|
159
|
+
- **Wallet:**
|
|
160
|
+
- Kept: character, time, type, amount and journal id for bounty, ESS and mission payout lines only. For bounty ticks, the per-NPC-type kill counts are derived from the line.
|
|
161
|
+
- Never stored: balance, other transactions, `*_tax` lines, the other party, or the line's raw text.
|
|
162
|
+
- Itemized lines are kept for 35 days; daily totals for longer.
|
|
163
|
+
- A pilot can untick their wallet any time ("Don't read my wallet" on Events), which also deletes what was stored.
|
|
164
|
+
- **zKill:** a mail is kept only when one of your Auth characters in a tracked corporation or alliance is on it, and only those characters are stored.
|
|
165
|
+
- By default, the corps and alliances of mains in the `Member` state are tracked.
|
|
166
|
+
- Edit the list under *Admin → Pilot Stats → tracked corporations and alliances*.
|
|
167
|
+
- **Fleets:** pilot id, hull, and first and last time seen. Tracking stops by itself when the boss leaves or hands over the fleet.
|
|
168
|
+
|
|
169
|
+
ESI calls use django-esi's client with a pinned compatibility date (`PILOTSTATS_ESI_COMPATIBILITY_DATE`) and its built-in ETag and rate-limit handling. Only the wallet journal, character fleet and fleet members routes are called.
|
|
170
|
+
|
|
171
|
+
## Discord feed
|
|
172
|
+
|
|
173
|
+
Posts to one Discord channel through a webhook. There are no bot or slash commands. Set it up under *Admin → Pilot Stats → Discord settings*:
|
|
174
|
+
|
|
175
|
+
1. In Discord, go to the channel's *Settings → Integrations → Webhooks → New Webhook → Copy Webhook URL*.
|
|
176
|
+
2. Paste it into **webhook URL**, tick **enabled**, and save. The URL is stored in the database only and is never shown again; leave the field blank to keep it.
|
|
177
|
+
3. Select the settings row and run **Send a test message to the webhook**.
|
|
178
|
+
|
|
179
|
+
**What gets posted:**
|
|
180
|
+
- **Daily top 10**: once a day at the set time and time zone (default 11:05 UTC, after EVE downtime).
|
|
181
|
+
- Top 10 for damage dealt and for payout ISK over the last 24 hours, plus the biggest kills and losses.
|
|
182
|
+
- Pilots are grouped by main, like the leaderboard.
|
|
183
|
+
- **Major events**, as they happen:
|
|
184
|
+
- A single payout line at or over the payout threshold (default 300M). These arrive up to an hour late, because ESI caches the wallet journal.
|
|
185
|
+
- A member's kill or loss at or over the kill threshold (default 300M).
|
|
186
|
+
- New **fleet records** (and personal records, after five sessions) for session damage and session DPS.
|
|
187
|
+
- A new fleet record for one main's payouts in a day.
|
|
188
|
+
- Event posts are capped per hour (default 6); extras are skipped, not queued. The daily post is never capped.
|
|
189
|
+
- Each post goes out once (there's a log under *Discord posts*), only names and numbers are sent, and nobody is ever pinged. Keep in mind the channel may be visible to people who aren't on Auth.
|
|
190
|
+
|
|
191
|
+
## Settings
|
|
192
|
+
|
|
193
|
+
Optional, in `local.py`:
|
|
194
|
+
|
|
195
|
+
| Setting | Default | What it does |
|
|
196
|
+
|---|---|---|
|
|
197
|
+
| `PILOTSTATS_SCANNER_UPLOADS_PER_MINUTE` | `30` | Most uploads one user's folder scanner (or multi-file drop) may send per minute. Over it, the server answers 429 and the scanner waits. `0` turns the limit off. The plain upload form is never limited. |
|
|
198
|
+
| `PILOTSTATS_SCANNER_RECENT_DAYS` | `7` | The scanner only sends logs modified in the last N days unless "include older logs" is ticked. |
|
|
199
|
+
| `PILOTSTATS_ESI_COMPATIBILITY_DATE` | `"2026-11-19"` | ESI compatibility date sent on every call. Bump it only after checking CCP's ESI changelog. |
|
|
200
|
+
| `PILOTSTATS_PAYOUT_RETENTION_DAYS` | `35` | Days itemized payout lines are kept (daily totals are kept longer). |
|
|
201
|
+
| `PILOTSTATS_SESSION_LINK_MINUTES` | `15` | How far before and after a session payouts, kills and fleet hulls are matched to it. |
|
|
202
|
+
| `PILOTSTATS_ZKILL_AUTO_STATES` | `["Member"]` | Auth states whose mains' corporations and alliances are tracked on zKill automatically. |
|
|
203
|
+
| `PILOTSTATS_R2Z2_MAX_PER_RUN` | `300` | zKill sequence files read per run of `drain_r2z2`. |
|
|
204
|
+
| `PILOTSTATS_R2Z2_REQUEST_INTERVAL` | `0.15` | Seconds between zKill requests (their limit is 15 a second per IP). |
|
|
205
|
+
| `PILOTSTATS_USER_AGENT` | `aa-pilotstats/<version> (+repo URL)` | User-Agent for zKill and the SDE. zKill asks for a real one; you can add your site's contact. |
|
|
206
|
+
|
|
207
|
+
## Upgrading from PvE Tracker
|
|
208
|
+
|
|
209
|
+
Pilot Stats takes over a PvE Tracker install in place. Its first migration renames the `pvetracker_*` tables to `pilotstats_*` with every row, moves the permission so existing `basic_access` group grants keep working, and removes PvE Tracker's migration history. The database index and constraint names keep their old `pvetracker_` prefix; that's expected.
|
|
210
|
+
|
|
211
|
+
1. Back up the database.
|
|
212
|
+
2. Swap the package:
|
|
213
|
+
|
|
214
|
+
```bash
|
|
215
|
+
pip uninstall aa-pvetracker
|
|
216
|
+
pip install aa-pilotstats
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
On Docker, change `aa-pvetracker` to `aa-pilotstats` in `conf/requirements.txt` and rebuild the image.
|
|
220
|
+
3. In `local.py`, replace `"aa_pvetracker"` with `"aa_pilotstats"` in `INSTALLED_APPS`. If both are listed, Auth refuses to start with check `pilotstats.E001`.
|
|
221
|
+
4. Run migrations and collect static files, then restart Auth:
|
|
222
|
+
|
|
223
|
+
```bash
|
|
224
|
+
auth migrate
|
|
225
|
+
auth collectstatic --noinput
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
Old links keep working: `/pvetracker/...` redirects permanently to `/pilotstats/...`.
|
|
229
|
+
|
|
230
|
+
## Development
|
|
231
|
+
|
|
232
|
+
The SQLite harness (`manage.py`, `settings_dev.py`, `urls_dev.py`) runs the parser tests, the leaderboard-helper tests, and the Django view tests. Alliance Auth's own system checks need a Redis server and the placeholder settings in `settings_dev.py` (every URL there is `https://example.com`; nothing in that file is a credential).
|
|
233
|
+
|
|
234
|
+
```bash
|
|
235
|
+
python -m pip install "allianceauth==5.6.0"
|
|
236
|
+
python -m pip install -e . --no-deps
|
|
237
|
+
|
|
238
|
+
# no database: parser + roll-up helper
|
|
239
|
+
python -m unittest aa_pilotstats.tests.test_parsing aa_pilotstats.tests.test_leaderboard
|
|
240
|
+
|
|
241
|
+
# full suite, including views (Redis on localhost:6379)
|
|
242
|
+
python manage.py test aa_pilotstats
|
|
243
|
+
|
|
244
|
+
# migration matches the models:
|
|
245
|
+
python manage.py makemigrations pilotstats --check --dry-run
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
`settings_dev.py` is not a production settings file. Confirm the pages against your real Alliance Auth theme in the Auth container when you care about Bootswatch colors; the nested leaderboard detail table is styled with the app's own classes for that reason.
|
|
249
|
+
|
|
250
|
+
GitHub Actions runs `python manage.py test aa_pilotstats` and the `makemigrations --check` step on Python 3.12 with Redis 7.4, against both the oldest supported Alliance Auth (5.0.0) and 5.6.0.
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
# Pilot Stats
|
|
2
|
+
|
|
3
|
+
> Pilot and fleet stats for [Alliance Auth](https://allianceauth.readthedocs.io/): upload EVE combat logs, attribute stats to characters (and roll alts up to mains), and see a fleet leaderboard.
|
|
4
|
+
|
|
5
|
+
Pilot Stats was called **PvE Tracker** (`aa-pvetracker`) up to v0.0.11. To upgrade an existing install, see [Upgrading from PvE Tracker](#upgrading-from-pve-tracker). Your stored sessions and upload permissions carry over.
|
|
6
|
+
|
|
7
|
+
Each EVE client's combat log only ever records damage *involving that pilot*, so no single file shows a whole fleet's damage. Pilot Stats solves this the same way FAT solves fleet attendance: every pilot uploads their own combat log, the app verifies the log actually belongs to a character on their Alliance Auth account, and the results roll up into one fleet-wide leaderboard.
|
|
8
|
+
|
|
9
|
+
## Status
|
|
10
|
+
|
|
11
|
+
Alliance Auth 5.x only (`allianceauth>=5.0.0,<6`). Alliance Auth 4 is not supported. Combat stats still come from uploaded EVE Gamelog `.txt` files. The current version is in [`aa_pilotstats/__init__.py`](aa_pilotstats/__init__.py), and changes are listed in the [changelog](CHANGELOG.md).
|
|
12
|
+
|
|
13
|
+
Any logged-in member can view the leaderboard, a stored session, and the events list. Uploading and deleting logs needs `pilotstats.basic_access`.
|
|
14
|
+
|
|
15
|
+
A note on naming: the installable/importable package is `aa_pilotstats` (distributed as `aa-pilotstats`), and the Django app *label* is the shorter `pilotstats`. The label is what you see in permission strings (`pilotstats.basic_access`), the URL namespace (`{% url 'pilotstats:...' %}`), table names, and migrations. Test discovery follows the import package, so the suite is `manage.py test aa_pilotstats`, not `pilotstats`.
|
|
16
|
+
|
|
17
|
+
## Features
|
|
18
|
+
|
|
19
|
+
- **Drag-and-drop upload** of one or more Gamelog `.txt` files (from `Documents\EVE\logs\Gamelogs`). It falls back to a plain file picker with no JS. Upload and delete require `pilotstats.basic_access`.
|
|
20
|
+
- **Gamelog folder scanning** on the Upload page, with no install:
|
|
21
|
+
- **Chrome / Edge**: pick the Gamelogs folder once. While the tab stays open, it's rescanned every minute and new or grown logs are uploaded, so an ongoing session refreshes about once a minute. The folder is remembered, so the next visit is one "Resume" click (the browser asks for permission again each visit).
|
|
22
|
+
- **Firefox / Safari**: "Scan a folder once" does the same pass a single time.
|
|
23
|
+
- Logs are read on the pilot's computer, and only logs whose `Listener:` is one of the user's own characters are sent; the server re-checks ownership anyway.
|
|
24
|
+
- By default only logs from the last 7 days go up. A checkbox includes older logs for a one-time backfill.
|
|
25
|
+
- **Ownership-verified attribution** — a log is only accepted if its `Listener:` character is one the uploading user actually owns on Alliance Auth.
|
|
26
|
+
- **Main/alt roll-up** — leaderboard rows are grouped by each user's designated main character, with a per-character breakdown on expand. The grouping lives in `aa_pilotstats.leaderboard` so later Discord and ISK/kill columns can use the same buckets.
|
|
27
|
+
- **Re-uploading a growing log updates the same session.** The EVE client keeps writing to one file per client session. A session is identified by its character plus the log header's `Session Started:` time, so uploading a longer copy replaces that session's totals instead of counting the fight twice.
|
|
28
|
+
- **Fleet leaderboard** for the last 7 days, last 30 days, or all time, with rank badges and sortable damage and rep columns. The 7- and 30-day windows go by when the fight happened (the log's first combat line, in EVE time / UTC), not by when the log was uploaded.
|
|
29
|
+
- **Session page** — the upload-result dashboard (tiles, hit-quality bars, top targets and attackers, recent activity) has a stable URL, linked from My Uploads. Any logged-in member can open it.
|
|
30
|
+
- **My Uploads** shows duration, your last session, and your 30-day damage rank.
|
|
31
|
+
- **Events** lists recent lines from uploaded sessions. One checkbox hides your sessions from that list; leaderboard totals are unchanged. Live tailing is not in this version.
|
|
32
|
+
- **Dashboard widget** with your last-7-days damage and reps, last session, and 7-day damage rank.
|
|
33
|
+
- **Shared section nav** on every page: Leaderboard, Upload, My Uploads, Events. Upload and My Uploads are shown only when you can upload.
|
|
34
|
+
|
|
35
|
+
## Known limitations
|
|
36
|
+
|
|
37
|
+
- **Near-live, not live.** The folder scanner re-uploads a growing log about once a minute while its tab is open; there's no line-by-line live view yet, and closing the tab stops scanning. A desktop watcher that doesn't need an open tab is planned.
|
|
38
|
+
- Sessions uploaded before the "same session" matching was added have no header time stored, so a re-upload of one of those logs is stored as a new session; delete the old one from My Uploads.
|
|
39
|
+
- **Only the combat log has DPS.** ESI has no combat or damage data. Payouts, rat counts, killmails and fleet rosters sit next to the Gamelog numbers. Damage, payout ISK, and kill value are never added together.
|
|
40
|
+
- **Payouts lag up to an hour.** ESI caches the wallet journal for an hour, and the journal only goes back 30 days, so payouts from before a pilot connected their wallet (older than 30 days) can't be fetched.
|
|
41
|
+
- **Killmails are mostly PvP.** Killing rats makes no killmail, so the kill columns don't reflect ratting; "Rats" (from bounty ticks) does. Killmail damage is only damage on killmails.
|
|
42
|
+
- **`reps_given_total` is an estimate.** The regex for a logi pilot's own *outgoing* remote-repair line was written by mirroring the incoming-rep line shape, since a real logi pilot's log was not available to test against. If the numbers look off, open an issue with a sample line (amounts and names redacted is fine).
|
|
43
|
+
- **Trust model**: a log's *character* has to be one you own via Alliance Auth, but the *numbers in it* are still whatever that client wrote to disk.
|
|
44
|
+
|
|
45
|
+
## Requirements
|
|
46
|
+
|
|
47
|
+
- Python >= 3.10
|
|
48
|
+
- Alliance Auth >= 5.0.0, < 6
|
|
49
|
+
- Redis (Alliance Auth already requires it)
|
|
50
|
+
|
|
51
|
+
## Installation
|
|
52
|
+
|
|
53
|
+
1. Install the package:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
pip install aa-pilotstats
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
2. Add `"aa_pilotstats"` to `INSTALLED_APPS` in your Alliance Auth settings file (e.g. `local.py`).
|
|
60
|
+
|
|
61
|
+
3. Rebuild the image, run migrations, and collect static files:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
docker compose build
|
|
65
|
+
docker compose exec allianceauth_gunicorn bash -c "auth migrate && auth collectstatic --noinput"
|
|
66
|
+
docker compose up -d
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
4. Grant `pilotstats.basic_access` to the group(s) that should upload and delete logs. Viewing does not need it: any logged-in member can open the leaderboard, sessions, and events.
|
|
70
|
+
|
|
71
|
+
5. Schedule the background tasks in `local.py`:
|
|
72
|
+
|
|
73
|
+
```python
|
|
74
|
+
from celery.schedules import crontab
|
|
75
|
+
|
|
76
|
+
CELERYBEAT_SCHEDULE["pilotstats_pull_wallet_journals"] = {
|
|
77
|
+
"task": "aa_pilotstats.tasks.pull_all_wallet_journals",
|
|
78
|
+
"schedule": crontab(minute="7"), # hourly; ESI caches the journal for an hour
|
|
79
|
+
}
|
|
80
|
+
CELERYBEAT_SCHEDULE["pilotstats_drain_r2z2"] = {
|
|
81
|
+
"task": "aa_pilotstats.tasks.drain_r2z2",
|
|
82
|
+
"schedule": crontab(minute="*"), # zKill killmails, every minute
|
|
83
|
+
}
|
|
84
|
+
CELERYBEAT_SCHEDULE["pilotstats_poll_tracked_fleets"] = {
|
|
85
|
+
"task": "aa_pilotstats.tasks.poll_tracked_fleets",
|
|
86
|
+
"schedule": crontab(minute="*"), # fleet rosters, every minute (idle when none tracked)
|
|
87
|
+
}
|
|
88
|
+
CELERYBEAT_SCHEDULE["pilotstats_purge_old_payouts"] = {
|
|
89
|
+
"task": "aa_pilotstats.tasks.purge_old_payouts",
|
|
90
|
+
"schedule": crontab(minute="23", hour="4"),
|
|
91
|
+
}
|
|
92
|
+
CELERYBEAT_SCHEDULE["pilotstats_post_discord_daily"] = {
|
|
93
|
+
"task": "aa_pilotstats.tasks.post_discord_daily",
|
|
94
|
+
"schedule": crontab(minute="*/5"), # posts once a day at the time set in admin
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Skip a task to turn its source off. The Gamelog features don't need any of them.
|
|
99
|
+
|
|
100
|
+
## Data sources
|
|
101
|
+
|
|
102
|
+
| Source | What it adds | How it's collected | Needs |
|
|
103
|
+
|---|---|---|---|
|
|
104
|
+
| Gamelog | DPS, hit quality, reps | Upload, drag-and-drop, or the folder scanner | `pilotstats.basic_access` |
|
|
105
|
+
| ESI wallet journal | Payout ISK (bounty, ESS, mission), rats killed | Hourly per character that connected its wallet | Optional per pilot: `esi-wallet.read_character_wallet.v1` |
|
|
106
|
+
| zKillboard R2Z2 | Kills, losses, ISK destroyed/lost, killmail damage | Every minute from zKill's public feed | Nothing from pilots |
|
|
107
|
+
| ESI fleet | Who was in a fleet, hull, combat-log coverage | Every minute while a fleet is tracked | Optional, fleet boss only: `esi-fleets.read_fleet.v1` |
|
|
108
|
+
|
|
109
|
+
**What's stored, and what isn't:**
|
|
110
|
+
- **Wallet:**
|
|
111
|
+
- Kept: character, time, type, amount and journal id for bounty, ESS and mission payout lines only. For bounty ticks, the per-NPC-type kill counts are derived from the line.
|
|
112
|
+
- Never stored: balance, other transactions, `*_tax` lines, the other party, or the line's raw text.
|
|
113
|
+
- Itemized lines are kept for 35 days; daily totals for longer.
|
|
114
|
+
- A pilot can untick their wallet any time ("Don't read my wallet" on Events), which also deletes what was stored.
|
|
115
|
+
- **zKill:** a mail is kept only when one of your Auth characters in a tracked corporation or alliance is on it, and only those characters are stored.
|
|
116
|
+
- By default, the corps and alliances of mains in the `Member` state are tracked.
|
|
117
|
+
- Edit the list under *Admin → Pilot Stats → tracked corporations and alliances*.
|
|
118
|
+
- **Fleets:** pilot id, hull, and first and last time seen. Tracking stops by itself when the boss leaves or hands over the fleet.
|
|
119
|
+
|
|
120
|
+
ESI calls use django-esi's client with a pinned compatibility date (`PILOTSTATS_ESI_COMPATIBILITY_DATE`) and its built-in ETag and rate-limit handling. Only the wallet journal, character fleet and fleet members routes are called.
|
|
121
|
+
|
|
122
|
+
## Discord feed
|
|
123
|
+
|
|
124
|
+
Posts to one Discord channel through a webhook. There are no bot or slash commands. Set it up under *Admin → Pilot Stats → Discord settings*:
|
|
125
|
+
|
|
126
|
+
1. In Discord, go to the channel's *Settings → Integrations → Webhooks → New Webhook → Copy Webhook URL*.
|
|
127
|
+
2. Paste it into **webhook URL**, tick **enabled**, and save. The URL is stored in the database only and is never shown again; leave the field blank to keep it.
|
|
128
|
+
3. Select the settings row and run **Send a test message to the webhook**.
|
|
129
|
+
|
|
130
|
+
**What gets posted:**
|
|
131
|
+
- **Daily top 10**: once a day at the set time and time zone (default 11:05 UTC, after EVE downtime).
|
|
132
|
+
- Top 10 for damage dealt and for payout ISK over the last 24 hours, plus the biggest kills and losses.
|
|
133
|
+
- Pilots are grouped by main, like the leaderboard.
|
|
134
|
+
- **Major events**, as they happen:
|
|
135
|
+
- A single payout line at or over the payout threshold (default 300M). These arrive up to an hour late, because ESI caches the wallet journal.
|
|
136
|
+
- A member's kill or loss at or over the kill threshold (default 300M).
|
|
137
|
+
- New **fleet records** (and personal records, after five sessions) for session damage and session DPS.
|
|
138
|
+
- A new fleet record for one main's payouts in a day.
|
|
139
|
+
- Event posts are capped per hour (default 6); extras are skipped, not queued. The daily post is never capped.
|
|
140
|
+
- Each post goes out once (there's a log under *Discord posts*), only names and numbers are sent, and nobody is ever pinged. Keep in mind the channel may be visible to people who aren't on Auth.
|
|
141
|
+
|
|
142
|
+
## Settings
|
|
143
|
+
|
|
144
|
+
Optional, in `local.py`:
|
|
145
|
+
|
|
146
|
+
| Setting | Default | What it does |
|
|
147
|
+
|---|---|---|
|
|
148
|
+
| `PILOTSTATS_SCANNER_UPLOADS_PER_MINUTE` | `30` | Most uploads one user's folder scanner (or multi-file drop) may send per minute. Over it, the server answers 429 and the scanner waits. `0` turns the limit off. The plain upload form is never limited. |
|
|
149
|
+
| `PILOTSTATS_SCANNER_RECENT_DAYS` | `7` | The scanner only sends logs modified in the last N days unless "include older logs" is ticked. |
|
|
150
|
+
| `PILOTSTATS_ESI_COMPATIBILITY_DATE` | `"2026-11-19"` | ESI compatibility date sent on every call. Bump it only after checking CCP's ESI changelog. |
|
|
151
|
+
| `PILOTSTATS_PAYOUT_RETENTION_DAYS` | `35` | Days itemized payout lines are kept (daily totals are kept longer). |
|
|
152
|
+
| `PILOTSTATS_SESSION_LINK_MINUTES` | `15` | How far before and after a session payouts, kills and fleet hulls are matched to it. |
|
|
153
|
+
| `PILOTSTATS_ZKILL_AUTO_STATES` | `["Member"]` | Auth states whose mains' corporations and alliances are tracked on zKill automatically. |
|
|
154
|
+
| `PILOTSTATS_R2Z2_MAX_PER_RUN` | `300` | zKill sequence files read per run of `drain_r2z2`. |
|
|
155
|
+
| `PILOTSTATS_R2Z2_REQUEST_INTERVAL` | `0.15` | Seconds between zKill requests (their limit is 15 a second per IP). |
|
|
156
|
+
| `PILOTSTATS_USER_AGENT` | `aa-pilotstats/<version> (+repo URL)` | User-Agent for zKill and the SDE. zKill asks for a real one; you can add your site's contact. |
|
|
157
|
+
|
|
158
|
+
## Upgrading from PvE Tracker
|
|
159
|
+
|
|
160
|
+
Pilot Stats takes over a PvE Tracker install in place. Its first migration renames the `pvetracker_*` tables to `pilotstats_*` with every row, moves the permission so existing `basic_access` group grants keep working, and removes PvE Tracker's migration history. The database index and constraint names keep their old `pvetracker_` prefix; that's expected.
|
|
161
|
+
|
|
162
|
+
1. Back up the database.
|
|
163
|
+
2. Swap the package:
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
pip uninstall aa-pvetracker
|
|
167
|
+
pip install aa-pilotstats
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
On Docker, change `aa-pvetracker` to `aa-pilotstats` in `conf/requirements.txt` and rebuild the image.
|
|
171
|
+
3. In `local.py`, replace `"aa_pvetracker"` with `"aa_pilotstats"` in `INSTALLED_APPS`. If both are listed, Auth refuses to start with check `pilotstats.E001`.
|
|
172
|
+
4. Run migrations and collect static files, then restart Auth:
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
auth migrate
|
|
176
|
+
auth collectstatic --noinput
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
Old links keep working: `/pvetracker/...` redirects permanently to `/pilotstats/...`.
|
|
180
|
+
|
|
181
|
+
## Development
|
|
182
|
+
|
|
183
|
+
The SQLite harness (`manage.py`, `settings_dev.py`, `urls_dev.py`) runs the parser tests, the leaderboard-helper tests, and the Django view tests. Alliance Auth's own system checks need a Redis server and the placeholder settings in `settings_dev.py` (every URL there is `https://example.com`; nothing in that file is a credential).
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
python -m pip install "allianceauth==5.6.0"
|
|
187
|
+
python -m pip install -e . --no-deps
|
|
188
|
+
|
|
189
|
+
# no database: parser + roll-up helper
|
|
190
|
+
python -m unittest aa_pilotstats.tests.test_parsing aa_pilotstats.tests.test_leaderboard
|
|
191
|
+
|
|
192
|
+
# full suite, including views (Redis on localhost:6379)
|
|
193
|
+
python manage.py test aa_pilotstats
|
|
194
|
+
|
|
195
|
+
# migration matches the models:
|
|
196
|
+
python manage.py makemigrations pilotstats --check --dry-run
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
`settings_dev.py` is not a production settings file. Confirm the pages against your real Alliance Auth theme in the Auth container when you care about Bootswatch colors; the nested leaderboard detail table is styled with the app's own classes for that reason.
|
|
200
|
+
|
|
201
|
+
GitHub Actions runs `python manage.py test aa_pilotstats` and the `makemigrations --check` step on Python 3.12 with Redis 7.4, against both the oldest supported Alliance Auth (5.0.0) and 5.6.0.
|