Skip to content

Commit 8ad652f

Browse files
committed
sun. api & ui: fix csv export of users
1 parent 38d8cf3 commit 8ad652f

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

sun/sun-api/methods/users.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@ func GetUsersExpired(c *gin.Context) {
252252
limit := c.Query("limit")
253253
hotspotId := c.Query("hotspot")
254254
accountType := c.Query("type")
255+
marketing := c.Query("marketing")
255256
q := c.Query("q")
256257

257258
hotspotIdInt, err := strconv.Atoi(hotspotId)
@@ -265,18 +266,29 @@ func GetUsersExpired(c *gin.Context) {
265266

266267
// users expired
267268
chain := db.Where("hotspot_id in (?) AND valid_until <= NOW()", utils.ExtractHotspotIds(accountId, (accountId == 1), hotspotIdInt))
269+
268270
if len(accountType) > 0 {
269271
chain = chain.Where("account_type = ?", accountType)
270272
}
273+
274+
if len(marketing) > 0 {
275+
chain = chain.Where("marketing_auth = 1")
276+
}
277+
271278
chain.Find(&users).Count(&totalUsers)
272279
chain.Offset(offsets[0]).Limit(offsets[1]).Find(&users)
273280

274281
// users history
275282
chain = db.Where("hotspot_id in (?)", utils.ExtractHotspotIds(accountId, (accountId == 1), hotspotIdInt))
283+
276284
if len(accountType) > 0 {
277285
chain = chain.Where("account_type = ?", accountType)
278286
}
279287

288+
if len(marketing) > 0 {
289+
chain = chain.Where("marketing_auth = 1")
290+
}
291+
280292
if len(q) > 0 {
281293
chain = chain.Where("username LIKE ? OR name LIKE ? OR email LIKE ? OR account_type LIKE ? OR kbps_down LIKE ? OR kbps_up LIKE ? OR max_navigation_time LIKE ? OR max_navigation_traffic LIKE ?", "%"+q+"%", "%"+q+"%", "%"+q+"%", "%"+q+"%", "%"+q+"%", "%"+q+"%", "%"+q+"%", "%"+q+"%")
282294
}

sun/sun-ui/src/components/Users.vue

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -527,15 +527,6 @@ export default {
527527
528528
if (data_export.length < 5000) {
529529
var usersRows = JSON.parse(JSON.stringify(data_export));
530-
for (var r in usersRows) {
531-
// get only email verified users
532-
if (
533-
usersRows[r].account_type == "email" &&
534-
!usersRows[r].email_verified
535-
) {
536-
delete usersRows[r];
537-
}
538-
}
539530
540531
var columns = this.columns.slice();
541532

0 commit comments

Comments
 (0)