Skip to content
This repository was archived by the owner on Apr 29, 2025. It is now read-only.

fix(server/vehicle): vehicle not saving to db if no coords passed (#208)#210

Merged
thelindat merged 3 commits intooverextended:mainfrom
andreutu:main
Nov 24, 2024
Merged

fix(server/vehicle): vehicle not saving to db if no coords passed (#208)#210
thelindat merged 3 commits intooverextended:mainfrom
andreutu:main

Conversation

@andreutu
Copy link
Contributor

Should solve the issue that was reported a few days ago. All that is changed is to check whether coords exist before returning if the entity does not.

@Alexr03
Copy link
Contributor

Alexr03 commented Nov 13, 2024

I think this requires some more further changes.

The docs state that this method should return an instance of OxVehicle. This PR would still return null in the instance where the vehicle entity is not created (no coords).

I think we should try to return that OxVehicle instance and fix some of the problems that exist in the constructor for when the entity isn't provided.

@andreutu
Copy link
Contributor Author

The change I've done just skips past the entity validation checks when no coords are passed. If no coords are passed, then the vehicle should automatically be stored in the database under the specified owner.

The DB saving process didn't occur before modifying the code, as, without coords, the entity automatically gets assigned to 0, thus preventing any code past the modified line to run.

If you meant that this function, regardless of whether the code was modified or not, does not return an OxVehicle object, then that's another issue that should be addressed in a separate issue.

@Alexr03
Copy link
Contributor

Alexr03 commented Nov 14, 2024

I've opened an issue for it #212

@thelindat
Copy link
Member

This line should actually just be removed as there's an entity check (though missing DoesEntityExist) occurring after database insertion / before OxVehicle instantiation.

@andreutu
Copy link
Contributor Author

I have done the necessary changes, the only entity check that remains is the one after the database validation.

@thelindat thelindat merged commit 87714bf into overextended:main Nov 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants