stats-import: It's fine, make the module 'whole' again

This commit is contained in:
Hamcha 2016-02-14 10:44:00 +01:00
parent e2e2e5aae0
commit bf7f2b6b55

View file

@ -7,7 +7,9 @@ import (
"flag" "flag"
"log" "log"
"os" "os"
"strconv"
"strings" "strings"
"time"
"github.com/boltdb/bolt" "github.com/boltdb/bolt"
) )
@ -87,7 +89,6 @@ func main() {
} }
func processMessage(msg Message, data *Stats) { func processMessage(msg Message, data *Stats) {
/*
data.Total++ data.Total++
if msg.ReplyID != nil { if msg.ReplyID != nil {
@ -117,7 +118,7 @@ func processMessage(msg Message, data *Stats) {
data.ByDate[datekey] = val + 1 data.ByDate[datekey] = val + 1
data.Username[msg.From.Username] = msg.From.FirstName data.Username[msg.From.Username] = msg.From.FirstName
*/
if len(msg.Text) > 2 { if len(msg.Text) > 2 {
wordList := strings.Split(msg.Text, " ") wordList := strings.Split(msg.Text, " ")
for _, word := range wordList { for _, word := range wordList {
@ -169,7 +170,6 @@ func PutUint(value uint64) []byte {
func update(db *bolt.DB, data Stats) error { func update(db *bolt.DB, data Stats) error {
return db.Update(func(tx *bolt.Tx) error { return db.Update(func(tx *bolt.Tx) error {
/*
b, err := tx.CreateBucketIfNotExists([]byte("global")) b, err := tx.CreateBucketIfNotExists([]byte("global"))
if err != nil { if err != nil {
return err return err
@ -279,9 +279,9 @@ func update(db *bolt.DB, data Stats) error {
} }
} }
} }
*/
// Add word frequency // Add word frequency
b, err := tx.CreateBucketIfNotExists([]byte("words")) b, err = tx.CreateBucketIfNotExists([]byte("words"))
if err != nil { if err != nil {
return err return err
} }