Skip to content

Commit f7c2d15

Browse files
Update Previous Clock Time on Timer Stop
- This will display the most recently used timer first in the topic drop down.
1 parent 7cc6d77 commit f7c2d15

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

src/index.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,9 +257,20 @@ ipcMain.handle('log-time-handler', (req, data) => {
257257
const sqlStatement = `INSERT INTO clock (topicID, subtopicID, project, time, date) VALUES (?, ?, ?, ?, CURRENT_TIMESTAMP)`;
258258
const params = [data.topicID, data.subtopicID, data.project, data.time];
259259
const result = databaseHandler('run', sqlStatement, params);
260+
261+
updateTopicPreviousClock(data.topicID);
260262
return result;
261263
});
262264

265+
// This is used to change the previousClock variable in topic and subtopic tables
266+
// This will update the order in which topics and subtopics are displayed
267+
function updateTopicPreviousClock(id){
268+
const sqlStatement = `UPDATE topics SET previousTime = CURRENT_TIMESTAMP WHERE id = ?`;
269+
const params = [id];
270+
const result = databaseHandler('run', sqlStatement, params);
271+
return result;
272+
}
273+
263274
ipcMain.handle('quick-times-handler', async (req, data) => {
264275
if (!data || !data.request) return;
265276
let times;

0 commit comments

Comments
 (0)