Skip to content

Commit

Permalink
Fix date parsing bug introduced by GitLab changes in comment syntax
Browse files Browse the repository at this point in the history
Also removed blinking survey tab as it's not survey time.
  • Loading branch information
Lilyheart committed Oct 13, 2021
1 parent d61e536 commit 39a6020
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 15 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ Not current accepting pull requests.

## History

### [[0.3.2]](https://github.com/Lilyheart/agile-gitlabce/releases/tag/v0.3.2) - 2021-10-13
Updated burndown date calculation to match GitLab changes
Hid Survey.

### [[0.3.1]](https://github.com/Lilyheart/agile-gitlabce/releases/tag/v0.3.1) - 2020-04-23
Added OpenGraph attributes.
Hid Survey.
Expand Down
6 changes: 3 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ <h4 class="d-inline-flex">Warnings</h4>
<div class="tab-pane fade show active" id="faqtab" role="tabpanel" aria-labelledby="faq-tab">
<div id="faqtab-html">
<script>
$("#faqtab-html").load("partials/faqtab.html?ver=0.2.8b");
$("#faqtab-html").load("partials/faqtab.html?ver=0.3.2");
</script>
</div>
</div>
Expand Down Expand Up @@ -431,10 +431,10 @@ <h4 class="d-inline-flex">Warnings</h4>
<!-- Local -->
<script type="text/javascript" src="libraries/selectize.min.js?ver=v0.12.6"></script>
<script type="text/javascript" src="libraries/defiant.min.js?ver=v2.2.6"></script>
<script type="text/javascript" src="scripts/survey.js?ver=0.2.8"></script>
<script type="text/javascript" src="scripts/survey.js?ver=0.3.2"></script>
<script type="text/javascript" src="scripts/projects.js?ver=0.2.8"></script>
<script type="text/javascript" src="scripts/issues.js?ver=0.3.1"></script>
<script type="text/javascript" src="scripts/burndown.js?ver=0.3.1"></script>
<script type="text/javascript" src="scripts/burndown.js?ver=0.3.2"></script>
<script type="text/javascript" src="scripts/release.js?ver=0.3.1"></script>
<script type="text/javascript" src="scripts/hours.js?ver=0.3.1"></script>
<script type="text/javascript" src="gitlab_servers.js?ver=0.2.8"></script>
Expand Down
8 changes: 4 additions & 4 deletions partials/faqtab.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ <h3>New</h3>
<p>
<ul>
<!-- <li class="new">2020/MM/DD <strong><u><a href="https://github.com/Lilyheart/agile-gitlabce/releases/tag/vX.X.X">vX.X.X</a></u></strong>: XXXXXX <span class="badge badge-primary">New</span></li> -->
<li>2020/04/23 <strong><u><a href="https://github.com/Lilyheart/agile-gitlabce/releases/tag/v0.3.1">v0.3.1</a></u></strong>: Minor Bug fixes and removed uncalculated columns from the hours table.<span class="badge badge-primary">New</span></li>
<li class="new">2020/02/20 <strong><u><a href="https://github.com/Lilyheart/agile-gitlabce/releases/tag/v0.3.0">v0.3.0</a></u></strong>: Now in Beta!!! View a burndown chart of specific sprints <strong>[Release Tab]</strong>. If you have any issues with it, find me or use the Send Feedback link above.</li>
<li class="new pb-3">2021/10/13 <strong><u><a href="https://github.com/Lilyheart/agile-gitlabce/releases/tag/v0.3.2">v0.3.2</a></u></strong>: Bug affecting calculating date to apply spent change has been fixed. This is in result to a GitLab change in how spent time comments are published.<span class="badge badge-primary">New</span></li>
<li class="">2020/02/20 <strong><u><a href="https://github.com/Lilyheart/agile-gitlabce/releases/tag/v0.3.0">v0.3.0</a></u></strong>: Now in Beta!!! View a burndown chart of specific sprints <strong>[Release Tab]</strong>. If you have any issues with it, find me or use the Send Feedback link above.</li>
<!-- <li>2019/12/07 <strong><u><a href="https://github.com/Lilyheart/agile-gitlabce/releases/tag/v0.2.8">v0.2.8</a></u></strong>: Survey
<p>I know we might be tired of feedback surveys, but I would appreciate it if you could take the time to complete the survey on the tab that will load once you are logged into your Gitlab from this page.</p>
</li> -->
Expand Down Expand Up @@ -358,7 +358,7 @@ <h4>Consistent Features</h4>
</div>
</div>

<div class="card">
<!-- <div class="card">
<div class="card-header" id="faq-future">
<button class="btn btn-link collapsed" type="button" data-toggle="collapse" data-target="#collapse-future" aria-expanded="false" aria-controls="collapse-future">
Future Plans
Expand All @@ -372,7 +372,7 @@ <h4>Consistent Features</h4>
</p>
</div>
</div>
</div>
</div> -->

<!-- <div class="card">
<div class="card-header" id="faq-X">
Expand Down
31 changes: 25 additions & 6 deletions scripts/burndown.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,15 +246,16 @@ var burndown = (function () {
}

function parseNotes() {
let noteableIID, addSubRE, matchAddSub, tempSpentTimeList, spent,
estimateRE, matchEst, tempEstTimeList, estimate,
date, timeParts, timePart, dupDate;
let noteableIID, addSubREimplicit, addSubREexplicit, matchAddSub,
tempSpentTimeList, spent, estimateRE, matchEst, tempEstTimeList,
estimate, date, timeParts, timePart, dupDate;
// let matchAddSub;

// Go through notes to get changes in spend & estimates
noteableIID = "Empty Note";

addSubRE = /(added|subtracted) (.*) of time spent at (.*)-(.*)-(.*)/;
addSubREimplicit = /(added|subtracted) (.*) of time spent/;
addSubREexplicit = /(added|subtracted) (.*) of time spent at (.*)-(.*)-(.*)/;
spentTimeList = [];
tempSpentTimeList = [];

Expand All @@ -274,12 +275,30 @@ var burndown = (function () {

// ******************************* SPENDS *******************************

matchAddSub = note.body.match(addSubRE);
matchAddSub = note.body.match(addSubREimplicit);

// If time spent was added or subtracted
spent = 0;
if (matchAddSub !== null) {
date = Date.UTC(parseInt(matchAddSub[3], 10), parseInt(matchAddSub[4], 10) - 1, parseInt(matchAddSub[5], 10));
// Determine date
if (note.body.match(addSubREexplicit) !== null) {
matchAddSub = note.body.match(addSubREexplicit);

matchAddSub[3] = parseInt(matchAddSub[3], 10);
matchAddSub[4] = parseInt(matchAddSub[4], 10);
matchAddSub[5] = parseInt(matchAddSub[5], 10);
} else {
date = new Date(note.created_at);

matchAddSub[3] = date.getFullYear();
matchAddSub[4] = date.getMonth() + 1;
matchAddSub[5] = date.getDate();
}

date = Date.UTC(parseInt(matchAddSub[3], 10),
parseInt(matchAddSub[4], 10) - 1,
parseInt(matchAddSub[5], 10));

timeParts = matchAddSub[2].split(" ");
for (let timesIndex in timeParts) {
if (timeParts.hasOwnProperty(timesIndex)) {
Expand Down
4 changes: 2 additions & 2 deletions scripts/survey.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ var survey = (function () {
return;
}

document.getElementById("survey-tab-item").classList.remove("d-none");
// document.getElementById("survey-tab-item").classList.remove("d-none");

Survey.StylesManager.applyTheme("bootstrap");

Expand All @@ -31,7 +31,7 @@ var survey = (function () {
};
$.post(url, data, function(rData, status) {});

document.getElementById("survey-tab-item").classList.add("d-none");
// document.getElementById("survey-tab-item").classList.add("d-none");
}

$("#surveyContainer").Survey({
Expand Down

0 comments on commit 39a6020

Please sign in to comment.