Skip to content

Conversation

@imtaejugkim
Copy link
Collaborator

@imtaejugkim imtaejugkim commented Sep 7, 2025

✅ 𝗖𝗵𝗲𝗰𝗸-𝗟𝗶𝘀𝘁

  • merge할 브랜치의 위치를 확인해 주세요(main❌/develop⭕)
  • 리뷰가 필요한 경우 리뷰어를 지정해 주세요
  • 리뷰는 (아직 미정)에 진행됩니다.
  • P1 단계의 리뷰는 (아직 미정)까지 반영합니다.
  • Approve된 PR은 assigner가 머지하고, 수정 요청이 온 경우 수정 후 다시 push를 합니다.

📌 𝗜𝘀𝘀𝘂𝗲𝘀

📎𝗪𝗼𝗿𝗸 𝗗𝗲𝘀𝗰𝗿𝗶𝗽𝘁𝗶𝗼𝗻

  • 태그 및 자연어처리 바텀시트 내려간 경우 초기화 구현
  • 스케쥴 하루종일 로직 추가

📷 𝗦𝗰𝗿𝗲𝗲𝗻𝘀𝗵𝗼𝘁

Screen_recording_20250907_222446.mp4

💬 𝗧𝗼 𝗥𝗲𝘃𝗶𝗲𝘄𝗲𝗿𝘀

Summary by CodeRabbit

  • New Features

    • Smarter natural-language parsing now detects “all-day” (English/Korean) and automatically toggles all-day.
    • Auto-populates title, start/end dates, and times from parsed input for events and to-dos.
    • Enhanced resets: clearing input (with switch on) restores sensible defaults; full reset also clears tags and switches.
  • Bug Fixes

    • Prevents outdated parsing from overwriting current input during rapid edits.
    • Ensures time order validation runs after parsing and maintains consistent state across resets.

@imtaejugkim imtaejugkim self-assigned this Sep 7, 2025
@imtaejugkim imtaejugkim added 🤢태정🤢 🔧 [FIX] 버그 및 오류 해결 labels Sep 7, 2025
@coderabbitai
Copy link

coderabbitai bot commented Sep 7, 2025

Warning

Review ran into problems

🔥 Problems

Git: Failed to clone repository. Please run the @coderabbitai full review command to re-trigger a full review. If the issue persists, set path_filters to include or exclude specific files.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/#152-natural-language-refactor

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
app/src/main/java/org/memento/presentation/plusbottomsheet/ParsedNaturalLanguage.kt (1)

247-250: Fix key lookup bug for Korean relative date keywords

You normalize to e, but lookup uses the untrimmed expr. This can miss matches with stray spaces.

Apply within this range:

-    mapOf("그제" to -2, "어제" to -1, "오늘" to 0, "내일" to 1, "모레" to 2)
-        .takeIf { it.containsKey(expr) }
-        ?.let { return now.plusDays(it[expr]!!.toLong()).truncatedToDays() }
+    mapOf("그제" to -2, "어제" to -1, "오늘" to 0, "내일" to 1, "모레" to 2)
+        .takeIf { it.containsKey(e) }
+        ?.let { return now.plusDays(it[e]!!.toLong()).truncatedToDays() }
app/src/main/java/org/memento/presentation/plusbottomsheet/AddToDoViewModel.kt (1)

304-320: Cancel any in-flight parse on reset to avoid post-reset state mutations

Without canceling, a pending job may repopulate fields after reset if it completes later.

Apply near the start of resetData():

         fun resetData() {
+            parseJob?.cancel()
+            parseJob = null
             _selectedDateText.value = "Today"
             _addToDoText.value = ""
             _addTagId.value = 0
             _addTagColor.value = "#F0F0F3"
             _deadLineText.value = "Add DeadLine"
             _addPriorityType.value = PriorityTagType.None
             _isSwitchOn.value = false
🧹 Nitpick comments (6)
app/src/main/java/org/memento/presentation/plusbottomsheet/ParsedDateResult.kt (1)

5-10: Consider Java interop: add @jvmoverloads to avoid breaking Java call sites

If any Java code constructs ParsedDateResult, the added param requires a source change. @jvmoverloads preserves Java overloads with defaults.

Apply within this range:

-data class ParsedDateResult(
+data class ParsedDateResult @JvmOverloads constructor(
     val title: String,
     val startDate: LocalDateTime? = null,
     val endDate: LocalDateTime? = null,
     val isAllDay: Boolean = false,
 )
app/src/main/java/org/memento/presentation/plusbottomsheet/ParsedNaturalLanguage.kt (2)

173-177: Strip all occurrences of all-day markers, not just the first match

Ensures no leftover “종일/all-day” fragments remain in titles.

Apply within this range:

-// 3-0) 먼저 all-day 의미 표현 감지 및 제거
-ALL_DAY_REGEX.find(text)?.let { m ->
-    isAllDay = true
-    text = text.replace(m.value, "")
-}
+// 3-0) 먼저 all-day 의미 표현 감지 및 제거
+if (ALL_DAY_REGEX.containsMatchIn(text)) {
+    isAllDay = true
+    text = ALL_DAY_REGEX.replace(text, "")
+}

236-237: Use locale-stable case conversions

toLowerCase()/toUpperCase() are locale-dependent and deprecated. Use lowercase/uppercase with Locale.ROOT to avoid edge cases (e.g., Turkish I).

Apply within these ranges:

-    val e = expr.trim().toLowerCase()
+    val e = expr.trim().lowercase(java.util.Locale.ROOT)
-        val m = months[mon.toLowerCase()] ?: now.monthValue
+        val m = months[mon.lowercase(java.util.Locale.ROOT)] ?: now.monthValue
-        val dow = DayOfWeek.valueOf(dayEn.toUpperCase())
+        val dow = DayOfWeek.valueOf(dayEn.uppercase(java.util.Locale.ROOT))

Also add the import:

import java.util.Locale

Also applies to: 293-295, 316-318

app/src/main/java/org/memento/presentation/plusbottomsheet/AddToDoViewModel.kt (1)

96-104: Guard against empty tag list to prevent IndexOutOfBoundsException

If the repository returns an empty list, tags[0] will crash. Use firstOrNull().

Apply within this range:

-                        if (_addTagId.value == 0) {
-                            _addTagId.value = tags[0].id
-                        }
+                        if (_addTagId.value == 0) {
+                            tags.firstOrNull()?.let { _addTagId.value = it.id }
+                        }

Do we guarantee at least one tag exists for all users/tenants? If yes, you can ignore this.

app/src/main/java/org/memento/presentation/plusbottomsheet/AddScheduleViewModel.kt (2)

261-266: Re-check switch state after debounce to avoid parsing when turned off

If the user flips the NLP switch off during the 500ms delay, parsing still proceeds. Add a guard after the debounce/equality check.

                     val source = input
                     delay(500L)

                     // 입력이 변경되었으면 중단
                     if (_eventText.value != source) return@launch
+                    // 스위치 상태 재확인 (디바운스 중 Off로 바뀐 경우 중단)
+                    if (!_isSwitchOn.value) return@launch

274-276: Guard against stale updates and empty titles before applying parse results

Double-check staleness just before applying, and avoid overwriting title with blank.

-                    val parsed = parseNaturalLanguage(_eventText.value, isParseTime = true)
-                    _eventText.value = parsed.title
+                    val parsed = parseNaturalLanguage(source, isParseTime = true)
+                    // 적용 직전, 입력이 바뀌었으면 중단
+                    if (_eventText.value != source) return@launch
+                    if (parsed.title.isNotBlank()) {
+                        _eventText.value = parsed.title
+                    }
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0ca1108 and 85bd6d5.

📒 Files selected for processing (4)
  • app/src/main/java/org/memento/presentation/plusbottomsheet/AddScheduleViewModel.kt (3 hunks)
  • app/src/main/java/org/memento/presentation/plusbottomsheet/AddToDoViewModel.kt (2 hunks)
  • app/src/main/java/org/memento/presentation/plusbottomsheet/ParsedDateResult.kt (1 hunks)
  • app/src/main/java/org/memento/presentation/plusbottomsheet/ParsedNaturalLanguage.kt (4 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: CI
🔇 Additional comments (8)
app/src/main/java/org/memento/presentation/plusbottomsheet/ParsedDateResult.kt (1)

9-10: Adding isAllDay to the result model looks good

Defaulted flag preserves source compatibility for Kotlin callers.

app/src/main/java/org/memento/presentation/plusbottomsheet/ParsedNaturalLanguage.kt (2)

11-11: All-day regex addition is appropriate

Good coverage for “하루 종일/종일/all-day”.


220-225: Propagating isAllDay in the result is consistent with the new parsing behavior

No further action needed here.

app/src/main/java/org/memento/presentation/plusbottomsheet/AddToDoViewModel.kt (2)

271-283: Debounce + stale-input guard + blank-input reset look solid

Using a source snapshot with a 500ms delay prevents stale parses, and resetting dates when the input is cleared matches the issue requirements.


284-286: Parsing with time disabled is appropriate for ToDo

Keeps date-only behavior and avoids unintended time parsing.

app/src/main/java/org/memento/presentation/plusbottomsheet/AddScheduleViewModel.kt (3)

267-272: Early reset on blank input looks good

Nice UX: restoring default times and clearing all-day when input is blank and NLP is on.


287-292: ```shell
#!/bin/bash

Locate and inspect the relevant logic in AddScheduleViewModel.kt

FILE="app/src/main/java/org/memento/presentation/plusbottomsheet/AddScheduleViewModel.kt"
rg -n -C2 'parsed.isAllDay|validateTimeOrder|updateAllDayCheck' "$FILE"

Find the definition of calculateEndTime in the same package

rg -n 'fun calculateEndTime' -n app/src/main/java/org/memento/presentation/plusbottomsheet/*.kt


---

`353-361`: **Remove invalid `parseJob` suggestion**  
The ViewModel doesn’t declare or use any `parseJob` property, so cancelling it in `resetData()` isn’t applicable. Discard the diff and focus on real cancellable coroutines or jobs if needed. 

> Likely an incorrect or invalid review comment.

</blockquote></details>

</blockquote></details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->

Copy link
Collaborator

@hyoeunjoo hyoeunjoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

바로 어푸드립니다! 어푸어푸어푸푸

Comment on lines +174 to +175
ALL_DAY_REGEX.find(text)?.let { m ->
isAllDay = true
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

굿!

Copy link
Collaborator

@hwidung hwidung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

굿! 수고하셨습니다

Comment on lines +261 to +265
val source = input
delay(500L)

val parsed = parseNaturalLanguage(input, isParseTime = true)
// 입력이 변경되었으면 중단
if (_eventText.value != source) return@launch
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

디바운싱 조타

@imtaejugkim imtaejugkim merged commit 664a896 into develop Sep 8, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🔧 [FIX] 버그 및 오류 해결 🤢태정🤢

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Fix] 바텀시트 데이터값 남아있는 오류 수정 [Feat] 자연어 로직 추가 구현

4 participants