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

Symbolic names for submission_status #2052

Merged
merged 4 commits into from
Aug 2, 2023
Merged

Symbolic names for submission_status #2052

merged 4 commits into from
Aug 2, 2023

Conversation

bemoody
Copy link
Collaborator

@bemoody bemoody commented Jul 28, 2023

The submission_status field of ActiveProject uses integer codes to indicate the status of a project. These values are hard to read and hard to search for. Symbolic constants should be easier to read and maintain.

There should not be any functional changes here. Verifying I didn't change anything accidentally in the last commit:

for f in $(git diff --name-only HEAD HEAD^) ; do diff --label $f -u <(git show HEAD^:$f) <(git show HEAD:$f | sed 's/SubmissionStatus.UNSUBMITTED/0/;s/SubmissionStatus.NEEDS_ASSIGNMENT/10/;s/SubmissionStatus.NEEDS_DECISION/20/;s/SubmissionStatus.NEEDS_RESUBMISSION/30/;s/SubmissionStatus.NEEDS_COPYEDIT/40/;s/SubmissionStatus.NEEDS_APPROVAL/50/;s/SubmissionStatus.NEEDS_PUBLICATION/60/'); done

Benjamin Moody added 3 commits July 28, 2023 16:25
This enumeration class provides symbolic names (and a little bit of
documentation) for the magic numbers that have long been used to
indicate the submission status of an active project.
By defining SubmissionStatus using a context processor, it is possible
to use symbolic names like "SubmissionStatus.UNSUBMITTED" within
Django templates.
@bemoody
Copy link
Collaborator Author

bemoody commented Jul 28, 2023

I'll fix the formatting later, BTW. Anyone should feel free to propose better names for these constants. :)

@tompollard
Copy link
Member

Definitely an improvement, thanks. Once the style checks are passing, this looks good to merge.

@tompollard
Copy link
Member

@bemoody I took the liberty of fixing the style issues! Let me know if you'd prefer I didn't do this in future.

@tompollard tompollard merged commit c7dedc8 into dev Aug 2, 2023
8 checks passed
@tompollard tompollard deleted the submission-status branch August 2, 2023 14:57
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