Skip to content

Commit aa8cbfc

Browse files
committed
Invert return value of noLogRepeatEnabledP
1 parent 7ef6c0c commit aa8cbfc

File tree

2 files changed

+12
-14
lines changed

2 files changed

+12
-14
lines changed

src/components/OrgFile/OrgFile.unit.test.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -121,25 +121,25 @@ describe('Unit Tests for Org file', () => {
121121
test('Detects "nologrepeat" when set in #+STARTUP as only option', () => {
122122
const testOrgFile = readFixture('schedule_with_repeater_and_nologrepeat');
123123
const state = parseOrg(testOrgFile);
124-
expect(noLogRepeatEnabledP({ state, headerIndex: 0 })).toBe(false);
124+
expect(noLogRepeatEnabledP({ state, headerIndex: 0 })).toBe(true);
125125
});
126126
test('Detects "nologrepeat" when set in #+STARTUP with other options', () => {
127127
const testOrgFile = readFixture('schedule_with_repeater_and_nologrepeat_and_other_options');
128128
const state = parseOrg(testOrgFile);
129-
expect(noLogRepeatEnabledP({ state, headerIndex: 0 })).toBe(false);
129+
expect(noLogRepeatEnabledP({ state, headerIndex: 0 })).toBe(true);
130130
});
131131
test('Does not detect "nologrepeat" when not set', () => {
132132
const testOrgFile = readFixture('schedule_with_repeater');
133133
const state = parseOrg(testOrgFile);
134-
expect(noLogRepeatEnabledP({ state, headerIndex: 0 })).toBe(true);
134+
expect(noLogRepeatEnabledP({ state, headerIndex: 0 })).toBe(false);
135135
});
136136
test('Detects "nologrepeat" when set via a property list', () => {
137137
const testOrgFile = readFixture('schedule_with_repeater_and_nologrepeat_property');
138138
const state = parseOrg(testOrgFile);
139-
expect(noLogRepeatEnabledP({ state, headerIndex: 1 })).toBe(false);
140-
expect(noLogRepeatEnabledP({ state, headerIndex: 2 })).toBe(false);
141-
expect(noLogRepeatEnabledP({ state, headerIndex: 5 })).toBe(true);
142-
expect(noLogRepeatEnabledP({ state, headerIndex: 7 })).toBe(false);
139+
expect(noLogRepeatEnabledP({ state, headerIndex: 1 })).toBe(true);
140+
expect(noLogRepeatEnabledP({ state, headerIndex: 2 })).toBe(true);
141+
expect(noLogRepeatEnabledP({ state, headerIndex: 5 })).toBe(false);
142+
expect(noLogRepeatEnabledP({ state, headerIndex: 7 })).toBe(true);
143143
});
144144
});
145145
});

src/reducers/org.js

+5-7
Original file line numberDiff line numberDiff line change
@@ -1043,7 +1043,7 @@ function updatePlanningItemsWithRepeaters(
10431043
['headers', headerIndex, 'titleLine', 'todoKeyword'],
10441044
currentTodoSet.get('keywords').first()
10451045
);
1046-
if (noLogRepeatEnabledP({ state, headerIndex })) {
1046+
if (!noLogRepeatEnabledP({ state, headerIndex })) {
10471047
const lastRepeatTimestamp = getCurrentTimestamp({ isActive: false, withStartTime: true });
10481048
const newLastRepeatValue = [
10491049
{
@@ -1096,14 +1096,12 @@ export function noLogRepeatEnabledP({ state, headerIndex }) {
10961096
.get('fileConfigLines')
10971097
.some(elt => elt.match(/^#\+STARTUP:.*nologrepeat.*/));
10981098
const loggingProp = inheritedValueOfProperty(state.get('headers'), headerIndex, 'LOGGING');
1099-
return (
1100-
!startupOptNoLogRepeat &&
1101-
!(
1102-
loggingProp &&
1099+
return !!(
1100+
startupOptNoLogRepeat ||
1101+
(loggingProp &&
11031102
loggingProp.some(
11041103
v => v.get('type') === 'text' && v.get('contents').match(/\s*nologrepeat\s*/)
1105-
)
1106-
)
1104+
))
11071105
);
11081106
}
11091107

0 commit comments

Comments
 (0)