From d7d05104cad9b772fc17216ef12bff95462fc0cd Mon Sep 17 00:00:00 2001 From: Tomas <tomasysh@gmail.com> Date: 星期四, 16 十二月 2021 11:34:27 +0800 Subject: [PATCH] clean code: [my-consultant-lisr] 移除不必要的 hasAppointment 判斷 --- PAMapp/pages/myConsultantList.vue | 21 +++++++++------------ 1 files changed, 9 insertions(+), 12 deletions(-) diff --git a/PAMapp/pages/myConsultantList.vue b/PAMapp/pages/myConsultantList.vue index 7aa2014..405eef5 100644 --- a/PAMapp/pages/myConsultantList.vue +++ b/PAMapp/pages/myConsultantList.vue @@ -87,18 +87,15 @@ // format contacted list this.myConsultantList.filter((consultant) => consultant.appointments!.length) .forEach((consultant) => { - const hasAppointment = consultant.appointments?.length; - if (hasAppointment) { - consultant.appointments!.forEach((appointment) => { - const consultantWithAppointmentId: ConsultantWithAppointmentId = { - ...consultant, - appointmentId: appointment.id, - appointmentDate: appointment.appointmentDate, - appointmentScore: appointment.satisfactionScore - }; - this.contactedList.push(consultantWithAppointmentId); - }) - } + consultant.appointments!.forEach((appointment) => { + const consultantWithAppointmentId: ConsultantWithAppointmentId = { + ...consultant, + appointmentId: appointment.id, + appointmentDate: appointment.appointmentDate, + appointmentScore: appointment.satisfactionScore + }; + this.contactedList.push(consultantWithAppointmentId); + }) }); this.contactedList = this.contactedList -- Gitblit v1.8.0