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

Adding a resident-extern role #358

Closed
wants to merge 3 commits into from
Closed

Conversation

viktorcsimma
Copy link
Contributor

Closes #347. It's largely done; there might be some bugs that I haven't noticed.

@viktorcsimma viktorcsimma requested a review from kdmnk October 28, 2023 14:52
@viktorcsimma viktorcsimma self-assigned this Oct 28, 2023
deepsource-autofix bot added a commit that referenced this pull request Oct 28, 2023
This commit fixes the style issues introduced in 0425f4c according to the output
from PHP CS Fixer.

Details: #358
viktorcsimma pushed a commit that referenced this pull request Oct 28, 2023
This commit fixes the style issues introduced in 0425f4c according to the output
from PHP CS Fixer.

Details: #358
@kdmnk kdmnk requested a review from sszajbely November 4, 2023 15:13
@viktorcsimma
Copy link
Contributor Author

What should we do? I really think this would be useful; now that this is going to be the new status quo. @machiato32?

Copy link
Contributor

@sszajbely sszajbely left a comment

Choose a reason for hiding this comment

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

The changes are alright. If this status really needs to stay, I guess I'll have to approve it. What do you think @kdmnk?

@sszajbely
Copy link
Contributor

Also, please fix the merge conflicts @viktorcsimma

viktorcsimma and others added 3 commits December 30, 2023 17:45
@viktorcsimma
Copy link
Contributor Author

Something is not OK yet; it crashes at the economic committee page. I'll check it out soon.

@viktorcsimma viktorcsimma marked this pull request as draft December 30, 2023 16:51
@sszajbely
Copy link
Contributor

Ah, sorry didn't test it, just looked at the code.

Copy link
Contributor

@kdmnk kdmnk left a comment

Choose a reason for hiding this comment

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

Can not we name this "LIMITED_RESIDENT" role internally? It is getting to be really confusing.
Alternatively, I was also thinking on making the roles time constrained. That way, we could have regular collegists, plus an additional resident role that is set to be valid for 1 year/indefinite. We can also use that for guests, instead of the guest_until attribute and solve #291. (Also, the general collegist role is also valid only until the end of their studies by default which we can set this way).

@machiato32 what do you think, does putting effort into this would worth it?
(We have some time to work on this, the earliest this will be relevant is next summer)

@@ -157,7 +157,7 @@ public function store(Request $request)
return back()->with('error', "A státusz megadása kötelező!")->with('section', $request->section);
}
$user->setStatusFor(Semester::next(), $request->next_status, $request->next_status_note);
if ($request->has('resign_residency') && $user->isResident()) {
if ($request->has('resign_residency') && $user->resides()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

resides() is a scope, which I think returns a query builder (test it in tinker). Check if these checks work as expected. In the tests it also seems fine, just double check it, I would not call scopes this way. I would rather make it a simple function

@@ -286,7 +289,7 @@ public function missingData(): array
$missingData[] = 'Megjelölt kar';
}

if (!$user->isResident() && !$user->isExtern()) {
if (!$user->resides() && !$user->isExtern()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

same

@kdmnk
Copy link
Contributor

kdmnk commented Jan 2, 2024

Can not we name this "LIMITED_RESIDENT" role internally? It is getting to be really confusing. Alternatively, I was also thinking on making the roles time constrained. That way, we could have regular collegists, plus an additional resident role that is set to be valid for 1 year/indefinite. We can also use that for guests, instead of the guest_until attribute and solve #291. (Also, the general collegist role is also valid only until the end of their studies by default which we can set this way).

@machiato32 what do you think, does putting effort into this would worth it? (We have some time to work on this, the earliest this will be relevant is next summer)

I'm starting to like this idea. The role_user table would have a created_at and valid_until field, and we would use a global scope to filter on those. This way, we don't delete roles just invalidate them, making a log out of the table.

@viktorcsimma
Copy link
Contributor Author

Can not we name this "LIMITED_RESIDENT" role internally? It is getting to be really confusing. Alternatively, I was also thinking on making the roles time constrained. That way, we could have regular collegists, plus an additional resident role that is set to be valid for 1 year/indefinite. We can also use that for guests, instead of the guest_until attribute and solve #291. (Also, the general collegist role is also valid only until the end of their studies by default which we can set this way).
@machiato32 what do you think, does putting effort into this would worth it? (We have some time to work on this, the earliest this will be relevant is next summer)

I'm starting to like this idea. The role_user table would have a created_at and valid_until field, and we would use a global scope to filter on those. This way, we don't delete roles just invalidate them, making a log out of the table.

That sounds good:) Maybe we should open a new issue for that and freeze this until that gets solved.

@viktorcsimma
Copy link
Contributor Author

What should we do with this one? Should we merge it and then reverse it when working on that issue, or abandon it altogether?

@kdmnk kdmnk mentioned this pull request Jan 3, 2024
@kdmnk
Copy link
Contributor

kdmnk commented Jan 3, 2024

I'll close this for now.

@kdmnk kdmnk closed this Jan 3, 2024
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.

Creating a resident extern status
3 participants