changeset 56:22ac80ac041b

Show todo/reminder IDs in listing and when marked done
author Lewin Bormann <lbo@spheniscida.de>
date Sun, 11 Dec 2016 15:51:40 +0100
parents c1fc20f0ceaf
children 5c1a662b89f5
files handler_remind.go handler_todo.go sql/todo.go
diffstat 3 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/handler_remind.go	Sat Dec 10 21:15:28 2016 +0100
+++ b/handler_remind.go	Sun Dec 11 15:51:40 2016 +0100
@@ -183,7 +183,7 @@
 		t := rms[i].Due.Add(time.Duration(*flagLocalOffset) * time.Second)
 		date := fmt.Sprintf("%02d-%02d-%02d %02d:%02d", t.Year(), int(t.Month()), t.Day(), t.Hour(), t.Minute())
 		buttons[i] = []inlineKeyboardButton{inlineKeyboardButton{
-			Text:          fmt.Sprintf("[%s] %s (%s)", date, rms[i].Text, rms[i].Owner),
+			Text:          fmt.Sprintf("#%d [%s] %s (%s)", rms[i].ReminderID, date, rms[i].Text, rms[i].Owner),
 			Callback_Data: fmt.Sprintf("%s:%d", cancelReminderCallback, rms[i].ReminderID),
 		}}
 	}
--- a/handler_todo.go	Sat Dec 10 21:15:28 2016 +0100
+++ b/handler_todo.go	Sun Dec 11 15:51:40 2016 +0100
@@ -42,7 +42,7 @@
 		buttons := make([][]inlineKeyboardButton, len(todos))
 
 		for i := range todos {
-			text := fmt.Sprintf("%s (%s)", todos[i].Text, todos[i].Owner)
+			text := fmt.Sprintf("#%d: %s (%s)", todos[i].ID, todos[i].Text, todos[i].Owner)
 			token := fmt.Sprintf("%s:%d", todoDoneCallback, todos[i].ID)
 
 			row := []inlineKeyboardButton{
@@ -67,6 +67,7 @@
 		return replyContent{text: "_Zugriff fehlgeschlagen:_ " + err.Error()}, err
 	}
 
+	// This is an implementation details; users outside of this function shouldn't rely on it.
 	id, err := strconv.ParseUint(token, 10, 64)
 
 	if err != nil {
@@ -82,7 +83,7 @@
 	reply := replyContent{}
 
 	if affected > 0 {
-		reply.text = "*✓*"
+		reply.text = fmt.Sprintf("*✓* Aufgabe #%d erledigt!")
 	} else {
 		reply.text = "Aufgabe bereits erledigt!"
 	}
--- a/sql/todo.go	Sat Dec 10 21:15:28 2016 +0100
+++ b/sql/todo.go	Sun Dec 11 15:51:40 2016 +0100
@@ -73,7 +73,7 @@
 
 type OpenTodo struct {
 	// to be used as callback data
-	ID    int64
+	ID    uint
 	Text  string
 	Owner string
 }