Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Planetary contents information in character_planet_contents is missing items #922

Open
Weyland opened this issue Feb 22, 2025 · 2 comments

Comments

@Weyland
Copy link

Weyland commented Feb 22, 2025

When working on the planetary industry plugin from Jay, I noticed that some of the contents of a storage container (launchpad or storage facility) are missing.

Queried the API and the information is correct. A snippet from the EVE ESI API.

    {
      "contents": [
        {
          "amount": 8320,
          "type_id": 2401
        },
        {
          "amount": 8320,
          "type_id": 3779
        },
        {
          "amount": 8320,
          "type_id": 2389
        },
        {
          "amount": 8320,
          "type_id": 2393
        },
        {
          "amount": 8320,
          "type_id": 2396
        },
        {
          "amount": 8320,
          "type_id": 2397
        }
      ],
      "latitude": 1.0240000486373901,
      "longitude": 1.6139999628067017,
      "pin_id": 1048262989138,
      "type_id": 2544
    },

However, in the database I only find:

id character_id planet_id pin_id type_id amount created_at updated_at
9681 2116479808 40113382 1048262989138 2393 8320 2025-02-22 22:45:08 2025-02-22 22:45:08
9682 2116479808 40113382 1048262989138 2396 8320 2025-02-22 22:45:08 2025-02-22 22:45:08
9683 2116479808 40113382 1048262989138 2397 8320 2025-02-22 22:45:08 2025-02-22 22:45:08
9680 2116479808 40113382 1048262989138 2389 8320 2025-02-22 22:45:08 2025-02-22 22:45:08

I've been trying to figure out why this is happening but to no avail so far.

The 3 planets, that are on this character, have overlapping contents across multiple planets in the same system and I think this has something to do with the problem:

To make it easier, I listed the contents of 2 planets and their launchpad.

X - Hazmat Detection System
	Bacteria
	Biofuels
	Biomass
	Chiral Structures
	Industrial Fibers
	Plasmoids

XI - Planetary Vehicles
	Biomass
	Chiral Structures
	Oxygen
	Precious Metals
	Reactive Metals
	Silicon

Image

In this case, one planet contains all 6 resources (6 database rows) in the launchpad, the second doesn't contain all 6 resources but only 4 (4 database rows) and 2401 (Chiral Structures) and 3779 (Biomass) are missing from the database table but are in the API endpoint response (which I've included in full, just in case).

Coincidentally, these are also the two P1 that are on both planets... Which is a maybe a clue to where the problem could be...

esi_response.json

I was looking at the code but couldn't really determine what could be the issue. Perhaps a bug in the model itself?

Any help would be really appreciated!

  • SDE Version sde-20241218-TRANQUILITY | Docker Version 5.0.69
@Weyland
Copy link
Author

Weyland commented Feb 26, 2025

Just adding this here as it might be useful: https://discord.com/channels/821361165791133716/821361505735278592/1344346474531655710

@Weyland
Copy link
Author

Weyland commented Mar 1, 2025

The issue seems to be related to cleanContents (code).

If multiple characters have different planet_ids but share the same type_id, this query deletes valid records because it only filters by character_id and type_id without considering planet_id.

I think the solution would be to:

CharacterPlanetContent::where('character_id', $this->getCharacterId())
    ->where('planet_id', $this->planet_id) //  Fix: Ensure we only delete from the correct planet!
    ->where('type_id', $type['type_id'])
    ->whereNotIn('pin_id', $pins->pluck('pin_id'))
    ->delete();

Going to test this and see if it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant