fossasia / susi_server

SUSI.AI server backend - the Artificial Intelligence server for personal assistants https://susi.ai
GNU Lesser General Public License v2.1
2.51k stars 1.08k forks source link

Add Data over time for charts in ListSkillService #1317 #1318

Closed fragm3 closed 5 years ago

fragm3 commented 5 years ago

Fixes #1317

Changes:

fragm3 commented 5 years ago

For API: http://127.0.0.1:4000/aaa/getUsers.json?access_token=ljpJ0is16JxiHCuKUq6kitfO0hpCqg&getUserStats=true

Getting response:

{
  "accepted": true,
  "lastLoginTime": {
    "count": 1,
    "timestamp": "Wed, 17 Jul 2019 18:52:19 +0000"
  },
  "signupTime": {
    "count": 1,
    "timestamp": "Wed, 17 Jul 2019 17:09:37 +0000"
  },
  "userStats": {
    "anonymous": 0,
    "users": 7,
    "reviewers": 0,
    "operators": 0,
    "admins": 0,
    "superAdmins": 1,
    "activeUsers": 8,
    "inactiveUsers": 0,
    "totalUsers": 8
  },
  "message": "Success: Fetched all users stats!",
  "session": {"identity": {
    "type": "host",
    "name": "127.0.0.1_ba69b956",
    "anonymous": true
  }}
}

Old response:

{
  "accepted": true,
  "userStats": {
    "anonymous": 0,
    "users": 7,
    "reviewers": 0,
    "operators": 0,
    "admins": 0,
    "superAdmins": 1,
    "activeUsers": 8,
    "inactiveUsers": 0,
    "totalUsers": 8
  },
  "message": "Success: Fetched all users stats!",
  "session": {"identity": {
    "type": "host",
    "name": "127.0.0.1_ba69b956",
    "anonymous": true
  }}
}
fragm3 commented 5 years ago

@akshatnitd @Orbiter, please review

fragm3 commented 5 years ago

@akshatnitd I have updated my comment. About the skill data over time- I have to test it on real data to be sure, it works. If it requires changes, I'll create a new PR.

fragm3 commented 5 years ago

@akshatnitd yup, correct. Made the changes, updated response:

{
  "accepted": true,
  "lastLoginOverTime": [{
    "timeStamp": "Jul 2019",
    "count": 5
  }],
  "signupOverTime": [{
    "timeStamp": "Jul 2019",
    "count": 9
  }],
  "userStats": {
    "anonymous": 0,
    "users": 10,
    "reviewers": 0,
    "operators": 0,
    "admins": 0,
    "superAdmins": 1,
    "activeUsers": 11,
    "inactiveUsers": 0,
    "totalUsers": 11
  },
  "message": "Success: Fetched all users stats!",
  "session": {"identity": {
    "type": "email",
    "name": "shubh12345am@gmail.com",
    "anonymous": false
  }}
}
fragm3 commented 5 years ago

@akshatnitd fixed