aboutsummaryrefslogtreecommitdiffstats
path: root/timetask/http.go
diff options
context:
space:
mode:
authorTeddy Wing2017-06-03 11:22:08 +0200
committerTeddy Wing2017-06-03 11:22:08 +0200
commite99c7b69e0981d4a7b87310cd811b90a2ffbe12f (patch)
treeb3e183c548bb8affb78724cefad8ad539c94c3d5 /timetask/http.go
parent1a1d9c3c671d33f7013c94564007e2c5b33cea47 (diff)
downloadtimetasker-e99c7b69e0981d4a7b87310cd811b90a2ffbe12f.tar.bz2
Comment out all the things!
Half get rid of a lot of code. I don't like and don't want to use our old field types. Get rid of them and the code in 'http.go' that depends on them. Also get rid of the time entry submission code in 'main.go' as that's going to be redone.
Diffstat (limited to 'timetask/http.go')
-rw-r--r--timetask/http.go214
1 files changed, 107 insertions, 107 deletions
diff --git a/timetask/http.go b/timetask/http.go
index 83946ad..94a1597 100644
--- a/timetask/http.go
+++ b/timetask/http.go
@@ -1,13 +1,13 @@
package timetask
import (
- "fmt"
- "log"
+ // "fmt"
+ // "log"
"net/http"
"net/http/cookiejar"
"net/url"
- "strconv"
- "strings"
+ // "strconv"
+ // "strings"
"golang.org/x/net/publicsuffix"
)
@@ -36,106 +36,106 @@ func Login(username, password string) (resp *http.Response, err error) {
return resp, err
}
-func SubmitTimeEntries(fields Fields, time_entries []TimeEntry) (resp *http.Response, err error) {
- v := buildSubmissionParams(fields, time_entries)
-
- v.Set("module", "time")
- v.Set("action", "submitmultipletime")
-
- return nil, nil
-}
-
-func buildSubmissionParams(fields Fields, time_entries []TimeEntry) url.Values {
- v := url.Values{}
- entry_indexes := []string{}
-
- for i, entry := range time_entries {
- entry_indexes = append(entry_indexes, strconv.Itoa(i))
-
- client, err := fields.ClientByName(entry.Client)
- if err != nil {
- log.Panic(err)
- }
-
- project, err := client.ProjectByName(entry.Project)
- if err != nil {
- log.Panic(err)
- }
-
- module, err := project.ModuleByName(entry.Module)
- if err != nil {
- log.Panic(err)
- }
-
- task, err := project.TaskByName(entry.Task)
- if err != nil {
- log.Panic(err)
- }
-
- work_type, err := project.WorkTypeByName(entry.WorkType)
- if err != nil {
- log.Panic(err)
- }
-
- var billable string
- if entry.Billable {
- billable = "t"
- } else {
- billable = "f"
- }
-
- v.Set(
- fmt.Sprintf("f_personID%d", i),
- strconv.Itoa(fields.PersonID),
- )
-
- v.Set(
- fmt.Sprintf("f_clientID%d", i),
- strconv.Itoa(client.ID),
- )
-
- v.Set(
- fmt.Sprintf("f_projectID%d", i),
- strconv.Itoa(project.ID),
- )
-
- v.Set(
- fmt.Sprintf("f_moduleID%d", i),
- strconv.Itoa(module.ID),
- )
-
- v.Set(
- fmt.Sprintf("f_taskID%d", i),
- strconv.Itoa(task.ID),
- )
-
- v.Set(
- fmt.Sprintf("f_worktypeID%d", i),
- strconv.Itoa(work_type.ID),
- )
-
- v.Set(
- fmt.Sprintf("f_date%d", i),
- entry.Date.Format("02/01/06"), // day/month/year
- )
-
- v.Set(
- fmt.Sprintf("f_time%d", i),
- strconv.Itoa(entry.Time),
- )
-
- v.Set(
- fmt.Sprintf("f_billable%d", i),
- billable,
- )
-
- v.Set(
- fmt.Sprintf("f_description%d", i),
- entry.Description,
- )
- }
-
- v.Set("f_entryIndexes", strings.Join(entry_indexes, ","))
-
- return v
-}
+// func SubmitTimeEntries(fields Fields, time_entries []TimeEntry) (resp *http.Response, err error) {
+// v := buildSubmissionParams(fields, time_entries)
+//
+// v.Set("module", "time")
+// v.Set("action", "submitmultipletime")
+//
+// return nil, nil
+// }
+//
+// func buildSubmissionParams(fields Fields, time_entries []TimeEntry) url.Values {
+// v := url.Values{}
+// entry_indexes := []string{}
+//
+// for i, entry := range time_entries {
+// entry_indexes = append(entry_indexes, strconv.Itoa(i))
+//
+// client, err := fields.ClientByName(entry.Client)
+// if err != nil {
+// log.Panic(err)
+// }
+//
+// project, err := client.ProjectByName(entry.Project)
+// if err != nil {
+// log.Panic(err)
+// }
+//
+// module, err := project.ModuleByName(entry.Module)
+// if err != nil {
+// log.Panic(err)
+// }
+//
+// task, err := project.TaskByName(entry.Task)
+// if err != nil {
+// log.Panic(err)
+// }
+//
+// work_type, err := project.WorkTypeByName(entry.WorkType)
+// if err != nil {
+// log.Panic(err)
+// }
+//
+// var billable string
+// if entry.Billable {
+// billable = "t"
+// } else {
+// billable = "f"
+// }
+//
+// v.Set(
+// fmt.Sprintf("f_personID%d", i),
+// strconv.Itoa(fields.PersonID),
+// )
+//
+// v.Set(
+// fmt.Sprintf("f_clientID%d", i),
+// strconv.Itoa(client.ID),
+// )
+//
+// v.Set(
+// fmt.Sprintf("f_projectID%d", i),
+// strconv.Itoa(project.ID),
+// )
+//
+// v.Set(
+// fmt.Sprintf("f_moduleID%d", i),
+// strconv.Itoa(module.ID),
+// )
+//
+// v.Set(
+// fmt.Sprintf("f_taskID%d", i),
+// strconv.Itoa(task.ID),
+// )
+//
+// v.Set(
+// fmt.Sprintf("f_worktypeID%d", i),
+// strconv.Itoa(work_type.ID),
+// )
+//
+// v.Set(
+// fmt.Sprintf("f_date%d", i),
+// entry.Date.Format("02/01/06"), // day/month/year
+// )
+//
+// v.Set(
+// fmt.Sprintf("f_time%d", i),
+// strconv.Itoa(entry.Time),
+// )
+//
+// v.Set(
+// fmt.Sprintf("f_billable%d", i),
+// billable,
+// )
+//
+// v.Set(
+// fmt.Sprintf("f_description%d", i),
+// entry.Description,
+// )
+// }
+//
+// v.Set("f_entryIndexes", strings.Join(entry_indexes, ","))
+//
+// return v
+// }