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

EventService - Updating events fails #291

Closed
4 tasks
Brutus5000 opened this issue Nov 27, 2018 · 4 comments
Closed
4 tasks

EventService - Updating events fails #291

Brutus5000 opened this issue Nov 27, 2018 · 4 comments

Comments

@Brutus5000
Copy link
Member

Brutus5000 commented Nov 27, 2018

When sending a valid request to the /events/update route for an existing event uuid an exception is thrown.
Sample payload:

[{
        'count': 1,
        'playerId': 1,
        'eventId': 'ad193982-e7ca-465c-80b0-5493f9739559'
}]

Exception: java.sql.SQLException: Field 'event_id' doesn't have a default value

Impact: Achievements can not be updated from game results.

First analysis:
In the EventsService a new PlayerEvent is created if not already exists. However the getEvent in the PlayerEvent is annotated as insertable = false. I assume this tells hibernate not to insert it, thus it tries to resolve the default value and fails.
Maybe removing the insertable = false already solves the problem

Acceptance criteria for solution:

  • Fix the root cause (probably the insertable-flag).
  • Replace eventRepository.getOne in the EventsService with findById and throw a proper error message if optional is empty
  • Write unit tests for the increment method. Mark the method as @VisibleForTesting
  • Write integration tests to actually check MySql behavior (add some achievement test-data into sql fails and preload them - look into other integration tests to find out how to do it)
@micheljung
Copy link
Member

the labels beginner and good first issue are semantically the same, can we get rid of one?

@Brutus5000
Copy link
Member Author

I don't know which one Github promotes right now, but sure. Go ahead.

@micheljung micheljung changed the title EventService - Updating achievement fails EventService - Updating events fails Nov 29, 2018
@micheljung
Copy link
Member

As a quick fix, the server could make sure that a failed call to the event service does not prevent the achievement update from being executed.

@Rackover
Copy link
Member

Rackover commented Dec 4, 2018

As a quick fix, the server could make sure that a failed call to the event service does not prevent the achievement update from being executed.

it's done already

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

No branches or pull requests

4 participants