Skip to content

Commit

Permalink
fix: 집중시간 저장시 쉬는시간이 없을경우에 서버 에러 대응
Browse files Browse the repository at this point in the history
시간이 없으면 PT0M으로 보내도록해서 해결
  • Loading branch information
devMinseok committed Aug 23, 2024
1 parent fde2207 commit 5adec2b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Projects/Feature/HomeFeature/Sources/Home/HomeCore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,8 @@ public struct HomeCore {
let restedTime = DateComponents(minute: restTimeBySeconds / 60, second: restTimeBySeconds % 60).to8601DurationString()
let request = FocusTimeHistory(
categoryNo: selectedCategoryID,
focusedTime: focusedTime,
restedTime: restedTime,
focusedTime: focusedTime ?? "PT0M",
restedTime: restedTime ?? "PT0M",
doneAt: Date()
)
try await self.pomodoroService.saveFocusTimeHistory(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import Foundation
* For more information look here: http://en.wikipedia.org/wiki/ISO_8601#Durations
*/
extension DateComponents {
/// ISO8601 Duration -> DateComponents
/// ISO8601 Duration -> DateComponents
public static func durationFrom8601String(_ durationString: String) -> DateComponents? {
try? Self.from8601String(durationString)
}
Expand Down Expand Up @@ -122,7 +122,7 @@ extension DateComponents.DurationParsingError: LocalizedError {

extension DateComponents {
/// DateComponents -> ISO8601 Duration
public func to8601DurationString() -> String {
public func to8601DurationString() -> String? {
var durationString = "P"

// 년, 월, 주, 일, 시간, 분, 초를 고려하여 변환
Expand All @@ -135,7 +135,7 @@ extension DateComponents {
+ (self.year ?? 0) * 31557600 // 평균 년 길이 (365.25일)

if totalSeconds == 0 {
return ""
return nil
}

var remainingSeconds = totalSeconds
Expand Down

0 comments on commit 5adec2b

Please sign in to comment.