Skip to content
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

Add paging for apps #1

Merged
merged 3 commits into from
Jun 3, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions builds.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const utils = require('./utils')
const fetch = require('node-fetch');

function getApps(all_apps, api_key, callback) {
return fetch(utils.BASE_URL, utils.getHeaders(api_key))
function getApps(all_apps, api_key, next, callback) {
return fetch(utils.BASE_URL + (next ? '?next=' + next : ''), utils.getHeaders(api_key))
.then(res => res.json())
.then((apps) => {
apps.data.forEach((app)=>{
Expand Down Expand Up @@ -42,7 +42,7 @@ function getBuilds(api_key, all_builds, from, to, appSlug, next, callback) {
module.exports = {
getAllData: (appSlugsFilter, api_key, from, to, callback) => {
let all_apps = {};
getApps(all_apps, api_key, (apps) => {
getApps(all_apps, api_key, null, (apps) => {
let appSlugs = Object.keys(apps);
let complete = 0;
appSlugs.forEach((appSlug)=>{
Expand Down Expand Up @@ -178,6 +178,11 @@ module.exports = {
let status = build.status_text;
let slug = build.slug;

// Group Everything except master && develop into other group
// if (branch != 'master' && branch != 'develop') {
// branch = 'other';
// }

let key = appSlug + '_' + workflow + '_' + branch + '_' + stack + '_' + status;
if (!stats[key]) {
stats[key] = {};
Expand Down Expand Up @@ -341,4 +346,4 @@ module.exports = {
})
return timeseries_data;
}
}
}