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

Resolve next scheduling ploblems #76

Merged
merged 10 commits into from
Jul 7, 2017
Merged

Conversation

eisuke
Copy link
Member

@eisuke eisuke commented Jul 4, 2017

@cookpad/dev-infra please review


launch_schedule = Chrono::Schedule.new(cron)
schedule = CHRONO_SCHEDULE_METHODS.each_with_object({}) do |method, h|
h[method] = launch_schedule.send(method)
Copy link
Member

Choose a reason for hiding this comment

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

[nits] Use public_send to clarify that it doesn't try to call private method.

Copy link
Member Author

Choose a reason for hiding this comment

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

job_definition.job_suspend_schedules.each do |suspend_schedule_model|
suspend_schedule = Chrono::Schedule.new(suspend_schedule_model.cron)
CHRONO_SCHEDULE_METHODS.each do |method|
schedule[method] = schedule[method] - suspend_schedule.send(method)
Copy link
Member

Choose a reason for hiding this comment

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

[nits] schedule[method] -= suspended_schedule.public_send(method)

Copy link
Member Author

Choose a reason for hiding this comment

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

td data-value=next_job_schedule.to_i = l(next_job_schedule, format: :short)
- else
td data-value="9999999990"
span class="small" Suspended
Copy link
Member

Choose a reason for hiding this comment

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

I think "Suspended" is confusing word because job definition has "suspended" status and it is displayed as "--".

context 'If the schedule has wdays and days' do
let(:cron) { '0 10 2 * 0' }
it 'returns nil' do
expect(schedule.next(time)).to eq(Time.new(2016, 2, 2, 10, 0))
Copy link

@aamine aamine Jul 4, 2017

Choose a reason for hiding this comment

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

[nits] Says "it returns nil" but does not return nil

Copy link
Member Author

Choose a reason for hiding this comment

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

🙈 ammended b192059

context 'If the schedule has wdays and days' do
let(:cron) { '0 10 1 * 1' }
it 'returns nil' do
expect(schedule.next(time)).to eq(Time.new(2016, 1, 4, 10, 0))
Copy link

@aamine aamine Jul 4, 2017

Choose a reason for hiding this comment

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

[nits] ditto.

@eisuke eisuke force-pushed the fix_next_schedule branch from 5ba258f to ba4836f Compare July 4, 2017 08:30
@eisuke eisuke force-pushed the fix_next_schedule branch from 6d42b72 to 97d2e52 Compare July 5, 2017 03:34
@eisuke
Copy link
Member Author

eisuke commented Jul 5, 2017

@cookpad/dev-infra Adding some changes. Please rereview.

The view of showing error messages when invalid suspend job schedule inputted is below.

suspend_schedule_error

@eisuke eisuke force-pushed the fix_next_schedule branch from ec54632 to 8d1ee24 Compare July 5, 2017 09:45
@eisuke eisuke force-pushed the fix_next_schedule branch from 8d1ee24 to e894442 Compare July 5, 2017 09:55
@eisuke eisuke merged commit 9959be8 into cookpad:master Jul 7, 2017
@eisuke eisuke deleted the fix_next_schedule branch July 7, 2017 02:47
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