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

[Feature request] Editing of reservation questions #153

Open
jat255 opened this issue Jul 14, 2023 · 8 comments
Open

[Feature request] Editing of reservation questions #153

jat255 opened this issue Jul 14, 2023 · 8 comments

Comments

@jat255
Copy link
Member

jat255 commented Jul 14, 2023

This is kind of a follow-on of #152 based off a conversation I was having with one of our users. Since we make heavy use of the "reservation question" feature, it can be a bit of a nuisance for people to have to cancel and recreate a reservation if they want to make a change to their answers for the questions (e.g. they're actually going to look at a different sample than they originally thought or something).

Would it be super hard to implement a similar "update" button for the reservation questions? Something like the following mock up?

image

Where if you clicked on the "Edit answers" button, you'd get the same reservation question form, but pre-filled with your previous answers? That seems like it could re-use a lot of existing functionality without too much trouble, but I'm not overly familiar with this part of the code, so I'm not sure how involved of a change I'm requesting 😅

@rptmat57
Copy link
Contributor

I think it might not be too hard to re-answer/redo the questions, but pre-filling with previous answers looks much more challenging

@jat255
Copy link
Member Author

jat255 commented Jul 17, 2023

Pre-filling with previous answers looks much more challenging

Would it be possible to make an AJAX (or other) request to the API to get the reservation question data (since you'll have the ID)? That comes back in the same format the form expects, so that would be a convenient way to get it, but I'm not sure if the API functions (or the Python code that power them) are available from that part of the web interface.

@rptmat57
Copy link
Contributor

I can do the reset part and have a link on the reservation details to reset/redo the questions. It would replace previous answers, and since this seems to be what users are doing anyway, it would at least prevent the whole cancelling/recreating reservations. I could probably do that for 4.6.0 which is to be released this week.

At some later time I could look at the rest. I would also accept a PR if you are willing to take a crack at it.

Getting the user inputs is one piece of it, which I think I could figure out, but then there is the part where the questions need to be rendered with the initial data, which is more challenging especially with group questions that would need to be rendered as many times as they were added previously.
An option for rendering the questions with initial data would be to do it all in javascript in the details page and fill/set the correct value for textfields, select correct option for radio buttons, checkboxes and selectors. but that seems a bit hacky to me.
Another (probably better) option would be to do it server side, using the new default_value attribute for questions and overriding it with the user's input.

@creuzige
Copy link
Member

Following up on Josh's suggestion. For me it's often just one part of the information that needs to be changed or updated. So I'd like if it would pre-fill with anything that was there.

I see the struggle on how to render the questions/answers. As a user I'd be ok with viewing or editing something that's in more of a 'raw' format that the record gets stored as (.json, .md, etc). If the record's already there, it's more about not removing some of the formatting. I don't know if that's along the idea of the server side editing you'd mentioned.

@rptmat57
Copy link
Contributor

Thanks, I totally understand, and I did think about that solution as well.
However, I don't think exposing the raw json data to users is a good idea.
This would bypass the validation for the formatting of values, whether fields are required, etc.

@creuzige
Copy link
Member

I agree leaving users to mess with raw json data is probably not great for a variety of reasons, but may be a good short term solution since it doesn't require an additional rendering step.

Could the validation be done before overwriting? I see this in a cycle of 'initiate changes'->'make copy of original'-> 'modify copy'->'validate copy'->'replace original with copy'. It sounds like validation is already part of the initial submission, could it just be redone?

@rptmat57
Copy link
Contributor

That's the problem, the validation is only handled client side with input patterns and input types.

@rptmat57
Copy link
Contributor

I just want to add that this feature could be used for editing post usage questions as well, which I have received requests in the past about implementing.
Just wanted to mention it, in case anyone else wants to chime in.
At the moment I have no timeline for implementing this

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

No branches or pull requests

3 participants