feature: add highscore military points built, destroyed, lost#1106
feature: add highscore military points built, destroyed, lost#1106rbardtke wants to merge 3 commits into
Conversation
Preview deploymentPreview environment for this PR is ready for functional testing. Use one of the test accounts below to log in.
Test accounts (click to expand)
This preview will be automatically destroyed when the PR is closed. |
|
Hi @rbardtke, nice work on this! Quite an extensive feature! I tested the migration on a local version of the database of main.ogamex.dev with 1k users + few test users. And this seems to work fine! I did however notice a small issue on my local version where the military subtabs are not showing up:
However on the PR preview environment this works fine, so not sure what causes this (?). Another thing: the migration So to make it easier for existing installations, would you be willing to look into automatically running this migration as part of the database migrations? I prefer to keep the upgrade path for existing installations as smooth as possible without the need to run any manual commands (if not super necessary). |
@lanedirt i tried to recreate this, i seeded my databases with 20k battle reports, the command as you said was pretty fast. The subcategories appear on my local instance, the only case i can imagine, the columns are missing, could you check this? |
|
@rbardtke here's the var_dump output. And as I just tested it again to confirm: the extra buttons are (again) not appearing. $ docker compose exec ogamex-app php artisan tinker --execute="
\$highscore = \OGame\Models\Highscore::first();
var_dump([
'has_military_destroyed' => isset(\$highscore->military_destroyed),
'has_military_lost' => isset(\$highscore->military_lost),
'destroyed_rank' => \$highscore->military_destroyed_rank ?? 'NULL',
'lost_rank' => \$highscore->military_lost_rank ?? 'NULL',
]);
"
array(4) {
["has_military_destroyed"]=>
bool(true)
["has_military_lost"]=>
bool(true)
["destroyed_rank"]=>
int(1)
["lost_rank"]=>
int(30)
}
|
|
I just pulled this branch and everything seems to be working fine. I seeded the database with 500 users and 20000 combat reports and then ran the migration, followed by the highscore generation commands. Everything was processed in a couple seconds. For me all four subtabs are appearing with the appropriate data. |


Description
add highscore military points built, destroyed, lost
Type of Change:
Related Issues
Fixes #947
Checklist
Before submitting this pull request, ensure all following requirements as outlined in CONTRIBUTING.md are met:
Additional Information
Military Highscore Subcategories - Migration Guide
This guide covers the one-time migration process for existing game instances to populate military destroyed/lost statistics from historical battle reports.
Overview
The military highscore subcategories feature adds three separate highscore categories:
For new game instances, these statistics are tracked automatically. For existing instances with battle history, a one-time migration is needed.
Migration Steps
1. Run Database Migrations
First, apply the database schema changes:
docker compose exec ogamex-app php artisan migrateThis creates the necessary columns in the
highscoresanduserstables.2. Test Migration (Dry Run)
Before applying changes, test the migration to see what will happen:
docker compose exec ogamex-app php artisan ogamex:migrate:military-statistics --dry-runThis will:
3. Run Migration
Once you've verified the dry run results, apply the migration:
docker compose exec ogamex-app php artisan ogamex:migrate:military-statisticsThis will:
4. Generate Highscores
After migration, update the highscore data:
docker compose exec ogamex-app php artisan ogamex:scheduler:generate-highscoresThis populates the highscore table with the migrated statistics.
5. Generate Rankings
Finally, calculate the rankings for all subcategories:
docker compose exec ogamex-app php artisan ogamex:scheduler:generate-highscore-ranksThis creates the rankings for built, destroyed, and lost subcategories.