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

WC Admin application cycle edit/create table #590

Merged
merged 15 commits into from
Jan 6, 2024
Merged

Conversation

julianweng
Copy link
Member

Implemented ModelForm on Wharton Council Admin page, connecting to WhartonCyclesView (enforces cycle start/end times on all applications with given cycle upon update).

.pre-commit-config.yaml Outdated Show resolved Hide resolved
backend/clubs/views.py Outdated Show resolved Hide resolved
"""

permission_classes = [WhartonApplicationPermission | IsSuperuser]
http_method_names = ["get", "post", "put", "patch", "delete"]
Copy link
Member

Choose a reason for hiding this comment

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

Do we need put, patch, and delete?

Docstring only specifies update and list?

Copy link
Member Author

Choose a reason for hiding this comment

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

Forgot to update the docstring, thanks for the catch! Default behavior for post and delete are used in ModelForm to let the user create delete cycles I believe, and patch is used for update.

Copy link
Member

Choose a reason for hiding this comment

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

I meant more of:

  • do we want to allow deleting?
  • we should consider picking one of put/patch, they are generally considered to have similar semantics ("put" is idempotent, whereas "patch" is not always)

app.application_end_time = self.get_object().end_date
if app.result_release_time < app.application_end_time:
app.result_release_time = app.application_end_time
+datetime.timedelta(days=10)
Copy link
Member

@rohangpta rohangpta Sep 26, 2023

Choose a reason for hiding this comment

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

This seems to pass lint but looks a bit awkward? Definitely a nit though

backend/clubs/views.py Outdated Show resolved Hide resolved
if app.result_release_time < app.application_end_time:
app.result_release_time = app.application_end_time
+datetime.timedelta(days=10)
app.save()
Copy link
Member

Choose a reason for hiding this comment

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

This won't affect prod performance but it would be good practice to use bulk_update!

@rohangpta
Copy link
Member

Great work! Left a few comments but otherwise looks like this is a good start towards making administration of applications easier! Thanks Julian

@rohangpta
Copy link
Member

Refs issue #580

Copy link
Member

@esinx esinx left a comment

Choose a reason for hiding this comment

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

Still fine, but minor type changes may be appreciated!

`

const WhartonApplicationCycles = (): ReactElement => {
const [editMembership, setEditMembership] = React.useState(false)
Copy link
Member

Choose a reason for hiding this comment

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

Why not simply import useState from React?

})

const [editExtensions, setEditExtensions] = React.useState(false)
const [extensionsCycle, setExtensionsCycle] = React.useState({
Copy link
Member

Choose a reason for hiding this comment

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

Can we type extensionCycle and membershipCycle?

}
}, [extensionsCycle])

if (clubOptionsMembership == null) {
Copy link
Member

Choose a reason for hiding this comment

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

Suggestion: We should try to use something like react-query or SWR to streamline loading process

@rohangpta
Copy link
Member

Looks like we're pretty close to ready to merge this? @julianweng do you have any time to get this merged in before we start school?

@julianweng julianweng merged commit b009af3 into master Jan 6, 2024
7 checks passed
@julianweng julianweng deleted the wc-application-admin branch January 6, 2024 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants