mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Some code improvements
* Some assignments simplified by using assignment operators * Rewrite switch statement with only one case as if. * Rewrite if-else chain as a switch statement. * go fmt `modules/todoist/project.go` file.
This commit is contained in:
@@ -14,12 +14,12 @@ type Project struct {
|
||||
}
|
||||
|
||||
func NewProject(id int) *Project {
|
||||
// Todoist seems to experience a lot of network issues on their side
|
||||
// If we can't connect, handle it with an empty project until we can
|
||||
// Todoist seems to experience a lot of network issues on their side
|
||||
// If we can't connect, handle it with an empty project until we can
|
||||
project, err := todoist.GetProject(id)
|
||||
if err != nil {
|
||||
return &Project{}
|
||||
}
|
||||
if err != nil {
|
||||
return &Project{}
|
||||
}
|
||||
|
||||
proj := &Project{
|
||||
Project: project,
|
||||
@@ -41,7 +41,7 @@ func (proj *Project) isLast() bool {
|
||||
}
|
||||
|
||||
func (proj *Project) up() {
|
||||
proj.index = proj.index - 1
|
||||
proj.index--
|
||||
|
||||
if proj.index < 0 {
|
||||
proj.index = len(proj.tasks) - 1
|
||||
@@ -54,7 +54,7 @@ func (proj *Project) down() {
|
||||
return
|
||||
}
|
||||
|
||||
proj.index = proj.index + 1
|
||||
proj.index++
|
||||
if proj.index >= len(proj.tasks) {
|
||||
proj.index = 0
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user