Tony CHEMIT pushed to branch develop at ultreiaio / ird-t3

Commits:

1 changed file:

Changes:

  • t3-web/src/main/java/fr/ird/t3/web/actions/data/level0/ConvertCatchesWeightCategoriesConfigureAction.java
    ... ... @@ -50,8 +50,12 @@ public class ConvertCatchesWeightCategoriesConfigureAction extends AbstractLevel
    50 50
         protected void loadDefaultConfiguration(ConvertCatchesWeightCategoriesConfiguration config) {
    
    51 51
             super.loadDefaultConfiguration(config);
    
    52 52
             List<String> versions = dao.findAll().stream().map(WeightCategoryLogBookConversion::getVersion).distinct().collect(Collectors.toCollection(LinkedList::new));
    
    53
    +        if (versions.isEmpty()) {
    
    54
    +            throw new IllegalStateException("can't find a version of weight category logBook conversion in database");
    
    55
    +        }
    
    56
    +        String defaultVersion = versions.get(0);
    
    53 57
             versions.add(ConvertCatchesWeightCategoriesConfiguration.LEGACY_VERSION);
    
    54 58
             config.setVersions(versions);
    
    55
    -        config.setVersion(ConvertCatchesWeightCategoriesConfiguration.LEGACY_VERSION);
    
    59
    +        config.setVersion(defaultVersion);
    
    56 60
         }
    
    57 61
     }