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

Regression: analytics selections malfunctioning #117

Merged
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions documentation/changelog.rst
Expand Up @@ -25,6 +25,7 @@ v0.4.1 | May XX, 2021

Bugfixes
-----------
* Fixed a regression that stopped asset, market and sensor selection from working [see `PR #117 <http://www.github.com/SeitaBV/flexmeasures/pull/117>`_]
* Prevent logging out user when clearing the session [see `PR #112 <http://www.github.com/SeitaBV/flexmeasures/pull/112>`_]
* Prevent user type data source to be created without setting a user [see `PR #111 <https://github.com/SeitaBV/flexmeasures/pull/111>`_]

Expand Down
19 changes: 19 additions & 0 deletions flexmeasures/ui/static/js/flexmeasures-module.js
@@ -0,0 +1,19 @@
// Date range utils
export function subtract(oldDate, nDays) {
var newDate = new Date(oldDate)
newDate.setDate(newDate.getDate() - nDays);
return newDate;
}
export function thisMonth(oldDate) {
var d1 = new Date(oldDate)
d1.setDate(1);
var d2 = new Date(d1.getFullYear(), d1.getMonth() + 1, 0);
return [d1, d2];
};
export function lastNMonths(oldDate, nMonths) {
var d0 = new Date(oldDate)
var d1 = new Date(d0.getFullYear(), d0.getMonth() - nMonths + 2, 0);
d1.setDate(1);
var d2 = new Date(d0.getFullYear(), d0.getMonth() + 1, 0);
return [d1, d2];
};
21 changes: 0 additions & 21 deletions flexmeasures/ui/static/js/flexmeasures.js
Expand Up @@ -310,24 +310,3 @@ function submit_market() {
function submit_sensor_type() {
$("#sensor_type-form").attr("action", empty_location).submit();
}


// Date range utils
export function subtract(oldDate, nDays) {
var newDate = new Date(oldDate)
newDate.setDate(newDate.getDate() - nDays);
return newDate;
}
export function thisMonth(oldDate) {
var d1 = new Date(oldDate)
d1.setDate(1);
var d2 = new Date(d1.getFullYear(), d1.getMonth() + 1, 0);
return [d1, d2];
};
export function lastNMonths(oldDate, nMonths) {
var d0 = new Date(oldDate)
var d1 = new Date(d0.getFullYear(), d0.getMonth() - nMonths + 2, 0);
d1.setDate(1);
var d2 = new Date(d0.getFullYear(), d0.getMonth() + 1, 0);
return [d1, d2];
};
3 changes: 2 additions & 1 deletion flexmeasures/ui/templates/base.html
Expand Up @@ -209,7 +209,8 @@
<script src="https://cdn.jsdelivr.net/npm/ion-rangeslider@2.3.1/js/ion.rangeSlider.min.js"></script>

<!-- Custom scripts -->
<script type="module" src="{{ url_for('flexmeasures_ui.static', filename='js/flexmeasures.js') }}"></script>
<script src="{{ url_for('flexmeasures_ui.static', filename='js/flexmeasures.js') }}"></script>
<script type="module" src="{{ url_for('flexmeasures_ui.static', filename='js/flexmeasures-module.js') }}"></script>
{% if show_datepicker %}
<script src="{{ url_for('flexmeasures_ui.static', filename='js/daterangepicker-init.js') }}"></script>
{% endif %}
Expand Down