Commit f1e3dba7 authored by Eugenia Grieff's avatar Eugenia Grieff

Change health status constants to use 0

When the health status is set as 'No status'
the input value will be 0.
parent dcce0164
......@@ -79,8 +79,6 @@ export default {
*/
getFormDataAsObject() {
const healthStatusValue = this.form.find('input[name="update[health_status]"]').val();
const formData = {
update: {
state_event: this.form.find('input[name="update[state_event]"]').val(),
......@@ -88,7 +86,7 @@ export default {
milestone_id: this.form.find('input[name="update[milestone_id]"]').val(),
issuable_ids: this.form.find('input[name="update[issuable_ids]"]').val(),
subscription_event: this.form.find('input[name="update[subscription_event]"]').val(),
health_status: healthStatusValue === 'null' ? '0' : healthStatusValue,
health_status: this.form.find('input[name="update[health_status]"]').val(),
add_label_ids: [],
remove_label_ids: [],
},
......
......@@ -20,7 +20,7 @@ export const iterationSelectTextMap = {
};
export const healthStatusForRestApi = {
NO_STATUS: null,
NO_STATUS: '0',
[healthStatus.ON_TRACK]: 'on_track',
[healthStatus.NEEDS_ATTENTION]: 'needs_attention',
[healthStatus.AT_RISK]: 'at_risk',
......
......@@ -64,6 +64,19 @@ RSpec.describe Issuable::BulkUpdateService do
expect(issuable.health_status).to eq('on_track')
end
end
context "when params values are '0'" do
let(:params) { { issuable_ids: issuables.map(&:id), health_status: '0' } }
it 'succeeds and remove values' do
expect(subject[:success]).to be_truthy
expect(subject[:count]).to eq(issuables.count)
issuables.each do |issuable|
issuable.reload
expect(issuable.health_status).to be_nil
end
end
end
end
context 'when features are disabled' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment