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

Util to generateId, remove extra userEmail args #999

Merged
merged 8 commits into from
Sep 13, 2024

Conversation

dexamundsen
Copy link
Contributor

  • create ServiceUtils.newArtifactId() to wrap id creation
  • remove --info option from github workflows. It removed unnecessary console info
  • use lastModifiedBy = createdBy during artifact.build. This ensured that the values are same during object creation.
  • Add createdBy to the cohortbuilder itself instead of passing it as additional param

default:
throw new IllegalArgumentException("Unknown JobExecution enum type: " + this);
}
return switch (this) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

enhanced switch from java 17

Copy link
Collaborator

Choose a reason for hiding this comment

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

In general, it's not a good idea to make this sort of sweeping cleanup in a PR that is doing other, unrelated things. It makes this change harder to review because I don't know if any differences I come across are intended or not, and can cause cherry-picks, rollbacks, etc. to be more difficult. Don't bother pulling it out of this PR but something to keep in mind in the future.

Copy link
Contributor Author

@dexamundsen dexamundsen Sep 13, 2024

Choose a reason for hiding this comment

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

Sure -- put these changes together since all of them are cleanup / optimizations. the entire PR is low priority and we could revert the entire thing. hence put them together. dao changes were left separate because that was not a cleanup, but refactored (for later use in next pr), same with snyk ones

.underlay(body.getUnderlayName()),
SpringAuthentication.getCurrentUser().getEmail());
.underlay(body.getUnderlayName())
.createdBy(SpringAuthentication.getCurrentUser().getEmail()));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Useremail is only used for this field in nested functions. Add it to builder and remove the param

Copy link
Collaborator

Choose a reason for hiding this comment

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

The user email is not just used for the cohort created by field, it's also used for the activity log.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Correct, the activity log used cohort.getCreatedBy(), which might also be more descriptive imo

@@ -327,10 +327,7 @@ public String createNextRevision(
.setIsMostRecent(true)
.version(cohort.getMostRecentRevision().getVersion() + 1)
.createdBy(userEmail)
.lastModifiedBy(userEmail)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

lastmodifiedby is set in build() during creation if its is null

@@ -192,18 +192,21 @@ public Builder isDeleted(boolean isDeleted) {
}

public Study build() {
// true if the id is empty or null
if (StringUtils.isEmpty(id)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

moved up

@dexamundsen dexamundsen self-assigned this Sep 13, 2024
default:
throw new IllegalArgumentException("Unknown JobExecution enum type: " + this);
}
return switch (this) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

In general, it's not a good idea to make this sort of sweeping cleanup in a PR that is doing other, unrelated things. It makes this change harder to review because I don't know if any differences I come across are intended or not, and can cause cherry-picks, rollbacks, etc. to be more difficult. Don't bother pulling it out of this PR but something to keep in mind in the future.

@dexamundsen dexamundsen merged commit 41a32d7 into main Sep 13, 2024
8 checks passed
@dexamundsen dexamundsen deleted the dexamundsen/artifacts branch September 13, 2024 17:48
.github/workflows/regression-test.yaml Show resolved Hide resolved
.underlay(body.getUnderlayName()),
SpringAuthentication.getCurrentUser().getEmail());
.underlay(body.getUnderlayName())
.createdBy(SpringAuthentication.getCurrentUser().getEmail()));
Copy link
Collaborator

Choose a reason for hiding this comment

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

The user email is not just used for the cohort created by field, it's also used for the activity log.

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.

3 participants