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

Improve cloned forms naming #4114

Merged
merged 2 commits into from
Oct 10, 2024
Merged

Conversation

wes-otf
Copy link
Contributor

@wes-otf wes-otf commented Aug 28, 2024

Fixes #3546. Improves the naming of cloned forms by changing the format to <original form name> (Copied on <%Y-%m-%d %H:%M:%S.%f>), ie. cloning Test Form would result in a duplicated form with the name Test Form (Copied on 2024-08-27 17:34:32.004). If a form name with a timestamp already exists on a form it will be subbed via RegEx matching.

Test Steps

  • Ensure when cloning a form (either manually or via the creation of a new round) that the form's name gets (Copied on <%Y-%m-%d %H:%M:%S.%f>) appended to it
  • Ensure if a timestamp string already exists on a cloned form, it is replaced with an updated timestamp

@wes-otf wes-otf added Type: Enhancement This is an improvement of an existing thing (not a new thing, which would be a feature). Type: Minor Minor change, used in release drafter labels Aug 28, 2024
@wes-otf wes-otf requested review from theskumar and frjo August 28, 2024 14:25
@frjo frjo added Status: Needs testing Tickets that need testing/qa Status: Needs dev testing 🧑‍💻 Tasks that should be tested by the dev team Status: Needs user testing 👷 Tasks that should be tested by OTF's user test team and removed Status: Needs dev testing 🧑‍💻 Tasks that should be tested by the dev team labels Sep 9, 2024
@@ -159,3 +162,29 @@ def is_filter_empty(filter: filters.FilterSet) -> bool:

# Flatten the QueryDict values in filter.data to a single list, check for validity with any()
return any(reduce(iconcat, [param[1] for param in query.lists()], []))


def get_copied_form_name(orignal_form_name: str) -> str:
Copy link
Member

Choose a reason for hiding this comment

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

can i suggest adding some quick unit test for this util. esp. the regex pattens I don't trust them too much.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes totally!

hypha/apply/funds/utils.py Outdated Show resolved Hide resolved
@wes-otf
Copy link
Contributor Author

wes-otf commented Sep 10, 2024

@theskumar unit tests added in the last commit - was trying to find a way to patch/mock django.utils.translation.gettext to test the usage of the regex w/ translated strings but was struggling to get it to work. let me know if you have any solutions for that

@wes-otf wes-otf added Status: Tested - approved for live ✅ and removed Status: Needs user testing 👷 Tasks that should be tested by OTF's user test team Status: Needs testing Tickets that need testing/qa labels Oct 8, 2024
@frjo frjo requested a review from theskumar October 10, 2024 07:11
@frjo frjo merged commit 2866b72 into main Oct 10, 2024
10 checks passed
sandeepsajan0 pushed a commit that referenced this pull request Oct 18, 2024
Fixes #3546

Improves the naming of cloned forms by changing the format
to `<original form name> (Copied on <%Y-%m-%d %H:%M:%S.%f>)`, ie.
cloning `Test Form` would result in a duplicated form with the name
`Test Form (Copied on 2024-08-27 17:34:32.004)`. If a form name with a
timestamp already exists on a form it will be subbed via RegEx matching.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Tested - approved for live ✅ Type: Enhancement This is an improvement of an existing thing (not a new thing, which would be a feature). Type: Minor Minor change, used in release drafter
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improvement to naming of cloned forms
3 participants