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

append current time to copied project display name #4331

Merged
merged 5 commits into from
May 22, 2024

Conversation

Tooyosi
Copy link
Contributor

@Tooyosi Tooyosi commented May 17, 2024

Describe your change here.

Review checklist

  • First, the most important one: is this PR small enough that you can actually review it? Feel free to just reject a branch if the changes are hard to review due to the length of the diff.
  • If there are any migrations, will they the previous version of the app work correctly after they've been run (e.g. the don't remove columns still known about by ActiveRecord).
  • If anything changed with regards to the public API, are those changes also documented in the apiary.apib file?
  • Are all the changes covered by tests? Think about any possible edge cases that might be left untested.

@Tooyosi Tooyosi requested a review from lcjohnso May 17, 2024 09:55
Copy link
Member

@lcjohnso lcjohnso left a comment

Choose a reason for hiding this comment

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

Minor recommendation for copied project display_name.

Comment on lines 64 to 66
current_timestamp = Time.now.utc.strftime('%Y-%m-%d %H:%M:%S')
copied_project.display_name += ' (copy)' if user == project_to_copy.owner
copied_project.display_name += " #{current_timestamp}"
Copy link
Member

Choose a reason for hiding this comment

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

Following method used in workflow_copier.rb (see workflow_copier.rb#L22), and removing if user == owner (that doesn't seem necessary since all workflows will have a unique copy tag added.

Suggested change
current_timestamp = Time.now.utc.strftime('%Y-%m-%d %H:%M:%S')
copied_project.display_name += ' (copy)' if user == project_to_copy.owner
copied_project.display_name += " #{current_timestamp}"
copied_project.display_name += " (copy: #{Time.now.utc.strftime('%Y-%m-%d %H:%M:%S')})"

expect(copied_project.display_name).to eq(project.display_name)
it 'appends current timestamp to display_name' do
allow(Time).to receive(:now).and_return(Time.utc(2024, 5, 17, 12, 0, 0))
expect(copied_project.display_name).to eq("#{project.display_name} 2024-05-17 12:00:00")
Copy link
Member

Choose a reason for hiding this comment

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

If suggestion above is used, then here is the fix for the spec.

Suggested change
expect(copied_project.display_name).to eq("#{project.display_name} 2024-05-17 12:00:00")
expect(copied_project.display_name).to eq("#{project.display_name} (copy: 2024-05-17 12:00:00)")

@Tooyosi Tooyosi requested a review from lcjohnso May 22, 2024 15:23
Copy link
Member

@lcjohnso lcjohnso left a comment

Choose a reason for hiding this comment

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

LGTM

@lcjohnso
Copy link
Member

FYI: you can choose to "commit suggestion" from review comments when they are available -- that might be faster than creating those edits / commits on your own.

@Tooyosi
Copy link
Contributor Author

Tooyosi commented May 22, 2024

FYI: you can choose to "commit suggestion" from review comments when they are available -- that might be faster than creating those edits / commits on your own.

Yeah, i'll do going forward. Just wanted to reconfirm with the tests locallt

@Tooyosi Tooyosi merged commit 7e6b449 into master May 22, 2024
8 checks passed
@Tooyosi Tooyosi deleted the append-timestamp-to-copied-project-display-name branch May 22, 2024 15:34
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