private double calculateDescriptionProgress() { Text result = sqlSession.getMapper(TextMapper.class).read("Product" + propertyId + "Public"); String description = result.getNotes(); /* set 1 when description length is greater than 299*/ double progress = description.length() < 300 ? description.length() * 100.0 / 300.0 : 100.0; return progress * descriptionWeightage; }
private double calculateOptionsProgress() { Text text = new Text(); text.setId(propertyId + "_property"); text.setName("property"); Text result = sqlSession.getMapper(TextMapper.class).read("Product" + propertyId + "Contents"); String options = result.getNotes(); double progress = options.length() < 30 ? options.length() * 100.0 / 30.0 : 100.0; return progress * optionsWeightage; }