11package  backend
22
33import  (
4- 	"strconv " 
4+ 	"fmt " 
55
66	"github.com/olebedev/config" 
77	"github.com/wtfutil/todoist" 
@@ -24,7 +24,7 @@ func (todo *Todoist) BuildProjects() []*Project {
2424	projects  :=  []* Project {}
2525
2626	for  _ , id  :=  range  todo .projects  {
27- 		i  :=  strconv . Itoa ( id .( int ) )
27+ 		i  :=  fmt . Sprintf ( "%v" ,  id )
2828		proj  :=  todo .GetProject (i )
2929		projects  =  append (projects , proj )
3030	}
@@ -38,15 +38,13 @@ func (todo *Todoist) GetProject(id string) *Project {
3838		Index :   - 1 ,
3939		backend : todo ,
4040	}
41- 	i64 , _  :=  strconv .ParseUint (id , 10 , 32 )
42- 	i  :=  uint (i64 )
43- 	project , err  :=  todoist .GetProject (i )
41+ 	project , err  :=  todoist .GetProject (id )
4442	if  err  !=  nil  {
4543		proj .Err  =  err 
4644		return  proj 
4745	}
4846
49- 	proj .ID  =  strconv . FormatUint ( uint64 ( project .ID ),  10 ) 
47+ 	proj .ID  =  project .ID 
5048	proj .Name  =  project .Name 
5149
5250	tasks , err  :=  todo .LoadTasks (proj .ID )
@@ -57,9 +55,8 @@ func (todo *Todoist) GetProject(id string) *Project {
5755}
5856
5957func  toTask (task  todoist.Task ) Task  {
60- 	id  :=  strconv .FormatUint (uint64 (task .ID ), 10 )
6158	return  Task {
62- 		ID :        id ,
59+ 		ID :        task . ID ,
6360		Completed : task .Completed ,
6461		Name :      task .Content ,
6562	}
@@ -80,19 +77,15 @@ func (todo *Todoist) LoadTasks(id string) ([]Task, error) {
8077
8178func  (todo  * Todoist ) CloseTask (task  * Task ) error  {
8279	if  task  !=  nil  {
83- 		i64 , _  :=  strconv .ParseUint (task .ID , 10 , 32 )
84- 		i  :=  uint (i64 )
85- 		internal  :=  todoist.Task {ID : i }
80+ 		internal  :=  todoist.Task {ID : task .ID }
8681		return  internal .Close ()
8782	}
8883	return  nil 
8984}
9085
9186func  (todo  * Todoist ) DeleteTask (task  * Task ) error  {
9287	if  task  !=  nil  {
93- 		i64 , _  :=  strconv .ParseUint (task .ID , 10 , 32 )
94- 		i  :=  uint (i64 )
95- 		internal  :=  todoist.Task {ID : i }
88+ 		internal  :=  todoist.Task {ID : task .ID }
9689		return  internal .Delete ()
9790	}
9891	return  nil 
@@ -101,7 +94,7 @@ func (todo *Todoist) DeleteTask(task *Task) error {
10194func  (todo  * Todoist ) Sources () []string  {
10295	var  result  []string 
10396	for  _ , id  :=  range  todo .projects  {
104- 		i  :=  strconv . Itoa ( id .( int ) )
97+ 		i  :=  fmt . Sprintf ( "%v" ,  id )
10598		result  =  append (result , i )
10699	}
107100	return  result 
0 commit comments