Skip to content

Commit 9b9f859

Browse files
committed
If startup option "nologrepeat" is set, don't log repeat information
Address 200ok-ch#118
1 parent c9375f8 commit 9b9f859

File tree

1 file changed

+41
-37
lines changed

1 file changed

+41
-37
lines changed

src/reducers/org.js

+41-37
Original file line numberDiff line numberDiff line change
@@ -1043,43 +1043,47 @@ function updatePlanningItemsWithRepeaters(
10431043
['headers', headerIndex, 'titleLine', 'todoKeyword'],
10441044
currentTodoSet.get('keywords').first()
10451045
);
1046-
const lastRepeatTimestamp = getCurrentTimestamp({ isActive: false, withStartTime: true });
1047-
const newLastRepeatValue = [
1048-
{
1049-
type: 'timestamp',
1050-
id: generateId(),
1051-
firstTimestamp: lastRepeatTimestamp,
1052-
secondTimestamp: null,
1053-
},
1054-
];
1055-
state = state.updateIn(['headers', headerIndex, 'propertyListItems'], propertyListItems =>
1056-
propertyListItems.some(item => item.get('property') === 'LAST_REPEAT')
1057-
? propertyListItems.map(item =>
1058-
item.get('property') === 'LAST_REPEAT'
1059-
? item.set('value', fromJS(newLastRepeatValue))
1060-
: item
1061-
)
1062-
: propertyListItems.push(
1063-
fromJS({
1064-
property: 'LAST_REPEAT',
1065-
value: newLastRepeatValue,
1066-
id: generateId(),
1067-
})
1068-
)
1069-
);
1070-
state = state.updateIn(['headers', headerIndex], header => {
1071-
let rawDescription = header.get('rawDescription');
1072-
if (rawDescription.startsWith('\n')) {
1073-
rawDescription = rawDescription.slice(1);
1074-
}
1075-
rawDescription =
1076-
`\n- State "${newTodoState}" from "${currentTodoState}" ${renderAsText(
1077-
fromJS(lastRepeatTimestamp)
1078-
)}\n` + rawDescription;
1079-
return header
1080-
.set('rawDescription', rawDescription)
1081-
.set('description', parseRawText(rawDescription));
1082-
});
1046+
1047+
if (!state.get('fileConfigLines').find(elt => elt.match(/^#\+STARTUP:\s+nologrepeat/))) {
1048+
const lastRepeatTimestamp = getCurrentTimestamp({ isActive: false, withStartTime: true });
1049+
const newLastRepeatValue = [
1050+
{
1051+
type: 'timestamp',
1052+
id: generateId(),
1053+
firstTimestamp: lastRepeatTimestamp,
1054+
secondTimestamp: null,
1055+
},
1056+
];
1057+
1058+
state = state.updateIn(['headers', headerIndex, 'propertyListItems'], propertyListItems =>
1059+
propertyListItems.some(item => item.get('property') === 'LAST_REPEAT')
1060+
? propertyListItems.map(item =>
1061+
item.get('property') === 'LAST_REPEAT'
1062+
? item.set('value', fromJS(newLastRepeatValue))
1063+
: item
1064+
)
1065+
: propertyListItems.push(
1066+
fromJS({
1067+
property: 'LAST_REPEAT',
1068+
value: newLastRepeatValue,
1069+
id: generateId(),
1070+
})
1071+
)
1072+
);
1073+
state = state.updateIn(['headers', headerIndex], header => {
1074+
let rawDescription = header.get('rawDescription');
1075+
if (rawDescription.startsWith('\n')) {
1076+
rawDescription = rawDescription.slice(1);
1077+
}
1078+
rawDescription =
1079+
`\n- State "${newTodoState}" from "${currentTodoState}" ${renderAsText(
1080+
fromJS(lastRepeatTimestamp)
1081+
)}\n` + rawDescription;
1082+
return header
1083+
.set('rawDescription', rawDescription)
1084+
.set('description', parseRawText(rawDescription));
1085+
});
1086+
}
10831087
}
10841088
return state;
10851089
}

0 commit comments

Comments
 (0)