diff options
author | Christian Pointner <equinox@helsinki.at> | 2015-12-19 02:55:57 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2015-12-19 02:55:57 (GMT) |
commit | 1f3dab1eab175c4c0e4d4d6d3c339daf02899ca9 (patch) | |
tree | b5862f40f116a7459cef074ae6a05c94a7863462 /src/helsinki.at/rhimport | |
parent | d4e8c888f9148d1e5ac39ef4cb6aa9203437d1db (diff) |
improved show based imports
Diffstat (limited to 'src/helsinki.at/rhimport')
-rw-r--r-- | src/helsinki.at/rhimport/importer.go | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/helsinki.at/rhimport/importer.go b/src/helsinki.at/rhimport/importer.go index 94065f6..afe422f 100644 --- a/src/helsinki.at/rhimport/importer.go +++ b/src/helsinki.at/rhimport/importer.go @@ -525,6 +525,7 @@ func is_cart_member_of_show(ctx *ImportContext, res *ImportResult, carts []uint) } res.ResponseCode = http.StatusBadRequest res.ErrorString = fmt.Sprintf("Requested cart %d is not a member of show: %d", ctx.Cart, ctx.ShowId) + res.Cart = ctx.Cart return false } @@ -609,8 +610,14 @@ func ImportFile(ctx *ImportContext) (res *ImportResult, err error) { if err = clear_show_carts(ctx, res, show_carts); err != nil || (res.ResponseCode != http.StatusOK && res.ResponseCode != http.StatusNotFound) { return } - if err = add_show_cart_cut(ctx, res, show_carts); err != nil || res.ResponseCode != http.StatusOK { - return + if ctx.ClearCart && !ctx.ClearShowCarts { + if err = remove_add_cart_cut(ctx, res); err != nil || res.ResponseCode != http.StatusOK { + return + } + } else { + if err = add_show_cart_cut(ctx, res, show_carts); err != nil || res.ResponseCode != http.StatusOK { + return + } } rmCartOnErr = true } else if ctx.GroupName != "" { |