Flip negated conditions to positive for readability (S7735)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-10 00:59:37 +08:00
parent 5a936cad97
commit 804d78837b
14 changed files with 102 additions and 102 deletions

View File

@@ -1670,7 +1670,7 @@ function checkCycleTime() {
return disabled; return disabled;
} }
function checkStartAndEnd(start, end) { function checkStartAndEnd(start, end) {
return !isAlreadySubmit.value ? !(start && end) : start !== end; return isAlreadySubmit.value ? start !== end : !(start && end);
} }
// created() logic // created() logic

View File

@@ -173,7 +173,7 @@ const data = computed(() => {
// Sort the Activity List // Sort the Activity List
return [...filteredData.value].sort((x, y) => { return [...filteredData.value].sort((x, y) => {
const diff = y.occurrences - x.occurrences; const diff = y.occurrences - x.occurrences;
return diff !== 0 ? diff : sortNumEngZhtwForFilter(x.label, y.label); return diff === 0 ? sortNumEngZhtwForFilter(x.label, y.label) : diff;
}); });
}); });

View File

@@ -113,8 +113,8 @@ function isRule(e, index) {
const rule = isRuleData.value[index]; const rule = isRuleData.value[index];
// First get the rule object // First get the rule object
// To preserve data order, set the value to 0 and remove it during submitAll // To preserve data order, set the value to 0 and remove it during submitAll
if (!e) temporaryData.value[index] = 0; if (e) temporaryData.value[index] = rule;
else temporaryData.value[index] = rule; else temporaryData.value[index] = 0;
} }
/** /**

View File

@@ -1008,14 +1008,14 @@ function getTraceData(isExclude) {
* @param {Array} postData - The submitted filter data. * @param {Array} postData - The submitted filter data.
*/ */
function updateRules(postData) { function updateRules(postData) {
if (!temporaryData.value?.length) { if (temporaryData.value?.length) {
temporaryData.value.push(...postData);
isRuleData.value = Array.from(temporaryData.value);
ruleData.value = isRuleData.value.map((e) => setRule(e));
} else {
temporaryData.value.push(...postData); temporaryData.value.push(...postData);
isRuleData.value.push(...postData); isRuleData.value.push(...postData);
ruleData.value.push(...postData.map((e) => setRule(e))); ruleData.value.push(...postData.map((e) => setRule(e)));
} else {
temporaryData.value.push(...postData);
isRuleData.value = Array.from(temporaryData.value);
ruleData.value = isRuleData.value.map((e) => setRule(e));
} }
} }

View File

@@ -506,12 +506,12 @@ export async function renameModal(rename, type, id, baseName) {
const inputField = Swal.getInput(); const inputField = Swal.getInput();
inputField.addEventListener("input", function () { inputField.addEventListener("input", function () {
if (!inputField.value.trim()) { if (inputField.value.trim()) {
confirmButton.classList.add("disable-hover");
confirmButton.disabled = true;
} else {
confirmButton.classList.remove("disable-hover"); confirmButton.classList.remove("disable-hover");
confirmButton.disabled = false; confirmButton.disabled = false;
} else {
confirmButton.classList.add("disable-hover");
confirmButton.disabled = true;
} }
}); });
}, },

View File

@@ -231,7 +231,9 @@ export function getXIndex(data, xValue) {
* or null if the input is NaN. * or null if the input is NaN.
*/ */
export function formatTime(seconds) { export function formatTime(seconds) {
if (!Number.isNaN(Number(seconds))) { if (Number.isNaN(Number(seconds))) {
return null;
} else {
const remainingSeconds = seconds % 60; const remainingSeconds = seconds % 60;
const minutes = (Math.floor(seconds - remainingSeconds) / 60) % 60; const minutes = (Math.floor(seconds - remainingSeconds) / 60) % 60;
const hours = Math.floor(seconds / 3600) % 24; const hours = Math.floor(seconds / 3600) % 24;
@@ -250,8 +252,6 @@ export function formatTime(seconds) {
result += `${remainingSeconds}s`; result += `${remainingSeconds}s`;
return result.trim(); // Remove trailing whitespace return result.trim(); // Remove trailing whitespace
} else {
return null;
} }
} }
/** /**

View File

@@ -129,23 +129,23 @@ export const useAllMapDataStore = defineStore("allMapDataStore", {
switch (copy.type) { switch (copy.type) {
case "date": case "date":
copy.min = copy.min =
copy.min !== null copy.min === null
? moment(copy.min).format("YYYY/MM/DD HH:mm") ? null
: null; : moment(copy.min).format("YYYY/MM/DD HH:mm");
copy.max = copy.max =
copy.max !== null copy.max === null
? moment(copy.max).format("YYYY/MM/DD HH:mm") ? null
: null; : moment(copy.max).format("YYYY/MM/DD HH:mm");
break; break;
case "float": case "float":
copy.min = copy.min =
copy.min !== null copy.min === null
? Number(new Decimal(copy.min).toFixed(2, 3)) ? null
: null; : Number(new Decimal(copy.min).toFixed(2, 3));
copy.max = copy.max =
copy.max !== null copy.max === null
? Number(new Decimal(copy.max).toFixed(2, 2)) ? null
: null; : Number(new Decimal(copy.max).toFixed(2, 2));
break; break;
default: default:
break; break;
@@ -212,15 +212,15 @@ export const useAllMapDataStore = defineStore("allMapDataStore", {
switch (att.type) { switch (att.type) {
case "date": case "date":
att.value = att.value =
att.value !== null att.value === null
? moment(att.value).format("YYYY/MM/DD HH:mm") ? null
: null; : moment(att.value).format("YYYY/MM/DD HH:mm");
break; break;
case "float": case "float":
att.value = att.value =
att.value !== null att.value === null
? Number(new Decimal(att.value).toFixed(2)) ? null
: null; : Number(new Decimal(att.value).toFixed(2));
break; break;
default: default:
break; break;
@@ -257,15 +257,15 @@ export const useAllMapDataStore = defineStore("allMapDataStore", {
switch (att.type) { switch (att.type) {
case "date": case "date":
att.value = att.value =
att.value !== null att.value === null
? moment(att.value).format("YYYY/MM/DD HH:mm") ? null
: null; : moment(att.value).format("YYYY/MM/DD HH:mm");
break; break;
case "float": case "float":
att.value = att.value =
att.value !== null att.value === null
? Number(new Decimal(att.value).toFixed(2)) ? null
: null; : Number(new Decimal(att.value).toFixed(2));
break; break;
default: default:
break; break;
@@ -305,9 +305,9 @@ export const useAllMapDataStore = defineStore("allMapDataStore", {
this.allFilterTimeframe.x_axis.max_base = max; this.allFilterTimeframe.x_axis.max_base = max;
// Convert to a time format without seconds // Convert to a time format without seconds
this.allFilterTimeframe.x_axis.min = this.allFilterTimeframe.x_axis.min =
min !== null ? moment(min).format("YYYY/MM/DD HH:mm") : null; min === null ? null : moment(min).format("YYYY/MM/DD HH:mm");
this.allFilterTimeframe.x_axis.max = this.allFilterTimeframe.x_axis.max =
max !== null ? moment(max).format("YYYY/MM/DD HH:mm") : null; max === null ? null : moment(max).format("YYYY/MM/DD HH:mm");
} catch (error) { } catch (error) {
apiError(error, "Failed to load the Filter Parameters."); apiError(error, "Failed to load the Filter Parameters.");
} }

View File

@@ -178,9 +178,9 @@ export const useConformanceStore = defineStore("conformanceStore", {
case "dummy": //sonar-qube case "dummy": //sonar-qube
case "duration-list": case "duration-list":
copy.value = copy.value.map((v) => copy.value = copy.value.map((v) =>
v !== null v === null
? abbreviateNumber(new Decimal(v.toFixed(2))) ? null
: null, : abbreviateNumber(new Decimal(v.toFixed(2))),
); );
copy.value = copy.value.map((v) => (v ?? "").trim()).join(", "); copy.value = copy.value.map((v) => (v ?? "").trim()).join(", ");
break; break;
@@ -194,15 +194,15 @@ export const useConformanceStore = defineStore("conformanceStore", {
switch (copy.type) { switch (copy.type) {
case "date": case "date":
copy.value = copy.value =
copy.value !== null copy.value === null
? moment(copy.value).format("YYYY/MM/DD HH:mm:ss") ? null
: null; : moment(copy.value).format("YYYY/MM/DD HH:mm:ss");
break; break;
case "float": case "float":
copy.value = copy.value =
copy.value !== null copy.value === null
? new Decimal(copy.value).toFixed(2) ? null
: null; : new Decimal(copy.value).toFixed(2);
break; break;
default: default:
break; break;
@@ -234,15 +234,15 @@ export const useConformanceStore = defineStore("conformanceStore", {
switch (copy.type) { switch (copy.type) {
case "date": case "date":
copy.value = copy.value =
copy.value !== null copy.value === null
? moment(copy.value).format("YYYY/MM/DD HH:mm:ss") ? null
: null; : moment(copy.value).format("YYYY/MM/DD HH:mm:ss");
break; break;
case "float": case "float":
copy.value = copy.value =
copy.value !== null copy.value === null
? new Decimal(copy.value).toFixed(2) ? null
: null; : new Decimal(copy.value).toFixed(2);
break; break;
default: default:
break; break;
@@ -306,10 +306,10 @@ export const useConformanceStore = defineStore("conformanceStore", {
const api = getCheckApiBase(this); const api = getCheckApiBase(this);
try { try {
const response = await apiClient.get(api); const response = await apiClient.get(api);
if (!getRouteFile) { if (getRouteFile) {
this.allConformanceTempReportData = response.data;
} else {
this.allRouteFile = response.data.file; this.allRouteFile = response.data.file;
} else {
this.allConformanceTempReportData = response.data;
} }
} catch (error) { } catch (error) {
apiError(error, "Failed to Get the Temporary Log Conformance Report."); apiError(error, "Failed to Get the Temporary Log Conformance Report.");

View File

@@ -408,12 +408,12 @@ watch(
if (newAccount.length > 0 && newName.length > 0) { if (newAccount.length > 0 && newName.length > 0) {
isConfirmDisabled.value = false; isConfirmDisabled.value = false;
} }
if (whichCurrentModal.value !== MODAL_CREATE_NEW) { if (whichCurrentModal.value === MODAL_CREATE_NEW) {
if (isResetPwdSectionShow.value && newPwd.length < PWD_VALID_LENGTH) { if (newPwd.length < PWD_VALID_LENGTH) {
isConfirmDisabled.value = true; isConfirmDisabled.value = true;
} }
} else { } else {
if (newPwd.length < PWD_VALID_LENGTH) { if (isResetPwdSectionShow.value && newPwd.length < PWD_VALID_LENGTH) {
isConfirmDisabled.value = true; isConfirmDisabled.value = true;
} }
} }

View File

@@ -1520,7 +1520,12 @@ function getAvgProcessTimeHorizontalBarChart(
contentData.avgWaitingTime, contentData.avgWaitingTime,
"date", "date",
); );
if (compareDashboardData.value.time.avg_waiting_time_by_edge !== null) { if (compareDashboardData.value.time.avg_waiting_time_by_edge === null) {
[avgWaitingTimeByEdgeData.value, avgWaitingTimeByEdgeOptions.value] = [
null,
null,
];
} else {
[avgWaitingTimeByEdgeData.value, avgWaitingTimeByEdgeOptions.value] = [avgWaitingTimeByEdgeData.value, avgWaitingTimeByEdgeOptions.value] =
getHorizontalBarChart( getHorizontalBarChart(
compareDashboardData.value.time.avg_waiting_time_by_edge, compareDashboardData.value.time.avg_waiting_time_by_edge,
@@ -1528,11 +1533,6 @@ function getAvgProcessTimeHorizontalBarChart(
false, false,
"date", "date",
); );
} else {
[avgWaitingTimeByEdgeData.value, avgWaitingTimeByEdgeOptions.value] = [
null,
null,
];
} }
[freqData.value, freqOptions.value] = getLineChart( [freqData.value, freqOptions.value] = getLineChart(
compareDashboardData.value.freq.cases, compareDashboardData.value.freq.cases,

View File

@@ -588,19 +588,19 @@ function setActivityBgImage(mapData) {
isLoading.value = true; isLoading.value = true;
switch (routeParams.type) { switch (routeParams.type) {
case "log": case "log":
if (!isCheckPage) { if (isCheckPage) {
logId.value = routeParams.fileId;
baseLogId.value = routeParams.fileId;
} else {
logId.value = file.parent?.id; logId.value = file.parent?.id;
baseLogId.value = file.parent?.id; baseLogId.value = file.parent?.id;
} else {
logId.value = routeParams.fileId;
baseLogId.value = routeParams.fileId;
} }
break; break;
case "filter": case "filter":
if (!isCheckPage) { if (isCheckPage) {
createFilterId.value = routeParams.fileId;
} else {
createFilterId.value = file.parent?.id; createFilterId.value = file.parent?.id;
} else {
createFilterId.value = routeParams.fileId;
} }
await allMapDataStore.fetchFunnel(createFilterId.value); await allMapDataStore.fetchFunnel(createFilterId.value);
isRuleData.value = Array.from(temporaryData.value); isRuleData.value = Array.from(temporaryData.value);

View File

@@ -85,16 +85,7 @@ let loadingTimerId = null;
const file = route.meta.file; const file = route.meta.file;
const isCheckPage = route.name.includes("Check"); const isCheckPage = route.name.includes("Check");
if (!isCheckPage) { if (isCheckPage) {
switch (params.type) {
case "log":
conformanceLogId.value = params.fileId;
break;
case "filter":
conformanceFilterId.value = params.fileId;
break;
}
} else {
switch (params.type) { switch (params.type) {
case "log": case "log":
conformanceLogId.value = file.parent?.id; conformanceLogId.value = file.parent?.id;
@@ -106,6 +97,15 @@ let loadingTimerId = null;
break; break;
} }
await conformanceStore.getConformanceReport(); await conformanceStore.getConformanceReport();
} else {
switch (params.type) {
case "log":
conformanceLogId.value = params.fileId;
break;
case "filter":
conformanceFilterId.value = params.fileId;
break;
}
} }
await conformanceStore.getConformanceParams(); await conformanceStore.getConformanceParams();
} catch (error) { } catch (error) {

View File

@@ -577,19 +577,19 @@ function setActivityBgImage(mapData) {
isLoading.value = true; isLoading.value = true;
switch (routeParams.type) { switch (routeParams.type) {
case "log": case "log":
if (!isCheckPage) { if (isCheckPage) {
logId.value = routeParams.fileId;
baseLogId.value = routeParams.fileId;
} else {
logId.value = file.parent?.id; logId.value = file.parent?.id;
baseLogId.value = file.parent?.id; baseLogId.value = file.parent?.id;
} else {
logId.value = routeParams.fileId;
baseLogId.value = routeParams.fileId;
} }
break; break;
case "filter": case "filter":
if (!isCheckPage) { if (isCheckPage) {
createFilterId.value = routeParams.fileId;
} else {
createFilterId.value = file.parent?.id; createFilterId.value = file.parent?.id;
} else {
createFilterId.value = routeParams.fileId;
} }
await allMapDataStore.fetchFunnel(createFilterId.value); await allMapDataStore.fetchFunnel(createFilterId.value);
isRuleData.value = Array.from(temporaryData.value); isRuleData.value = Array.from(temporaryData.value);

View File

@@ -1059,10 +1059,10 @@ function getAvgWaitingTimeLineChart(chartData, content, yUnit) {
const file = route.meta.file; const file = route.meta.file;
let id; let id;
if (!isCheckPage) { if (isCheckPage) {
id = routeParams.fileId;
} else {
id = file.parent?.id; id = file.parent?.id;
} else {
id = routeParams.fileId;
} }
// Fetch Performance Data // Fetch Performance Data
@@ -1112,7 +1112,12 @@ function getAvgWaitingTimeLineChart(chartData, content, yUnit) {
contentData.avgWaitingTime, contentData.avgWaitingTime,
"date", "date",
); );
if (performanceData.value.time.avg_waiting_time_by_edge !== null) { if (performanceData.value.time.avg_waiting_time_by_edge === null) {
[avgWaitingTimeByEdgeData.value, avgWaitingTimeByEdgeOptions.value] = [
null,
null,
];
} else {
[avgWaitingTimeByEdgeData.value, avgWaitingTimeByEdgeOptions.value] = [avgWaitingTimeByEdgeData.value, avgWaitingTimeByEdgeOptions.value] =
getHorizontalBarChart( getHorizontalBarChart(
performanceData.value.time.avg_waiting_time_by_edge, performanceData.value.time.avg_waiting_time_by_edge,
@@ -1120,11 +1125,6 @@ function getAvgWaitingTimeLineChart(chartData, content, yUnit) {
false, false,
"date", "date",
); );
} else {
[avgWaitingTimeByEdgeData.value, avgWaitingTimeByEdgeOptions.value] = [
null,
null,
];
} }
[casesByTaskData.value, casesByTaskOptions.value] = getHorizontalBarChart( [casesByTaskData.value, casesByTaskOptions.value] = getHorizontalBarChart(