diff options
author | Christian Pointner <equinox@helsinki.at> | 2015-12-13 01:19:19 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2015-12-13 01:19:19 (GMT) |
commit | 60666c71b666026697f7cfd3e92607e6dc4df67c (patch) | |
tree | 354b4520e355bc3ab506441a3a04ad45fa494869 /src/helsinki.at/rhimport/importer.go | |
parent | cccba3ce2e7a5797c84c78bce7e8d24fdcb8fce7 (diff) |
importer can now fetch group of cart
Diffstat (limited to 'src/helsinki.at/rhimport/importer.go')
-rw-r--r-- | src/helsinki.at/rhimport/importer.go | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/helsinki.at/rhimport/importer.go b/src/helsinki.at/rhimport/importer.go index 0fc5ecf..95f61f7 100644 --- a/src/helsinki.at/rhimport/importer.go +++ b/src/helsinki.at/rhimport/importer.go @@ -125,6 +125,21 @@ func (ctx *ImportContext) getPassword(cached bool) (err error) { return } +func (ctx *ImportContext) getGroupOfCart() (err error) { + req := getGroupOfCartRequest{} + req.cart = ctx.Cart + req.response = make(chan getGroupOfCartResult) + ctx.RdDb.getGroupOfCartChan <- req + + res := <-req.response + if res.err != nil { + err = res.err + return + } + ctx.GroupName = res.group + return +} + func (ctx *ImportContext) getShowInfo() (err error) { req := getShowInfoRequest{} req.showid = ctx.ShowId @@ -434,7 +449,7 @@ func ImportFile(ctx *ImportContext) (res *ImportResult, err error) { return } else if ctx.GroupName != "" { res.ResponseCode = 500 - res.ErrorString = "Importing to music pools using the group name is not yet implemented" + res.ErrorString = "Importing to music pools is not yet implemented" // TODO: fetch info from dropboxes (import-params) // - add_cart(ctx, res) [200 -> OK] // - add_cut(ctx, res) [200 -> OK] @@ -443,7 +458,7 @@ func ImportFile(ctx *ImportContext) (res *ImportResult, err error) { res.ResponseCode = 500 res.ErrorString = "Importing to a Cart which might not exist is not yet implemented" // TODO: (everything except Cut, GroupName and ShowId must be in context) - // - ctx.GetGroupOfCart(ctx.Cart) + // - ctx.getGroupOfCart(ctx.Cart) // - remove_cart(ctx, res) [200 || 404 -> OK] // - add_cart(ctx, res) [200 -> OK] // - add_cut(ctx, res) [200 -> OK] @@ -456,7 +471,7 @@ func ImportFile(ctx *ImportContext) (res *ImportResult, err error) { res.Cut = ctx.Cut } else { res.ResponseCode = http.StatusBadRequest - res.ErrorString = "The request doesn't contain enough Information to be processed" + res.ErrorString = "The request doesn't contain enough information to be processed" } rhdl.Printf("ImportResult: %+v\n", res) |