From 3fb09744cc5264fdf3740364a9c6f6f5b64707cc Mon Sep 17 00:00:00 2001 From: Nikolaus Gotsche Date: Fri, 26 Oct 2018 15:36:21 +0200 Subject: Export tested, structs made Public --- interact.go | 42 ++++++++++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 16 deletions(-) (limited to 'interact.go') diff --git a/interact.go b/interact.go index 06892ed..bc20f2b 100644 --- a/interact.go +++ b/interact.go @@ -89,8 +89,8 @@ func interact(fulldb bool) { Closes the current task 'now' and remember it to continue later. The User is not asked to enter a comment.`, Func: func(c *ishell.Context) { - if opentask.id > 0 { - setPauseTask(opentask.id) + if opentask.Id > 0 { + setPauseTask(opentask.Id) c.Println("Pausing Task", pausetask) } closeTask(false) @@ -212,7 +212,7 @@ func interact(fulldb bool) { c.Println(boldRed(arg, "is not a valid id!")) } } else { - tids := getTaskIds() + tids := GetTaskIds() selids, lids := GetTaskList(tids, false,false) choice := c.MultiChoice(lids, "Select a Task to Edit") if choice > -1 { @@ -243,7 +243,7 @@ func interact(fulldb bool) { c.Println(boldRed(arg, "is not a valid id!")) } } else { - pids := getProjectIds() + pids := GetProjectIds() selids, lids := getProjectList(pids) choice := c.MultiChoice(lids, "Select a Project to Edit") if choice > -1 { @@ -274,7 +274,7 @@ func interact(fulldb bool) { c.Println(boldRed(arg, "is not a valid id!")) } } else { - tids := getTaskIds() + tids := GetTaskIds() selids, lids := GetTaskList(tids, false,false) choice := c.MultiChoice(lids, "Select a Task to Edit") //c.Println(tids) @@ -308,7 +308,7 @@ func interact(fulldb bool) { c.Println(boldRed(arg, "is not a valid id!")) } } else { - pids := getProjectIds() + pids := GetProjectIds() selids, lids := getProjectList(pids) choice := c.MultiChoice(lids, "Select a Project to Edit") //c.Println(pids) @@ -501,12 +501,22 @@ func interact(fulldb bool) { Func: func(c *ishell.Context) { //multichoice("Geh scheissn") - nm,st := GetTaskSums(currproject.id) + nm,st := GetTaskSums(currproject.Id) i := Multichoice("Sicha?",st) fmt.Println(nm[i]) - //some := []string{"Nice","Shit this","is. Truly","Man"} - //out := getInterAutoInput("Got milk?",some) - //fmt.Println(out) + prid := GetProjectIds() + cuid := GetCustomerIds() + taid := GetTaskIds() + prs := GetSelectedProjects(prid) + cus := GetSelectedCustomers(cuid) + tas := GetSelectedTasks(taid) + c.Println("Tasks:",len(tas)) + c.Println("Projects:",len(prs)) + c.Println("Customers:",len(cus)) + + ExportCustomers(cus,"export.customers") + ExportProjects(prs,"export.projects") + ExportTasks(tas,"export.tasks") }, }) @@ -589,10 +599,10 @@ func interact(fulldb bool) { count, hours, dur := AnalyzeTasks(seltasks) //c.Printf("%v Tasks Selected. Totaling %.2f (h) - Dates: %s\n",count,hours,dur) - proj, cust := getProject(billprojid) + proj, cust := GetProject(billprojid) // IF CUSTOMER 0 NO BILL CAN BE CREATED - if cust.id == 0 { - c.Println(boldRed("Customer ", cust.company, " with id ", cust.id, " Cannot be billed. Please move ", proj.name, " to a valid Customer")) + if cust.Id == 0 { + c.Println(boldRed("Customer ", cust.Company, " with id ", cust.Id, " Cannot be billed. Please move ", proj.Name, " to a valid Customer")) return } @@ -607,7 +617,7 @@ func interact(fulldb bool) { c.ShowPrompt(false) //fullbillinfo := fmt.Sprintf("For: %s - %s - %.2f(€/h) - Invoice: %s Id:%v\nProject: %s - Id:%v\n%v Tasks Selected. Totaling %.2f (h) - Dates: %s\nProjected Income: %.2f(€)\n",cust.company,cust.name,cust.satz,billident,billid,proj.name,proj.id,count,hours,dur,hours*cust.satz) - fullbillinfo := fmt.Sprintf("For: %s - %s - %.2f(€/h) \nProject: %s - Id:%v\n%v Tasks Selected. Totaling %.2f (h) - Dates: %s\nProjected Income: %.2f(€)\n", cust.company, cust.name, cust.satz, proj.name, proj.id, count, hours, dur, hours*cust.satz) + fullbillinfo := fmt.Sprintf("For: %s - %s - %.2f(€/h) \nProject: %s - Id:%v\n%v Tasks Selected. Totaling %.2f (h) - Dates: %s\nProjected Income: %.2f(€)\n", cust.Company, cust.Name, cust.Satz, proj.Name, proj.Id, count, hours, dur, hours*cust.Satz) sep := "-------------------------\n" restinfo := "Here some Info about the rest" restids := selids @@ -660,7 +670,7 @@ func interact(fulldb bool) { } } c.Printf("%T %v - %T %v\n", tsk, tsk, hrf, hrf) - allitems = append(allitems, billitem{tsk, itdur, hrf, Round(hrf*cust.satz, 5)}) + allitems = append(allitems, billitem{tsk, itdur, hrf, Round(hrf*cust.Satz, 5)}) c.Print("<>") c.ReadLine() //c.ShowPrompt(true) @@ -668,7 +678,7 @@ func interact(fulldb bool) { } billid, billident := newBill(billprojid) //c.Println(green("Bill Completed")) - fullbill := bill{billid, billident, dur, proj.id, proj.name, time.Time{}, time.Time{}, allitems} + fullbill := bill{billid, billident, dur, proj.Id, proj.Name, time.Time{}, time.Time{}, allitems} saveBill(fullbill) checkTasks(selids, billid) c.ProgressBar().Indeterminate(true) -- cgit v1.2.3