From 5b8f9686e93998f05f6da6da753f0e41038c26f8 Mon Sep 17 00:00:00 2001
From: zhangguofu <zhangguofu@uniontech.com>
Date: Tue, 28 Feb 2023 14:46:32 +0800
Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=E3=80=901060=E3=80=91=E3=80=90AE?=
 =?UTF-8?q?=E3=80=91=E3=80=90RC1=E3=80=91=E3=80=90=E5=85=A8=E5=B9=B3?=
 =?UTF-8?q?=E5=8F=B0=E3=80=91=E3=80=90DDE=E3=80=91=E3=80=90=E6=96=B0?=
 =?UTF-8?q?=E9=9C=80=E6=B1=82=E3=80=91=E3=80=90=E6=97=A5=E5=8E=86=E3=80=91?=
 =?UTF-8?q?=E6=96=B0=E5=BB=BA=E5=8D=95=E5=A4=A9=E6=97=A5=E7=A8=8B=E5=A4=B1?=
 =?UTF-8?q?=E8=B4=A5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

 【1060】【AE】【RC1】【全平台】【DDE】【新需求】【日历】新建单天日程失败

Log: 【1060】【AE】【RC1】【全平台】【DDE】【新需求】【日历】新建单天日程失败

Bug: https://pms.uniontech.com/bug-view-187697.html
Change-Id: I72c1fb2e8f92a8d37f91f7ad2073081f74e5271b
---
 .../calendarDataManager/daccountmodule.cpp    | 22 +++++++++----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/calendar-service/src/calendarDataManager/daccountmodule.cpp b/calendar-service/src/calendarDataManager/daccountmodule.cpp
index 94968744..4c2492ac 100644
--- a/calendar-service/src/calendarDataManager/daccountmodule.cpp
+++ b/calendar-service/src/calendarDataManager/daccountmodule.cpp
@@ -213,7 +213,7 @@ bool DAccountModule::deleteScheduleTypeByID(const QString &typeID)
         m_accountDB->addUploadTask(uploadTask);
 
         //如果颜色不为系统类型则删除
-        if(scheduleType->typeColor().privilege() != DTypeColor::PriSystem){
+        if (scheduleType->typeColor().privilege() != DTypeColor::PriSystem) {
             m_accountDB->deleteTypeColor(scheduleType->typeColor().colorID());
             DUploadTaskData::Ptr uploadTask(new DUploadTaskData);
             uploadTask->setTaskType(DUploadTaskData::TaskType::Delete);
@@ -226,7 +226,7 @@ bool DAccountModule::deleteScheduleTypeByID(const QString &typeID)
         uploadNetWorkAccountData();
     } else {
         m_accountDB->deleteScheduleTypeByID(typeID, 1);
-        if(scheduleType->typeColor().privilege() != DTypeColor::PriSystem){
+        if (scheduleType->typeColor().privilege() != DTypeColor::PriSystem) {
             m_accountDB->deleteTypeColor(scheduleType->typeColor().colorID());
         }
     }
@@ -540,7 +540,7 @@ void DAccountModule::updateRemindSchedules(bool isClear)
 {
     //因为全天的当前提醒日程会在开始时间延后9小时提醒
     QDateTime dtCurrent = QDateTime::currentDateTime();
-    QDateTime dtStart = dtCurrent.addSecs(-9*60*60);
+    QDateTime dtStart = dtCurrent.addSecs(-9 * 60 * 60);
     QDateTime dtEnd = dtCurrent.addMSecs(UPDATEREMINDJOBTIMEINTERVAL);
 
     //获取未提醒的日程相关信息
@@ -688,7 +688,7 @@ void DAccountModule::removeDB()
     m_accountDB->removeDB();
     //如果为uid帐户退出则清空目录下所有关于uid的数据库文件
     //解决在某些条件下数据库没有被移除的问题（自测未发现）
-    if(account()->accountType() == DAccount::Type::Account_UnionID){
+    if (account()->accountType() == DAccount::Type::Account_UnionID) {
         QString dbPatch = getHomeConfigPath().append(QString("/deepin/dde-calendar-service/"));
         QDir dir(dbPatch);
         if (dir.exists()) {
@@ -717,7 +717,7 @@ QMap<QDate, DSchedule::List> DAccountModule::getScheduleTimesOn(const QDateTime
         //获取日程的开始结束时间差
         qint64 interval = schedule->dtStart().secsTo(schedule->dtEnd());
         //如果存在重复日程
-        if (schedule->recurs()) {
+        if (schedule->recurs() && DSchedule::RRule_None != schedule->getRRuleType()) {
             //如果为农历日程
             if (schedule->lunnar()) {
                 //农历重复日程计算
@@ -763,8 +763,8 @@ QMap<QDate, DSchedule::List> DAccountModule::getScheduleTimesOn(const QDateTime
             //如果在查询时间范围内
             QDateTime queryDtStart = dtStart;
             //如果日程为全天日程，则查询的开始时间设置为0点，因为全天日程的开始和结束时间都是0点
-            if(schedule->allDay()){
-                queryDtStart.setTime(QTime(0,0,0));
+            if (schedule->allDay()) {
+                queryDtStart.setTime(QTime(0, 0, 0));
             }
             if (!(schedule->dtEnd() < queryDtStart || schedule->dtStart() > dtEnd)) {
                 if (extend && schedule->isMultiDay()) {
@@ -772,7 +772,7 @@ QMap<QDate, DSchedule::List> DAccountModule::getScheduleTimesOn(const QDateTime
                     int extenddays = static_cast<int>(schedule->dtStart().daysTo(schedule->dtEnd()));
                     for (int i = 0; i <= extenddays; ++i) {
                         //如果扩展的日期在查询范围内则添加，否则退出
-                        if(m_scheduleMap.contains(schedule->dtStart().date().addDays(i))){
+                        if (m_scheduleMap.contains(schedule->dtStart().date().addDays(i))) {
                             m_scheduleMap[schedule->dtStart().date().addDays(i)].append(schedule);
                         } else {
                             break;
@@ -816,8 +816,8 @@ void DAccountModule::extendRecurrence(DSchedule::Map &scheduleMap, const DSchedu
 {
     QDateTime queryDtStart = dtStart;
     //如果日程为全天日程，则查询的开始时间设置为0点，因为全天日程的开始和结束时间都是0点
-    if(schedule->allDay()){
-        queryDtStart.setTime(QTime(0,0,0));
+    if (schedule->allDay()) {
+        queryDtStart.setTime(QTime(0, 0, 0));
     }
     if (schedule->recurs()) {
         //获取日程的开始结束时间差
@@ -960,7 +960,7 @@ void DAccountModule::slotSyncState(const int syncState)
         m_account->setSyncState(DAccount::Sync_StorageFull);
         break;
     default:
-        qWarning()<<"syncState:"<<syncState<<"fun:"<<__FUNCTION__<<" line:"<<__LINE__;
+        qWarning() << "syncState:" << syncState << "fun:" << __FUNCTION__ << " line:" << __LINE__;
         //默认服务器异常
         m_account->setSyncState(DAccount::Sync_ServerException);
         break;
-- 
2.20.1

