Skip to content

Commit a4cca72

Browse files
committed
restructure if-else
1 parent ef29e99 commit a4cca72

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

server/src/main/java/com/cloud/api/query/dao/TemplateJoinDaoImpl.java

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -163,21 +163,20 @@ protected TemplateJoinDaoImpl() {
163163
}
164164

165165
private String getTemplateStatus(TemplateJoinVO template) {
166+
if (template.getDownloadState() == Status.DOWNLOADED) {
167+
return "Download Complete";
168+
}
166169
String templateStatus = "Processing";
167-
if (template.getDownloadState() != Status.DOWNLOADED) {
168-
if (template.getDownloadState() == Status.DOWNLOAD_IN_PROGRESS) {
169-
if (template.getDownloadPercent() == 100) {
170-
templateStatus = "Installing Template";
171-
} else {
172-
templateStatus = template.getDownloadPercent() + "% Downloaded";
173-
}
174-
} else if (template.getDownloadState() == Status.BYPASSED) {
175-
templateStatus = "Bypassed Secondary Storage";
176-
} else if (StringUtils.isNotBlank(template.getErrorString())) {
177-
templateStatus = template.getErrorString().trim();
170+
if (template.getDownloadState() == Status.DOWNLOAD_IN_PROGRESS) {
171+
if (template.getDownloadPercent() == 100) {
172+
templateStatus = "Installing Template";
173+
} else {
174+
templateStatus = template.getDownloadPercent() + "% Downloaded";
178175
}
179-
} else if (template.getDownloadState() == Status.DOWNLOADED) {
180-
templateStatus = "Download Complete";
176+
} else if (template.getDownloadState() == Status.BYPASSED) {
177+
templateStatus = "Bypassed Secondary Storage";
178+
} else if (StringUtils.isNotBlank(template.getErrorString())) {
179+
templateStatus = template.getErrorString().trim();
181180
}
182181
return templateStatus;
183182
}

0 commit comments

Comments
 (0)