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

Define date range of the date questions #2081

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

MitanOmar
Copy link
Member

No description provided.

@MitanOmar MitanOmar force-pushed the define-date-range-of-the-date-questions branch 2 times, most recently from b04b2bc to cfc05d9 Compare October 6, 2023 10:32
@open-dynaMIX open-dynaMIX force-pushed the define-date-range-of-the-date-questions branch from cfc05d9 to 27d90a9 Compare October 6, 2023 10:37
@MitanOmar MitanOmar requested a review from open-dynaMIX October 6, 2023 11:35
@open-dynaMIX open-dynaMIX force-pushed the define-date-range-of-the-date-questions branch from 27d90a9 to 77916a9 Compare October 6, 2023 13:41
@winged
Copy link
Contributor

winged commented Jan 30, 2024

@MitanOmar is this PR ready to merge? Are you gonna add validation for the date range in the answers as well, or is this intended more as a range limiter for the input field?

@@ -240,12 +240,28 @@ class Meta(SaveQuestionSerializer.Meta):


class SaveDateQuestionSerializer(SaveQuestionSerializer):
min_date = DateField("%Y-%m-%d", required=False, allow_null=True)
max_date = DateField("%Y-%m-%d", required=False, allow_null=True)

def validate(self, data):
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@winged there is a validation in the backend, but since i finish this PR, it's waiting for review

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

projectcaluma/ember-caluma#2521

here is the implementation of the frontend side

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, but I think if we do this, we should add validation to the answers as well. This only validates the question, but no restriction happens when people actually fill out the forms.

Look at the answer validator to see what I mean.

There's already _validate_question_float() and _validate_question_integer() that implement the same pattern. I think therefore, you should extend _validate_question_date() to match.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's right, i will implement that too, and i will include it in my todo for this week

@winged
Copy link
Contributor

winged commented Jan 31, 2024

As discussed today: Since this doesn't stem from a direct (client) requirement, we will stop development for now, and pick it back up when we do have a need for this feature. Otherwise, we may have a breaking change to modify this in a way that actually benefits the user.

Ideas that may be useful in this context, that aren't possible with the current approach:

  • Set upper or lower limit to "today" or "right now"
  • Set upper or lower limit to the value of another question (potentially with an offset in either direction)

These limits may possibly also be interesting for float / integer questions as well, but as we're not clear on any actual requirements, let's not run off in the wrong direction here.

@winged winged marked this pull request as draft January 31, 2024 14:05
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

Successfully merging this pull request may close these issues.

2 participants