Browse Source

Death certificate changes

Andrew Grant 1 month ago
parent
commit
d2e2bad745

+ 3 - 2
src/main/java/scot/carricksoftware/grants/services/certificates/deathcertificates/DeathCertificateServiceImpl.java

@@ -66,14 +66,15 @@ public class DeathCertificateServiceImpl implements DeathCertificateService {
 
     @Override
     public List<DeathCertificate> getPagedDeathCertificates(int pageNumber) {
-        logger.debug("DeathCertificateServiceImpl::getPagedCountries");
+        logger.debug("DeathCertificateServiceImpl::getPagedDeathCertificates");
         Pageable paging = PageRequest.of(pageNumber, ApplicationConstants.DEFAULT_PAGE_SIZE, getSort());
         Page<DeathCertificate> pagedResult = deathCertificateRepository.findAll(paging);
         return pagedResult.getContent();
     }
 
     private Sort getSort() {
-        return Sort.by(Sort.Direction.ASC, "id");
+        return Sort.by(Sort.Direction.ASC, "deceased.lastName")
+                .and(Sort.by(Sort.Direction.ASC, "deceased.firstName"));
     }
 
     @Override

+ 0 - 10
src/main/java/scot/carricksoftware/grants/validators/certificates/deathcertificate/DeathCertificateDateFieldsValidatorImpl.java

@@ -27,7 +27,6 @@ public class DeathCertificateDateFieldsValidatorImpl implements DeathCertificate
     @Override
     public void validate(DeathCertificateCommand deathCertificateCommand, BindingResult bindingResult) {
         validateCertificateDate(deathCertificateCommand, bindingResult);
-        validateWhenBorn(deathCertificateCommand, bindingResult);
         validateWhenDied(deathCertificateCommand, bindingResult);
     }
 
@@ -41,15 +40,6 @@ public class DeathCertificateDateFieldsValidatorImpl implements DeathCertificate
                 bindingResult);
     }
 
-    private void validateWhenBorn(DeathCertificateCommand deathCertificateCommand, BindingResult bindingResult) {
-        logger.debug("DeathCertificateDateFieldsValidator::validateWhenBorn");
-        validateDateTypes.validatePastDate(deathCertificateCommand.getWhenBorn(),
-                "whenBorn",
-                ValidationConstants.WHEN_BORN_IS_NULL,
-                ValidationConstants.WHEN_BORN_INCORRECT_FORMAT,
-                ValidationConstants.DATE_IN_FUTURE,
-                bindingResult);
-    }
 
     private void validateWhenDied(DeathCertificateCommand deathCertificateCommand, BindingResult bindingResult) {
         logger.debug("DeathCertificateNullFieldsValidator::validateWhenDied");

+ 1 - 1
src/main/resources/templates/certificates/deathCertificate/form.html

@@ -258,7 +258,7 @@
             </tr>
             <tr>
                 <td style="text-align: right;">
-                    <label for="whenDied">When Died (dd/mm/yyyy hh:mm) :&nbsp;</label>
+                    <label for="whenDied">When Died (dd/mm/yyyy) :&nbsp;</label>
                 </td>
                 <td style="text-align: left;">
                     <div>

+ 0 - 11
src/test/java/scot/carricksoftware/grants/validators/certificates/deathcertificate/DeathCertificateDateFieldsValidatorImplTest.java

@@ -59,17 +59,6 @@ class DeathCertificateDateFieldsValidatorImplTest {
                 bindingResultMock);
     }
 
-    @Test
-    void validateWhenBornIsCalledTest() {
-        deathCertificateDateFieldsValidator.validate(deathCertificateCommand, bindingResultMock);
-
-        verify(validateDateTypesMock).validatePastDate(whenBorn,
-                "whenBorn",
-                "When born cannot be null.",
-                "The format should be dd/MM/yyyy hh:mm.",
-                "Date should not be in the future.",
-                bindingResultMock);
-    }
 
     @Test
     void validateWhenDiedIsCalledTest() {