From 61c2fe8fa55e1406b0d3903f7433d6b841fdcb44 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Sat, 17 Dec 2016 03:53:34 +0100 Subject: semantic of jingles has changed diff --git a/rddb/rddb.go b/rddb/rddb.go index b963972..2a1c743 100644 --- a/rddb/rddb.go +++ b/rddb/rddb.go @@ -314,10 +314,9 @@ type getShowCartListRequest struct { } type JingleListEntry struct { - Group string - Title string - ActiveCart int - InactiveCart int + Group string + Title string + Cart int } type JingleList []JingleListEntry @@ -347,9 +346,8 @@ type getJingleListRequest struct { } type getJingleCutListResult struct { - active CartListEntry - inactive CartListEntry - err error + cart CartListEntry + err error } type getJingleCutListRequest struct { @@ -488,7 +486,7 @@ func (d *db) init() (err error) { if d.getCutInfoStmt, err = d.dbh.Prepare("select CUT_NAME,EVERGREEN,DESCRIPTION,LENGTH,ORIGIN_DATETIME,PLAY_COUNTER,LAST_PLAY_DATETIME from CUTS where CART_NUMBER = ?"); err != nil { return } - if d.getJingleListStmt, err = d.dbh.Prepare("select GROUPS.NAME,DROPBOXES.SET_USER_DEFINED,GROUPS.DEFAULT_LOW_CART,GROUPS.DEFAULT_HIGH_CART,GROUPS.DESCRIPTION from USER_PERMS, DROPBOXES, GROUPS where USER_PERMS.USER_NAME = ? and DROPBOXES.GROUP_NAME = USER_PERMS.GROUP_NAME and DROPBOXES.GROUP_NAME = GROUPS.NAME and DROPBOXES.STATION_NAME = ?;"); err != nil { + if d.getJingleListStmt, err = d.dbh.Prepare("select GROUPS.NAME,DROPBOXES.SET_USER_DEFINED,GROUPS.DEFAULT_LOW_CART,GROUPS.DESCRIPTION from USER_PERMS, DROPBOXES, GROUPS where USER_PERMS.USER_NAME = ? and DROPBOXES.GROUP_NAME = USER_PERMS.GROUP_NAME and DROPBOXES.GROUP_NAME = GROUPS.NAME and DROPBOXES.STATION_NAME = ?;"); err != nil { return } if d.getPoolListStmt, err = d.dbh.Prepare("select GROUPS.NAME,DROPBOXES.SET_USER_DEFINED,DROPBOXES.PATH,GROUPS.DESCRIPTION from USER_PERMS, DROPBOXES, GROUPS where USER_PERMS.USER_NAME = ? and DROPBOXES.GROUP_NAME = USER_PERMS.GROUP_NAME and DROPBOXES.GROUP_NAME = GROUPS.NAME and DROPBOXES.STATION_NAME = ?;"); err != nil { @@ -746,7 +744,7 @@ func (d *db) getJingleList(username string) (result getJingleListResult) { var jingle JingleListEntry var params string - if result.err = rows.Scan(&jingle.Group, ¶ms, &jingle.ActiveCart, &jingle.InactiveCart, &jingle.Title); result.err != nil { + if result.err = rows.Scan(&jingle.Group, ¶ms, &jingle.Cart, &jingle.Title); result.err != nil { return } if params[0] != 'J' { @@ -759,10 +757,7 @@ func (d *db) getJingleList(username string) (result getJingleListResult) { } func (d *db) getJingleCutList(jingle JingleListEntry) (result getJingleCutListResult) { - if result.active, result.err = d.getCartInfo(uint(jingle.ActiveCart)); result.err != nil { - return - } - if result.inactive, result.err = d.getCartInfo(uint(jingle.InactiveCart)); result.err != nil { + if result.cart, result.err = d.getCartInfo(uint(jingle.Cart)); result.err != nil { return } return @@ -1065,7 +1060,7 @@ func (d *DB) GetJingleList(username string) (JingleList, error) { return res.jingles, nil } -func (d *DB) GetJingleCutList(jingle JingleListEntry) (CartListEntry, CartListEntry, error) { +func (d *DB) GetJingleCutList(jingle JingleListEntry) (CartListEntry, error) { resCh := make(chan getJingleCutListResult) req := getJingleCutListRequest{} req.jingle = jingle @@ -1073,7 +1068,7 @@ func (d *DB) GetJingleCutList(jingle JingleListEntry) (CartListEntry, CartListEn d.getJingleCutListChan <- req res := <-resCh - return res.active, res.inactive, res.err + return res.cart, res.err } func (d *DB) GetPoolList(username string) (PoolList, error) { -- cgit v0.10.2