Skip to content

Commit

Permalink
Merge pull request #99 from bitovi/96-localstorage
Browse files Browse the repository at this point in the history
Release filters
  • Loading branch information
justinbmeyer authored Aug 22, 2024
2 parents 81d91b2 + 8c06b5f commit 63f60f1
Show file tree
Hide file tree
Showing 10 changed files with 125 additions and 29 deletions.
2 changes: 1 addition & 1 deletion public/dist/connect-main.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/dist/connect-main.min.js.map

Large diffs are not rendered by default.

70 changes: 59 additions & 11 deletions public/dist/hosted-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -57351,9 +57351,6 @@ function copyDateProperties(obj) {


function mergeParentAndChildIfTheyHaveDates(parentIssueOrRelease, childRollups){
if(parentIssueOrRelease.type === "milestone") {
debugger;
}
const rollup = {self: {}, children: {}, combined: {}};
const parentData = parentIssueOrRelease?.derivedTiming;

Expand Down Expand Up @@ -57697,6 +57694,32 @@ function average(arr){
return arr.length > 0 ? sum(arr) / arr.length : undefined;
}

/**
*
* @param {Array<import("../rollup").IssuesOrReleases>} issuesOrReleases Starting from low to high
* @param {Array<String>} methodNames Starting from low to high
* @return {Array<RollupDateData>}
*/
function rollupChildStatusesForGroupedHierarchy(groupedHierarchy) {
return rollupGroupedHierarchy(groupedHierarchy, {
createRollupDataFromParentAndChild({key, status}, children){
return {
self: {key, status},
children: children.map( child => child.self )
};
}
});
}

// these functions shouldn't be used eventually for performance ...
function rollupChildStatuses(issuesOrReleases, rollupTimingLevelsAndCalculations){
const groupedIssues = groupIssuesByHierarchyLevelOrType(issuesOrReleases, rollupTimingLevelsAndCalculations);
const rolledUpBlockers = rollupChildStatusesForGroupedHierarchy(groupedIssues);

const zipped = zipRollupDataOntoGroupedData(groupedIssues, rolledUpBlockers, "childStatuses");
return zipped.flat();
}

/**
* @typedef {import("../rolledup/work-type/work-type").WorkTypeTimingReleaseOrIssue & {issue: import("../raw/rollback/rollback").RolledBackJiraIssue}} RolledBackWorkTypeTimingReleaseOrIssue
*/
Expand Down Expand Up @@ -57740,7 +57763,8 @@ function addRollups(derivedIssues, rollupTimingLevelsAndCalculations) {
const rolledUpDates = addRollupDates(reporting, rollupTimingLevelsAndCalculations);
const rolledUpBlockers= rollupBlockedStatusIssues(rolledUpDates, rollupTimingLevelsAndCalculations);
const percentComplete = addPercentComplete(rolledUpBlockers, rollupTimingLevelsAndCalculations);
return addWorkTypeDates(percentComplete, rollupTimingLevelsAndCalculations);
const childStatuses = rollupChildStatuses(percentComplete, rollupTimingLevelsAndCalculations);
return addWorkTypeDates(childStatuses, rollupTimingLevelsAndCalculations);

}

Expand Down Expand Up @@ -58271,6 +58295,7 @@ class TimelineReport extends canStacheElement {
const hideUnknownInitiatives = this.hideUnknownInitiatives;
let statusesToRemove = this.statusesToRemove;
let statusesToShow = this.statusesToShow;

function startBeforeDue(initiative) {
return initiative.rollupStatuses.rollup.start < initiative.rollupStatuses.rollup.due;
}
Expand All @@ -58283,22 +58308,45 @@ class TimelineReport extends canStacheElement {
this.planningStatuses.includes(issueOrRelease.status) ) {
return false;
}
if(this.showOnlySemverReleases && this.primaryIssueType === "Release" && !issueOrRelease.names.semver) {
return false;
}

if(hideUnknownInitiatives && !startBeforeDue(issueOrRelease)) {
return false;
}
if(statusesToShow && statusesToShow.length) {
if(!statusesToShow.includes(issueOrRelease.status)) {
return false;
if(this.primaryIssueType === "Release") {
// releases don't have statuses, so we look at their children
if(statusesToRemove && statusesToRemove.length) {
if( issueOrRelease.childStatuses.children.every( ({status}) => statusesToRemove.includes(status) ) ) {
return false;
}
}
}
if(statusesToRemove && statusesToRemove.length) {
if(statusesToRemove.includes(issueOrRelease.status)) {
return false;

if(statusesToShow && statusesToShow.length) {
// Keep if any valeue has a status to show
if( !issueOrRelease.childStatuses.children.some( ({status}) => statusesToShow.includes(status) ) ) {
return false;
}
}

} else {
if(statusesToShow && statusesToShow.length) {
if(!statusesToShow.includes(issueOrRelease.status)) {
return false;
}
}
if(statusesToRemove && statusesToRemove.length) {
if(statusesToRemove.includes(issueOrRelease.status)) {
return false;
}
}
}


return true;
});

if(this.sortByDueDate) {
return filtered.toSorted( (i1, i2) => i1.rollupStatuses.rollup.due - i2.rollupStatuses.rollup.due);
} else {
Expand Down
2 changes: 1 addition & 1 deletion public/dist/hosted-main.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/dist/hosted-main.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/dist/hosted-main.min.js.map

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions public/jira/rolledup-and-rolledback/rollup-and-rollback.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { deriveReleases } from "../releases/derive";
import { normalizeReleases } from "../releases/normalize";
import { percentComplete as rollupPercentComplete, addPercentComplete } from "../rollup/percent-complete/percent-complete";
import { addReportingHierarchy } from "../rollup/rollup";
import { rollupChildStatuses } from "../rollup/child-statuses/child-statuses";

/**
* @typedef {import("../rolledup/work-type/work-type").WorkTypeTimingReleaseOrIssue & {issue: import("../raw/rollback/rollback").RolledBackJiraIssue}} RolledBackWorkTypeTimingReleaseOrIssue
Expand Down Expand Up @@ -51,8 +52,9 @@ function addRollups(derivedIssues, rollupTimingLevelsAndCalculations) {
const reporting = addReportingHierarchy([...releases,...derivedIssues], rollupTimingLevelsAndCalculations);
const rolledUpDates = addRollupDates(reporting, rollupTimingLevelsAndCalculations);
const rolledUpBlockers= rollupBlockedStatusIssues(rolledUpDates, rollupTimingLevelsAndCalculations);
const percentComplete = addPercentComplete(rolledUpBlockers, rollupTimingLevelsAndCalculations)
return addWorkTypeDates(percentComplete, rollupTimingLevelsAndCalculations);
const percentComplete = addPercentComplete(rolledUpBlockers, rollupTimingLevelsAndCalculations);
const childStatuses = rollupChildStatuses(percentComplete, rollupTimingLevelsAndCalculations);
return addWorkTypeDates(childStatuses, rollupTimingLevelsAndCalculations);

}

Expand Down
3 changes: 0 additions & 3 deletions public/jira/rolledup/work-type/work-type.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,6 @@ function copyDateProperties(obj) {


export function mergeParentAndChildIfTheyHaveDates(parentIssueOrRelease, childRollups){
if(parentIssueOrRelease.type === "milestone") {
debugger;
}
const rollup = {self: {}, children: {}, combined: {}};
const parentData = parentIssueOrRelease?.derivedTiming;

Expand Down
26 changes: 26 additions & 0 deletions public/jira/rollup/child-statuses/child-statuses.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { rollupGroupedHierarchy, groupIssuesByHierarchyLevelOrType, zipRollupDataOntoGroupedData } from "../rollup";
/**
*
* @param {Array<import("../rollup").IssuesOrReleases>} issuesOrReleases Starting from low to high
* @param {Array<String>} methodNames Starting from low to high
* @return {Array<RollupDateData>}
*/
export function rollupChildStatusesForGroupedHierarchy(groupedHierarchy) {
return rollupGroupedHierarchy(groupedHierarchy, {
createRollupDataFromParentAndChild({key, status}, children){
return {
self: {key, status},
children: children.map( child => child.self )
};
}
});
}

// these functions shouldn't be used eventually for performance ...
export function rollupChildStatuses(issuesOrReleases, rollupTimingLevelsAndCalculations){
const groupedIssues = groupIssuesByHierarchyLevelOrType(issuesOrReleases, rollupTimingLevelsAndCalculations);
const rolledUpBlockers = rollupChildStatusesForGroupedHierarchy(groupedIssues);

const zipped = zipRollupDataOntoGroupedData(groupedIssues, rolledUpBlockers, "childStatuses");
return zipped.flat();
}
39 changes: 31 additions & 8 deletions public/timeline-report.js
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@ export class TimelineReport extends StacheElement {
const hideUnknownInitiatives = this.hideUnknownInitiatives;
let statusesToRemove = this.statusesToRemove;
let statusesToShow = this.statusesToShow;

function startBeforeDue(initiative) {
return initiative.rollupStatuses.rollup.start < initiative.rollupStatuses.rollup.due;
}
Expand All @@ -410,23 +411,45 @@ export class TimelineReport extends StacheElement {
this.planningStatuses.includes(issueOrRelease.status) ) {
return false;
}
if(this.showOnlySemverReleases && this.primaryIssueType === "Release" && !issueOrRelease.names.semver) {
return false;
}

if(hideUnknownInitiatives && !startBeforeDue(issueOrRelease)) {
return false;
}
if(statusesToShow && statusesToShow.length) {
if(!statusesToShow.includes(issueOrRelease.status)) {
return false;
if(this.primaryIssueType === "Release") {
// releases don't have statuses, so we look at their children
if(statusesToRemove && statusesToRemove.length) {
if( issueOrRelease.childStatuses.children.every( ({status}) => statusesToRemove.includes(status) ) ) {
return false;
}
}
}
if(statusesToRemove && statusesToRemove.length) {
if(statusesToRemove.includes(issueOrRelease.status)) {
return false;

if(statusesToShow && statusesToShow.length) {
// Keep if any valeue has a status to show
if( !issueOrRelease.childStatuses.children.some( ({status}) => statusesToShow.includes(status) ) ) {
return false;
}
}

} else {
if(statusesToShow && statusesToShow.length) {
if(!statusesToShow.includes(issueOrRelease.status)) {
return false;
}
}
if(statusesToRemove && statusesToRemove.length) {
if(statusesToRemove.includes(issueOrRelease.status)) {
return false;
}
}
}


return true;
});
let sorted;

if(this.sortByDueDate) {
return filtered.toSorted( (i1, i2) => i1.rollupStatuses.rollup.due - i2.rollupStatuses.rollup.due);
} else {
Expand Down

0 comments on commit 63f60f1

Please sign in to comment.