Vatsim-Scandinavia/controlcenter

Training request vue error

blt950 opened this issue · 5 comments

I have observer following issue (it is happening in 5.0.4 and 5.1.0). If I go to my profile to add training type. When I choose training area, whole page crashes with TypeError: null is not an object (evaluating 'rating.id').

image
image
image
image

@bedrich-schindler

Could you provide a screenshot of your ratings and area_rating tables? I'm not able to reproduce it and I think this is a misconfiguration issue.

image image image image image

The problem is with C3:

// Fetch all ratings and add C3 to all areas

$ratings = Area::with('ratings')->get()->each(function ($area) {
    $area->ratings->push(Rating::where('name', 'C3')->first());
})->sortBy('name')->toArray();

I will add rest of VATSIM ratings to the DB and it should solve the problem. We do not have C3 specified in DB as there is nobody in our division with such rating, so I removed it during division configuration as it did not seem to be necessary.

That's your issue then, please don't remove VATSIM Ratings :D As several places in the code helpers depend on these to display ratings correctly. E.g. if you get someone with C3 to login in CC, it should be defined in ratings to correctly identify them.

The reason C3 is added like this is because it's not a rating you can apply for, but you should be able to issue a training for it on request.

Here you find the diffrerent data tables which need to be edited to suit your subdivision.
https://docs.vatsca.org/controlcenter/dev/setup/division/#ratings

Do you think that I am only stupid guy or should I improve textation of Ratings section with wording such as "Do not remove default VATSIM ratings"? :-D

I mean... It's a user error ;) But yea, it should be mentioned in the documentation. I'll add it in.