| 245 | } |
| 246 | |
| 247 | func (mod *RestAPI) getEvents(limit int) []session.Event { |
| 248 | events := make([]session.Event, 0) |
| 249 | for _, e := range mod.Session.Events.Sorted() { |
| 250 | if mod.Session.EventsIgnoreList.Ignored(e) == false { |
| 251 | events = append(events, e) |
| 252 | } |
| 253 | } |
| 254 | |
| 255 | nevents := len(events) |
| 256 | nmax := nevents |
| 257 | n := nmax |
| 258 | |
| 259 | if limit > 0 && limit < nmax { |
| 260 | n = limit |
| 261 | } |
| 262 | |
| 263 | return events[nevents-n:] |
| 264 | } |
| 265 | |
| 266 | func (mod *RestAPI) showEvents(w http.ResponseWriter, r *http.Request) { |
| 267 | q := r.URL.Query() |