Skip to content

CV3-85 Add device downtime to report data #518

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

raymond42
Copy link
Collaborator

@raymond42 raymond42 commented Dec 13, 2019

Description

When the analytics report data are retrieved, it should also include the downtime of the device i.e the time the device has been not used.

Type of change

Please select the relevant option

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Others (cosmetics, styling, improvements)
  • This change requires a documentation update

How Has This Been Tested?

  • Unit
  • Integration
  • End-to-end

How to Test

  • Check the code climate report to see if any file from the fixtures folder violates the file-line-limit
  • Follow the instructions on the readme.md file on running tests. Check to see if tests run successfully

Checklist

  • My changes generate no new warnings
  • My code follows the style guidelines of this project
  • I have linted my code prior to submission
  • Existing unit tests pass locally with my changes
  • Implementation works according to expectations

How to Test

  • URL: http://localhost:8000/mrm
  • HTTP: POST
  • In the query of getting all analytics, you should also include the device analytics that has deviceName, deviceId, and downTime as shown in an example below
query{
  allAnalytics(startDate: "jul 11 2018", endDate: "jul 12 2018", locationId: 1) {
    checkinsPercentage
    appBookingsPercentage
    autoCancellationsPercentage
    cancellationsPercentage
    bookings
    analytics {
      roomName
      cancellations
      cancellationsPercentage
      autoCancellations
      numberOfBookings
      checkins
      checkinsPercentage
      bookingsPercentageShare
      appBookings
      appBookingsPercentage
      events {
        durationInMinutes
      }
    }
    bookingsCount {
      totalBookings
      period
    }
    deviceAnalytics {
      deviceName
      deviceId
      downTime
    }
  }
}

  • Expected response
{
  "data": {
    "allAnalytics": {
      "checkinsPercentage": 0.0,
      "appBookingsPercentage": 0.0,
      "autoCancellationsPercentage": 0.0,
      "cancellationsPercentage": 0.0,
      "bookings": 13,
      "analytics": [
        {
          "roomName": "Kampala",
          "cancellations": 0,
          "cancellationsPercentage": 0.0,
          "autoCancellations": 0,
          "numberOfBookings": 0,
          "checkins": 0,
          "checkinsPercentage": 0.0,
          "bookingsPercentageShare": 0.0,
          "appBookings": 0,
          "appBookingsPercentage": 0.0,
          "events": [
            {
              "durationInMinutes": 0
            }
          ]
        }
      ],
      "bookingsCount": [
        {
          "totalBookings": 7,
          "period": "Jul 11 2018"
        },
        {
          "totalBookings": 6,
          "period": "Jul 12 2018"
        }
      ],
      "deviceAnalytics": [
        {
          "deviceName": "Apple tablet",
          "deviceId": 1,
          "downTime": "this device was seen 3 days, 23 hours, 13 minutes ago."
        },
        {
          "deviceName": "Samsung Flat screen",
          "deviceId": 2,
          "downTime": "this device was seen 8 months, 7 days, 2 hours, 44 minutes ago."
        }
      ]
    }
  }
}

JIRA

CV3-85

@raymond42 raymond42 force-pushed the story/CV3-85-add-device-uptime-downtime branch 3 times, most recently from f90fb91 to cbe26d5 Compare December 16, 2019 10:25
@raymond42 raymond42 added the wip label Dec 16, 2019
@raymond42 raymond42 force-pushed the story/CV3-85-add-device-uptime-downtime branch 5 times, most recently from 7341118 to 8f9a314 Compare December 16, 2019 18:58
@raymond42 raymond42 added peer review and removed wip labels Dec 17, 2019
@raymond42 raymond42 requested review from MCFrank16 and removed request for Ramadhan0 and MCFrank16 December 17, 2019 09:28
@adafia
Copy link
Contributor

adafia commented Dec 17, 2019

Please update the "How to test" section of your PR.
Also, indent the body of your commit message.

bookings = AllAnalyticsHelper.count_bookings_within_period(events, date_pattern, string_date) # noqa
bookings = AllAnalyticsHelper.count_bookings_within_period(
events, date_pattern, string_date
) # noqa
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need the "# noqa" at the end of this line.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Thank you for the feedback @adafia

Copy link
Contributor

@adafia adafia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job @raymond42, it looks good. Just attend to the comments I made and revert back to me.

@raymond42 raymond42 force-pushed the story/CV3-85-add-device-uptime-downtime branch from 8f9a314 to 8b6b93a Compare December 17, 2019 15:26
@raymond42
Copy link
Collaborator Author

raymond42 commented Dec 17, 2019

Please update the "How to test" section of your PR.
Also, indent the body of your commit message.

Oh yes. Done. Thank you @adafia

Copy link
Collaborator Author

@raymond42 raymond42 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job @raymond42, it looks good. Just attend to the comments I made and revert back to me.

Thank you @adafia. All done

@raymond42 raymond42 removed the request for review from mifeille December 18, 2019 07:22
@raymond42 raymond42 force-pushed the story/CV3-85-add-device-uptime-downtime branch 2 times, most recently from d95e13e to 047a21d Compare December 19, 2019 12:19
- add helper function for getting devices analytics
- add helper function for calculating downtime and convert it to human readable date time
- add query that retrieves the devices analytics including downtime of the devices

[Delivers CV3-85]
@raymond42 raymond42 force-pushed the story/CV3-85-add-device-uptime-downtime branch from 047a21d to 0965a68 Compare December 19, 2019 12:34
Copy link
Contributor

@shaluchandwani shaluchandwani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work on the PR @raymond42. It looks fine to me.

@raymond42 raymond42 added TTL Review Technical Team Lead Review and removed peer review labels Dec 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
TTL Review Technical Team Lead Review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants