mirror of https://github.com/velour/catbase.git
Compare commits
No commits in common. "09cc6f75c34648b197034399c4ec81ed7cc9edcf" and "b1cec209fe151292bf69e0833e6fbee12979c223" have entirely different histories.
09cc6f75c3
...
b1cec209fe
|
@ -207,12 +207,12 @@ func InvertEmojyList(emojy map[string]string) map[string]string {
|
|||
return out
|
||||
}
|
||||
|
||||
func (p *EmojyPlugin) allCounts(threshold int) (map[string][]EmojyCount, error) {
|
||||
func (p *EmojyPlugin) allCounts() (map[string][]EmojyCount, error) {
|
||||
out := map[string][]EmojyCount{}
|
||||
onServerList := InvertEmojyList(p.b.GetEmojiList(true))
|
||||
q := `select emojy, count(observed) as count from emojyLog group by emojy having count(observed) > ? order by count desc`
|
||||
q := `select emojy, count(observed) as count from emojyLog group by emojy order by count desc`
|
||||
result := []EmojyCount{}
|
||||
err := p.db.Select(&result, q, threshold)
|
||||
err := p.db.Select(&result, q)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
@ -43,9 +43,10 @@
|
|||
{{ err }}
|
||||
</div>
|
||||
|
||||
<ul style="list-style-type: none;">
|
||||
<li v-for="category in results">
|
||||
<ul v-if="category" style="list-style-type: none;">
|
||||
<ul>
|
||||
<li v-for="(category, name) in results" key="name">
|
||||
{{name}}:
|
||||
<ul>
|
||||
<li v-for="emojy in category" key="emojy">
|
||||
{{emojy.count}} -
|
||||
<span v-if="name != 'emoji'">
|
||||
|
@ -95,7 +96,7 @@
|
|||
refresh: function () {
|
||||
axios.get('/emojy/all')
|
||||
.then(resp => {
|
||||
this.results = [resp.data["emojy"], resp.data["unknown"], resp.data["emoji"]]
|
||||
this.results = resp.data
|
||||
this.err = ''
|
||||
})
|
||||
.catch(err => (this.err = err))
|
||||
|
|
|
@ -44,8 +44,7 @@ func (p *EmojyPlugin) handlePage(file string) func(w http.ResponseWriter, r *htt
|
|||
}
|
||||
|
||||
func (p *EmojyPlugin) handleAll(w http.ResponseWriter, r *http.Request) {
|
||||
threshold := p.c.GetInt("emojy.statthreshold", 1)
|
||||
emojy, err := p.allCounts(threshold)
|
||||
emojy, err := p.allCounts()
|
||||
if err != nil {
|
||||
w.WriteHeader(500)
|
||||
log.Error().Err(err).Msgf("handleAll")
|
||||
|
|
Loading…
Reference in New Issue