-
Notifications
You must be signed in to change notification settings - Fork 33
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
TAN-3586 Add matrix field #10095
TAN-3586 Add matrix field #10095
Conversation
|
FYI Sebi I merged master into your branch so I can merge it into my FE ones as well :) There were no merge conflicts. |
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.
Think it all looks generally good. Assume we cannot currently support logic on these questions although they are much like linear scale.
back/app/models/custom_field.rb
Outdated
@@ -89,6 +90,7 @@ class CustomField < ApplicationRecord | |||
validates :minimum_select_count, comparison: { greater_than_or_equal_to: 0 }, if: :multiselect?, allow_nil: true | |||
validates :page_layout, presence: true, inclusion: { in: PAGE_LAYOUTS }, if: :page? | |||
validates :page_layout, absence: true, unless: :page? | |||
# validates :matrix_statements, presence: true, if: :supports_matrix_statements? |
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.
Is this supposed to be enabled?
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.
Yes, ideally this would be enabled. But the update_all endpoint currently doesn't allow this (first the field is created, then the statements and options are added). It seemed too complicated to tackle the update_all endpoint for this, so I'll instead just remove this line.
has_many :matrix_statements, record_type: :custom_field_matrix_statement, serializer: ::WebApi::V1::CustomFieldMatrixStatementSerializer, if: proc { |field| | ||
field.supports_matrix_statements? | ||
} |
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.
Are we including this in all the controller queries too?
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.
@jamesspeake Yes, they're included in idea_custom_fields_controller.rb:97. I didn't spot other endpoints where we might want to include them as well?
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.
Where is this controller used on the FE?
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.
Or is it just for completeness for the FE given that they are returned as relationships elsewhere?
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.
Yes, Amanda expressed the need to have an explicit endpoint for the statements, even though they are included in the custom field responses.
linear_scale_label1: 'Strongly disagree', | ||
linear_scale_label2: '', | ||
linear_scale_label3: '', | ||
linear_scale_label4: '', | ||
linear_scale_label5: 'Strongly agree', | ||
linear_scale_label6: '', | ||
linear_scale_label7: '' |
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.
Mentioned it to Edwin the other day when he add up to 11 for linear scale, but think a good future refactor would be to just have one linear_scale_labels
column on custom fields with all the labels in there as one json blob
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.
I agree it would be an improvement. Either a JSON blob or even a separate table/relationship.
env_files/back-safe.env
Outdated
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.
Probably want to revert this change
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 for spotting!
This was merged through this PR #10203 so closing. |
Changelog
Added