try to reduce noise in tests
save bytes
This commit is contained in:
parent
1fe51768f0
commit
95d3f9ebe1
@ -79,7 +79,7 @@ func init() {
|
|||||||
re := "replies"
|
re := "replies"
|
||||||
replyStmts = ReplyStmts{
|
replyStmts = ReplyStmts{
|
||||||
isLiked: acc.Select("likes").Columns("targetItem").Where("sentBy=? and targetItem=? and targetType='replies'").Prepare(),
|
isLiked: acc.Select("likes").Columns("targetItem").Where("sentBy=? and targetItem=? and targetType='replies'").Prepare(),
|
||||||
createLike: acc.Insert("likes").Columns("weight, targetItem, targetType, sentBy").Fields("?,?,?,?").Prepare(),
|
createLike: acc.Insert("likes").Columns("weight,targetItem,targetType,sentBy").Fields("?,?,?,?").Prepare(),
|
||||||
edit: acc.Update(re).Set("content=?,parsed_content=?").Where("rid=? AND poll=0").Prepare(),
|
edit: acc.Update(re).Set("content=?,parsed_content=?").Where("rid=? AND poll=0").Prepare(),
|
||||||
setPoll: acc.Update(re).Set("poll=?").Where("rid=? AND poll=0").Prepare(),
|
setPoll: acc.Update(re).Set("poll=?").Where("rid=? AND poll=0").Prepare(),
|
||||||
delete: acc.Delete(re).Where("rid=?").Prepare(),
|
delete: acc.Delete(re).Where("rid=?").Prepare(),
|
||||||
@ -90,7 +90,7 @@ func init() {
|
|||||||
deleteActivitySubs: acc.Delete("activity_subscriptions").Where("targetID=? AND targetType='post'").Prepare(),
|
deleteActivitySubs: acc.Delete("activity_subscriptions").Where("targetID=? AND targetType='post'").Prepare(),
|
||||||
|
|
||||||
// TODO: Optimise this to avoid firing an update if it's not the last reply in a topic. We will need to set lastReplyID properly in other places and in the patcher first so we can use it here.
|
// TODO: Optimise this to avoid firing an update if it's not the last reply in a topic. We will need to set lastReplyID properly in other places and in the patcher first so we can use it here.
|
||||||
updateTopicReplies: acc.RawPrepare("UPDATE topics t INNER JOIN replies r ON t.tid = r.tid SET t.lastReplyBy = r.createdBy, t.lastReplyAt = r.createdAt, t.lastReplyID = r.rid WHERE t.tid = ?"),
|
updateTopicReplies: acc.RawPrepare("UPDATE topics t INNER JOIN replies r ON t.tid=r.tid SET t.lastReplyBy=r.createdBy, t.lastReplyAt=r.createdAt, t.lastReplyID=r.rid WHERE t.tid=?"),
|
||||||
updateTopicReplies2: acc.Update("topics").Set("lastReplyAt=createdAt,lastReplyBy=createdBy,lastReplyID=0").Where("postCount=1 AND tid=?").Prepare(),
|
updateTopicReplies2: acc.Update("topics").Set("lastReplyAt=createdAt,lastReplyBy=createdBy,lastReplyID=0").Where("postCount=1 AND tid=?").Prepare(),
|
||||||
|
|
||||||
getAidsOfReply: acc.Select("attachments").Columns("attachID").Where("originID=? AND originTable='replies'").Prepare(),
|
getAidsOfReply: acc.Select("attachments").Columns("attachID").Where("originID=? AND originTable='replies'").Prepare(),
|
||||||
|
@ -66,7 +66,7 @@ func NewDefaultTopicList(acc *qgen.Accumulator) (*DefaultTopicList, error) {
|
|||||||
forums: make(map[int]*ForumTopicListHolder),
|
forums: make(map[int]*ForumTopicListHolder),
|
||||||
qcounts: make(map[int]*sql.Stmt),
|
qcounts: make(map[int]*sql.Stmt),
|
||||||
qcounts2: make(map[int]*sql.Stmt),
|
qcounts2: make(map[int]*sql.Stmt),
|
||||||
getTopicsByForum: acc.Select("topics").Columns("tid, title, content, createdBy, is_closed, sticky, createdAt, lastReplyAt, lastReplyBy, lastReplyID, views, postCount, likeCount").Where("parentID=?").Orderby("sticky DESC,lastReplyAt DESC,createdBy DESC").Limit("?,?").Prepare(),
|
getTopicsByForum: acc.Select("topics").Columns("tid,title,content,createdBy,is_closed,sticky,createdAt,lastReplyAt,lastReplyBy,lastReplyID,views,postCount,likeCount").Where("parentID=?").Orderby("sticky DESC,lastReplyAt DESC,createdBy DESC").Limit("?,?").Prepare(),
|
||||||
//getTidsByForum: acc.Select("topics").Columns("tid").Where("parentID=?").Orderby("sticky DESC,lastReplyAt DESC,createdBy DESC").Limit("?,?").Prepare(),
|
//getTidsByForum: acc.Select("topics").Columns("tid").Where("parentID=?").Orderby("sticky DESC,lastReplyAt DESC,createdBy DESC").Limit("?,?").Prepare(),
|
||||||
}
|
}
|
||||||
if err := acc.FirstError(); err != nil {
|
if err := acc.FirstError(); err != nil {
|
||||||
|
@ -73,7 +73,7 @@ func _markdownParse(msg string, n int) string {
|
|||||||
var outbytes []byte
|
var outbytes []byte
|
||||||
var lastElement int
|
var lastElement int
|
||||||
breaking := false
|
breaking := false
|
||||||
c.DebugLogf("Initial Message: %+v\n", strings.Replace(msg, "\r", "\\r", -1))
|
//c.DebugLogf("Initial Message: %+v\n", strings.Replace(msg, "\r", "\\r", -1))
|
||||||
|
|
||||||
for index := 0; index < len(msg); index++ {
|
for index := 0; index < len(msg); index++ {
|
||||||
simpleMatch := func(char byte, o []byte, c []byte) {
|
simpleMatch := func(char byte, o []byte, c []byte) {
|
||||||
|
@ -21,7 +21,7 @@ type MEPairList struct {
|
|||||||
Items []MEPair
|
Items []MEPair
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *MEPairList) Add(msg string, expects string) {
|
func (l *MEPairList) Add(msg, expects string) {
|
||||||
l.Items = append(l.Items, MEPair{msg, expects})
|
l.Items = append(l.Items, MEPair{msg, expects})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user