Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
feedback-loop
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ai3
tools
feedback-loop
Commits
3d2cd70b
Commit
3d2cd70b
authored
4 years ago
by
ale
Browse files
Options
Downloads
Patches
Plain Diff
Configurable top N in main view
parent
104d37c7
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
README.md
+21
-0
21 additions, 0 deletions
README.md
feedbackloop/views.py
+4
-3
4 additions, 3 deletions
feedbackloop/views.py
with
25 additions
and
3 deletions
README.md
+
21
−
0
View file @
3d2cd70b
...
...
@@ -15,3 +15,24 @@ users (which are often indicative of an account takeover). Details
(i.e. the message body) for mailing list emails are not saved to the
database to save space and effort.
The tool reads emails from an IMAP account, configured via the
`IMAP_SERVER`
,
`IMAP_USERNAME`
and
`IMAP_PASSWORD`
parameters (SSL is
assumed). Emails are deleted from the remote account once the reports
have been successfully saved to the database.
The HTTP server can be started with:
```
feedbackloop server --port=1234
```
There are two cron jobs that need to be run periodically:
```
# Fetch new reports.
feedbackloop ingest
# Expire old records.
feedbackloop expire --days=30
```
This diff is collapsed.
Click to expand it.
feedbackloop/views.py
+
4
−
3
View file @
3d2cd70b
from
flask
import
render_template
,
abort
from
flask
import
request
,
render_template
,
abort
from
sqlalchemy
import
func
,
text
from
.app
import
app
,
db
from
.model
import
FeedbackEntry
...
...
@@ -26,16 +26,17 @@ def by_sender(sender):
@app.route
(
'
/
'
)
def
index
():
n
=
int
(
request
.
args
.
get
(
'
n
'
,
'
20
'
))
top_user_senders
=
db
.
session
.
query
(
FeedbackEntry
.
sender
,
func
.
count
(
FeedbackEntry
.
id
).
label
(
'
count
'
)).
filter
(
FeedbackEntry
.
is_list
==
False
).
group_by
(
FeedbackEntry
.
sender
).
order_by
(
text
(
'
count DESC
'
)).
limit
(
20
)
FeedbackEntry
.
sender
).
order_by
(
text
(
'
count DESC
'
)).
limit
(
n
)
top_list_senders
=
db
.
session
.
query
(
FeedbackEntry
.
sender
,
func
.
count
(
FeedbackEntry
.
id
).
label
(
'
count
'
)).
filter
(
FeedbackEntry
.
is_list
==
True
).
group_by
(
FeedbackEntry
.
sender
).
order_by
(
text
(
'
count DESC
'
)).
limit
(
20
)
FeedbackEntry
.
sender
).
order_by
(
text
(
'
count DESC
'
)).
limit
(
n
)
top_reporters
=
db
.
session
.
query
(
FeedbackEntry
.
reporter
,
func
.
count
(
FeedbackEntry
.
id
).
label
(
'
count
'
)).
group_by
(
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment