Skip to content

Commit a38989a

Browse files
committed
removed default from yesterday, custom dates are being preserved
Signed-off-by: Vedansh Saini <[email protected]>
1 parent 67278cc commit a38989a

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

src/scripts/popup.js

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,10 +269,29 @@ document.addEventListener('DOMContentLoaded', function () {
269269
chrome.storage.local.get([
270270
'selectedTimeframe',
271271
'lastWeekContribution',
272-
'yesterdayContribution'
272+
'yesterdayContribution',
273+
'startingDate',
274+
'endingDate',
273275
], (items) => {
274276
console.log('Restoring state:', items);
275277

278+
if(items.startingDate && items.endingDate && !items.lastWeekContribution && !items.yesterdayContribution) {
279+
const startDateInput = document.getElementById('startingDate');
280+
const endDateInput = document.getElementById('endingDate');
281+
282+
if(startDateInput && endDateInput) {
283+
startDateInput.value = items.startingDate;
284+
endDateInput.value = items.endingDate;
285+
startDateInput.readOnly = false;
286+
endDateInput.readOnly = false;
287+
}
288+
document.querySelectorAll('input[name="timeframe"]').forEach(radio => {
289+
radio.checked = false;
290+
radio.dataset.wasChecked = 'false';
291+
})
292+
return;
293+
}
294+
276295
if (!items.selectedTimeframe) {
277296
items.selectedTimeframe = 'yesterdayContribution';
278297
items.lastWeekContribution = false;
@@ -597,4 +616,4 @@ if (cacheInput) {
597616
});
598617
});
599618

600-
}
619+
}

src/scripts/scrumHelper.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ function allIncluded(outputTarget = 'email') {
126126
startingDate = items.startingDate;
127127
endingDate = items.endingDate;
128128
} else {
129-
handleLastWeekContributionChange(); //when no date is stored, i.e on fresh unpack - default to last week.
129+
handleLastWeekContributionChange(); //when no date is stored i.e on fresh unpack - default to last week.
130130
if (outputTarget === 'popup') {
131131
chrome.storage.local.set({ lastWeekContribution: true, yesterdayContribution: false });
132132
}

0 commit comments

Comments
 (0)