Extend statistics over the whole time range (#1626)
This commit is contained in:
parent
c3a821c32a
commit
e04c723de5
|
@ -23,6 +23,7 @@
|
||||||
<option value="week" data-i18n-content="labelPastWeek">Past week</option>
|
<option value="week" data-i18n-content="labelPastWeek">Past week</option>
|
||||||
<option value="month" data-i18n-content="labelPastMonth">Past month</option>
|
<option value="month" data-i18n-content="labelPastMonth">Past month</option>
|
||||||
<option value="year" data-i18n-content="labelPastYear">Past year</option>
|
<option value="year" data-i18n-content="labelPastYear">Past year</option>
|
||||||
|
<option value="all" data-i18n-content="labelAll">All</option>
|
||||||
</select>
|
</select>
|
||||||
<div id="btn-delete" class="button" data-i18n-content="labelDelete">Delete</div>
|
<div id="btn-delete" class="button" data-i18n-content="labelDelete">Delete</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -127,6 +127,8 @@ statistics._setDateRange = function () {
|
||||||
days = 30;
|
days = 30;
|
||||||
} else if (type === 'year') {
|
} else if (type === 'year') {
|
||||||
days = 365;
|
days = 365;
|
||||||
|
} else if (type === 'all') {
|
||||||
|
days = statistics._daysSinceFirstRelease();
|
||||||
} else {
|
} else {
|
||||||
statistics._dateRange = [new Date().toISOString().slice(0, 10)];
|
statistics._dateRange = [new Date().toISOString().slice(0, 10)];
|
||||||
}
|
}
|
||||||
|
@ -238,7 +240,7 @@ statistics._displayNameOfFramework = function (str, type) {
|
||||||
|
|
||||||
statistics._handlerDateRange = function ({target}) {
|
statistics._handlerDateRange = function ({target}) {
|
||||||
let type = target.value;
|
let type = target.value;
|
||||||
if (type === 'day' || type === 'week' || type === 'month' || type === 'year') {
|
if (type === 'day' || type === 'week' || type === 'month' || type === 'year' || type === 'all') {
|
||||||
statistics._dateUnit = type;
|
statistics._dateUnit = type;
|
||||||
statistics._saveDefaultRange(type);
|
statistics._saveDefaultRange(type);
|
||||||
} else if (type === 'delete') {
|
} else if (type === 'delete') {
|
||||||
|
@ -270,6 +272,14 @@ statistics._registerListener = function () {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
statistics._daysSinceFirstRelease = function () {
|
||||||
|
let timeDifference, millisecondsPerDay;
|
||||||
|
|
||||||
|
timeDifference = new Date() - new Date('2020-01-01');
|
||||||
|
millisecondsPerDay = 24 * 60 * 60 * 1000;
|
||||||
|
return Math.floor(timeDifference / millisecondsPerDay);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializations
|
* Initializations
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
<p>Improved</p>
|
<p>Improved</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li>Wildcard support extended in all lists (<a href="https://codeberg.org/nobody/LocalCDN/issues/1622">#1622</a>)</li>
|
<li>Wildcard support extended in all lists (<a href="https://codeberg.org/nobody/LocalCDN/issues/1622">#1622</a>)</li>
|
||||||
|
<li>Extend statistics over the whole time range (<a href="https://codeberg.org/nobody/LocalCDN/issues/1626">#1626</a>)</li>
|
||||||
</ul>
|
</ul>
|
||||||
<p>Fixed</p>
|
<p>Fixed</p>
|
||||||
<ul>
|
<ul>
|
||||||
|
|
Loading…
Reference in New Issue