-
Notifications
You must be signed in to change notification settings - Fork 41
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
editoast, schemas: add 'freight_compatible' to the rolling stock model #8856
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## dev #8856 +/- ##
=============================================
+ Coverage 37.13% 87.49% +50.35%
=============================================
Files 1260 31 -1229
Lines 115076 1535 -113541
Branches 3230 0 -3230
=============================================
- Hits 42736 1343 -41393
+ Misses 70407 192 -70215
+ Partials 1933 0 -1933
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
a3132aa
to
314c132
Compare
314c132
to
011e52e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I'm fine with freight_compatible
. About its nullability: do we plan to make the field non-nullable eventually or is there a benefit to encode "we're not sure" in the application?
011e52e
to
2450cf9
Compare
Signed-off-by: Jean SIMARD <[email protected]>
Signed-off-by: Jean SIMARD <[email protected]>
Signed-off-by: Jean SIMARD <[email protected]>
e79759d
to
5c3faac
Compare
I would have preferred an enum field like With these possible values:
|
@flomonster I see, but I don't think that is ok, because it's not an XOR. A locomotive can be both freight and passenger compatible. A better modeling would be some sort of list of tags... but that might mean another DB table and maybe a bit more design. What do you think? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
I see, why do we need this information attached to the rolling stock? Is it only for the icon? |
@flomonster No, we're going to use it to filter what is presented in the STDCM form, see #8921 for the following PR. The icon was just a quick win to display this information somewhere. |
I think the best way to deal with this in the long term is to have groups of rolling stock (necessary for permissions). Then we could assign a group of rolling stock to the STDCM search environment. It feels weird to add a flaky field and limit usage of STDCM depending of this field. Note Since we want this feature quickly and we can't wait for rolling stock groups, should we add an hotfix in the frontend? It seems easier to revert than changing our model. |
@leovalais I actually went back and forth on this idea, first thinking, if we don't know, we just don't know, it's not necessary false. But then I realize that on STDCM form, we're going to have to take a decision about "do we display rolling stocks that are |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM for the front part ✅
Finally closing this PR. After discussion with multiple actors (@clarani @flomonster @axrolld), we realized that the vision is not yet clear and that we can achieve our short-term objective differently: we can have much less technical debt by encoding what we need directly in |
Classify rolling stock between those that can be used as fret, and those who don't (or those we don't know). A new field
freight_compatible
is added to the rolling stock schema (both pythonosrd_schemas
andeditoast
), then also to the rolling stock model (DB), and finally in all API exposed struct likeLightRollingStock
andRollingStockForm
.Since there is still a lot of rolling stock for which we don't know any information, the new field is nullable.
freight_compatible
. If you don't like it, have other ideas, don't spend time reviewing the rest of the PR, let's discuss that first.I also added a little icon for freight compatible train in the rolling stock editor.