Skip to content

Commit 2520867

Browse files
author
Guido Quezada
committed
TT-69 fix: adding or editing an entry must not overlap the date of any other entry
1 parent 571755a commit 2520867

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

commons/git_hooks/enforce_semantic_commit_msg.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
SUCCESS_MSG = "Commit succeed!. Semantic commit message is correct."
1515

16-
COMMIT_MSG_REGEX = r'(build|ci|docs|feat|fix|perf|refactor|style|test|chore|revert)(\([\w\-]+\))?:\s.*'
16+
COMMIT_MSG_REGEX = r'(TT-)[0-9].*(build|ci|docs|feat|fix|perf|refactor|style|test|chore|revert)(\([\w\-]+\))?:\s.*'
1717

1818
# Get the commit message file
1919
commit_msg_file = open(sys.argv[1]) # The first argument is the file

tests/time_tracker_api/time_entries/time_entries_model_test.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,12 @@ def create_time_entry(
6161
"2020-10-01T02:00:00.000Z",
6262
"2020-10-01T12:00:00.000Z",
6363
),
64+
(
65+
"2020-10-01T05:00:00.000Z",
66+
"2020-10-01T10:00:00.000Z",
67+
"2020-10-01T06:00:00.000Z",
68+
"2020-10-01T07:00:00.000Z",
69+
),
6470
],
6571
)
6672
def test_find_interception_with_date_range_should_find(

time_tracker_api/time_entries/time_entries_repository.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,10 @@ def find_interception_with_date_range(
207207
result = self.container.query_items(
208208
query="""
209209
SELECT * FROM c
210-
WHERE ((c.start_date BETWEEN @start_date AND @end_date)
210+
WHERE (((c.start_date BETWEEN @start_date AND @end_date)
211211
OR (c.end_date BETWEEN @start_date AND @end_date))
212+
OR ((@start_date BETWEEN c.start_date AND c.end_date)
213+
OR (@end_date BETWEEN c.start_date AND c.end_date)))
212214
AND c.start_date!= @end_date
213215
AND c.end_date!= @start_date
214216
{conditions_clause}

0 commit comments

Comments
 (0)