Skip to content

Commit

Permalink
#92 - used max query to get display order to fix test.
Browse files Browse the repository at this point in the history
  • Loading branch information
petmongrels committed Dec 10, 2024
1 parent 2203739 commit 336ed12
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public void shouldGetAddressTable() {
assertThat(addressTableOptional.isPresent(), is(true));

TableMetadata addressTable = addressTableOptional.get();
assertThat(addressTable.getColumns().size(), is(16));
assertThat(addressTable.getColumns().size(), is(17));
assertThat(addressTable.getColumns().stream().anyMatch(column -> column.getName().equals("District")), is(true));
assertThat(addressTable.getColumns().stream().anyMatch(column -> column.getName().equals("District id")), is(true));
assertThat(addressTable.getColumns().stream().anyMatch(column -> column.getName().equals("Block")), is(true));
Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/media-form-element.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
insert into concept (id, data_type, high_absolute, high_normal, low_absolute, low_normal, name, uuid, version, unit, organisation_id, is_voided, audit_id, key_values, active, created_by_id, last_modified_by_id, created_date_time, last_modified_date_time) values (108001, 'Image', null, null, null, null, 'Image concept', '44163589-f76d-447d-9b6e-f5c32aa859eb', 0, null, 12, false, create_audit(), null, true, 1, 1, '2022-04-13 15:49:55.019 +00:00', '2022-04-13 15:49:55.019 +00:00');
insert into concept (id, data_type, high_absolute, high_normal, low_absolute, low_normal, name, uuid, version, unit, organisation_id, is_voided, audit_id, key_values, active, created_by_id, last_modified_by_id, created_date_time, last_modified_date_time) values (108002, 'Image', null, null, null, null, 'Person''s Image','b1815016-40d6-4045-9ae0-2f659fc5db6d', 0, null, 12, false, create_audit(), null, true, 1, 1, '2022-04-13 15:49:55.019 +00:00', '2022-04-13 15:49:55.019 +00:00');
insert into form_element (id, name, display_order, is_mandatory, key_values, concept_id, form_element_group_id, uuid, version, organisation_id, type, valid_format_regex, valid_format_description_key, audit_id, is_voided, rule, created_by_id, last_modified_by_id, created_date_time, last_modified_date_time, declarative_rule) values (50116, 'Media form element', 8, false, '[]', 108001, 5569, 'fd5ad16f-c18e-45db-841c-a2f994862957', 0, 12, 'SingleSelect', null, null, create_audit(), false, null, 1, 1, '2022-04-13 10:51:44.705 +00:00', '2022-04-13 10:51:44.705 +00:00', null);
insert into form_element (id, name, display_order, is_mandatory, key_values, concept_id, form_element_group_id, uuid, version, organisation_id, type, valid_format_regex, valid_format_description_key, audit_id, is_voided, rule, created_by_id, last_modified_by_id, created_date_time, last_modified_date_time, declarative_rule) values (50117, 'Media form element', 16, false, '[]', 108002, 5569, 'ec952777-67b2-47c2-bd7c-8e277547cb6b', 0, 12, 'SingleSelect', null, null, create_audit(), false, null, 1, 1, '2022-04-13 10:51:44.705 +00:00', '2022-04-13 10:51:44.705 +00:00', null);
insert into form_element (id, name, display_order, is_mandatory, key_values, concept_id, form_element_group_id, uuid, version, organisation_id, type, valid_format_regex, valid_format_description_key, audit_id, is_voided, rule, created_by_id, last_modified_by_id, created_date_time, last_modified_date_time, declarative_rule) values (50117, 'Media form element', (select max(display_order) + 1 from form_element where form_element_group_id = 5569), false, '[]', 108002, 5569, 'ec952777-67b2-47c2-bd7c-8e277547cb6b', 0, 12, 'SingleSelect', null, null, create_audit(), false, null, 1, 1, '2022-04-13 10:51:44.705 +00:00', '2022-04-13 10:51:44.705 +00:00', null);
update individual set observations = observations || jsonb_build_object('44163589-f76d-447d-9b6e-f5c32aa859eb', 'https://s3.amazon.com/wonderfulImage.jpg'), last_modified_date_time = '2022-04-13 10:51:44.705 +00:00' where subject_type_id = 339;
update individual set observations = observations || jsonb_build_object('b1815016-40d6-4045-9ae0-2f659fc5db6d', 'https://s3.amazon.com/wonderfulImage.jpg'), last_modified_date_time = '2022-04-13 10:51:44.705 +00:00' where subject_type_id = 339;

Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/test-data.sql
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ insert into form_element (name, display_order, is_mandatory, key_values, concept


-- Used for void and rename scenario
insert into form_element (name, display_order, is_mandatory, key_values, concept_id, form_element_group_id, uuid, version, organisation_id, type, valid_format_regex, valid_format_description_key, audit_id, is_voided, rule, created_by_id, last_modified_by_id, created_date_time, last_modified_date_time, declarative_rule, group_id) values ('Beneficiary Children Form Element', 16, false, '[]', (select id from concept where name = 'Beneficiary Children'), 5569, '5bb4234d-f014-4cae-9b2c-aef2cf4ed509', 0, 12, null, null, null, create_audit(), false, null, 1, 1, '2022-04-17 17:51:18.414 +00:00', '2022-04-17 17:51:18.414 +00:00', null, null);
insert into form_element (name, display_order, is_mandatory, key_values, concept_id, form_element_group_id, uuid, version, organisation_id, type, valid_format_regex, valid_format_description_key, audit_id, is_voided, rule, created_by_id, last_modified_by_id, created_date_time, last_modified_date_time, declarative_rule, group_id) values ('Beneficiary Children Form Element', (select max(display_order) + 1 from form_element where form_element_group_id = 5569), false, '[]', (select id from concept where name = 'Beneficiary Children'), 5569, '5bb4234d-f014-4cae-9b2c-aef2cf4ed509', 0, 12, null, null, null, create_audit(), false, null, 1, 1, '2022-04-17 17:51:18.414 +00:00', '2022-04-17 17:51:18.414 +00:00', null, null);


insert into form_element (id, name, display_order, is_mandatory, key_values, concept_id, form_element_group_id, uuid, version, organisation_id, type, valid_format_regex, valid_format_description_key, audit_id, is_voided, rule, created_by_id, last_modified_by_id, created_date_time, last_modified_date_time, declarative_rule, group_id) values (40113, 'Extra Column', 1, false, '[]', 107583, 5570, '49c7a3eb-0edd-4cdd-bdc6-5ab2bd53da57', 0, 12, 'SingleSelect', null, null, create_audit(), false, null, 1, 1, '2022-04-17 17:51:18.414 +00:00', '2022-04-17 17:51:18.414 +00:00', null, null);
Expand Down

0 comments on commit 336ed12

Please sign in to comment.