Skip to content

Commit

Permalink
Merge pull request #88 from MatsMoll/develop
Browse files Browse the repository at this point in the history
[fix][Redis] session middleware lifecycle mismatch
  • Loading branch information
MatsMoll authored Nov 27, 2020
2 parents faed726 + 4e07e7d commit bb913c8
Show file tree
Hide file tree
Showing 4 changed files with 262 additions and 235 deletions.
154 changes: 79 additions & 75 deletions Public/assets/js/practice-session-histogram.js
Original file line number Diff line number Diff line change
@@ -1,79 +1,83 @@
var xhr = new XMLHttpRequest();
var url = "/api/practice-sessions/histogram?numberOfWeeks=7";
xhr.open("GET", url, true);
xhr.setRequestHeader("Content-Type", "application/json");
xhr.onreadystatechange = function () {
if (this.readyState != 4) return;
function fetchHistogram() {
var xhr = new XMLHttpRequest();
var url = "/api/practice-sessions/histogram?numberOfWeeks=7";
xhr.open("GET", url, true);
xhr.setRequestHeader("Content-Type", "application/json");
xhr.onreadystatechange = function () {
if (this.readyState != 4) return;

if (this.status == 200) {
var response = JSON.parse(this.responseText);
let data = response.map(x => x["numberOfTasksCompleted"]);
let labels = response.map(x => x["week"]);
var ctx = document.getElementById("practice-time-histogram").getContext('2d');
ctx.height = 200;
var myChart = new Chart(ctx, {
type: 'bar',
data: {
labels: labels,
datasets: [{
label: 'Antall oppgaver fullført',
data: data,
backgroundColor:
'rgba(10,207,151,0.4)',
borderColor:
'rgba(10,207,151,1)',
borderWidth: 2
}]
},
options: {
aspectRatio: 4,
maintainAspectRatio: true,
legend: {
display: !1
},
tooltips: {
intersect: !1
},
hover: {
intersect: !0
},
plugins: {
filler: {
propagate: !1
}
if (this.status == 200) {
var response = JSON.parse(this.responseText);
let data = response.map(x => x["numberOfTasksCompleted"]);
let labels = response.map(x => x["week"]);
var ctx = document.getElementById("practice-time-histogram").getContext('2d');
ctx.height = 200;
var myChart = new Chart(ctx, {
type: 'bar',
data: {
labels: labels,
datasets: [{
label: 'Antall oppgaver fullført',
data: data,
backgroundColor:
'rgba(10,207,151,0.4)',
borderColor:
'rgba(10,207,151,1)',
borderWidth: 2
}]
},
scales: {
xAxes: [{
reverse: !0,
gridLines: {
color: "rgba(0,0,0,0.05)"
},
scaleLabel: {
display: true,
labelString: 'Uke'
options: {
aspectRatio: 4,
maintainAspectRatio: true,
legend: {
display: !1
},
tooltips: {
intersect: !1
},
hover: {
intersect: !0
},
plugins: {
filler: {
propagate: !1
}
}],
yAxes: [{
ticks: {
stepSize: 10,
display: !1
},
min: 10,
max: 100,
display: !0,
borderDash: [5, 5],
gridLines: {
color: "rgba(0,0,0,0)",
fontColor: "#fff"
},
scaleLabel: {
display: true,
labelString: 'Oppgaver'
}
}]
},
scales: {
xAxes: [{
reverse: !0,
gridLines: {
color: "rgba(0,0,0,0.05)"
},
scaleLabel: {
display: true,
labelString: 'Uke'
}
}],
yAxes: [{
ticks: {
stepSize: 10,
display: !1
},
min: 10,
max: 100,
display: !0,
borderDash: [5, 5],
gridLines: {
color: "rgba(0,0,0,0)",
fontColor: "#fff"
},
scaleLabel: {
display: true,
labelString: 'Oppgaver'
}
}]
}
}
}
});
}
};
xhr.send();
});
}
};
xhr.send();
}

fetchHistogram();
144 changes: 74 additions & 70 deletions Public/assets/js/results/weekly-histogram.js
Original file line number Diff line number Diff line change
@@ -1,74 +1,78 @@
let subjectId = parseInt(window.location.pathname.split("/")[2]);
if (subjectId > 0) {
var xhr = new XMLHttpRequest();
var url = "/api/practice-sessions/histogram?subjectId=" + subjectId;
xhr.open("GET", url, true);
xhr.setRequestHeader("Content-Type", "application/json");
xhr.onreadystatechange = function () {
if (this.readyState != 4) return;
function fetchHistogram() {
let subjectId = parseInt(window.location.pathname.split("/")[2]);
if (subjectId > 0) {
var xhr = new XMLHttpRequest();
var url = "/api/practice-sessions/histogram?subjectId=" + subjectId;
xhr.open("GET", url, true);
xhr.setRequestHeader("Content-Type", "application/json");
xhr.onreadystatechange = function () {
if (this.readyState != 4) return;

if (this.status == 200) {
var response = JSON.parse(this.responseText);
let data = response.map(x => x["numberOfTasksCompleted"]);
let labels = response.map(x => x["week"]);
var ctx = document.getElementById("practice-time-histogram").getContext('2d');
ctx.height = 200;
var myChart = new Chart(ctx, {
type: 'bar',
data: {
labels: labels,
datasets: [{
label: 'Antall oppgaver fullført',
data: data,
backgroundColor:
'rgba(10,207,151,0.4)',
borderColor:
'rgba(10,207,151,1)',
borderWidth: 2
}]
},
options: {
aspectRatio: 1.5,
maintainAspectRatio: true,
legend: {
display: !1
},
tooltips: {
intersect: !1
},
hover: {
intersect: !0
},
plugins: {
filler: {
propagate: !1
}
if (this.status == 200) {
var response = JSON.parse(this.responseText);
let data = response.map(x => x["numberOfTasksCompleted"]);
let labels = response.map(x => x["week"]);
var ctx = document.getElementById("practice-time-histogram").getContext('2d');
ctx.height = 200;
var myChart = new Chart(ctx, {
type: 'bar',
data: {
labels: labels,
datasets: [{
label: 'Antall oppgaver fullført',
data: data,
backgroundColor:
'rgba(10,207,151,0.4)',
borderColor:
'rgba(10,207,151,1)',
borderWidth: 2
}]
},
scales: {
xAxes: [{
reverse: !0,
gridLines: {
color: "rgba(0,0,0,0.05)"
options: {
aspectRatio: 1.5,
maintainAspectRatio: true,
legend: {
display: !1
},
tooltips: {
intersect: !1
},
hover: {
intersect: !0
},
plugins: {
filler: {
propagate: !1
}
}],
yAxes: [{
ticks: {
stepSize: 10,
display: !1
},
min: 10,
max: 100,
display: !0,
borderDash: [5, 5],
gridLines: {
color: "rgba(0,0,0,0)",
fontColor: "#fff"
}
}]
},
scales: {
xAxes: [{
reverse: !0,
gridLines: {
color: "rgba(0,0,0,0.05)"
}
}],
yAxes: [{
ticks: {
stepSize: 10,
display: !1
},
min: 10,
max: 100,
display: !0,
borderDash: [5, 5],
gridLines: {
color: "rgba(0,0,0,0)",
fontColor: "#fff"
}
}]
}
}
}
});
}
};
xhr.send();
}
});
}
};
xhr.send();
}
}

fetchHistogram();
Loading

0 comments on commit bb913c8

Please sign in to comment.