fetch past 21 weeks for activity widgets

This commit is contained in:
Satsuki Yanagi 2019-07-20 07:06:26 +09:00
parent 6d44263ae7
commit d5b9fa6a33
No known key found for this signature in database
GPG Key ID: F68E0DDD49AF6FB6
3 changed files with 4 additions and 10 deletions

View File

@ -1,5 +1,5 @@
<template>
<svg :viewBox="`0 0 ${weeks} 7`">
<svg :viewBox="`0 0 21 7`">
<rect v-for="record in data" class="day"
width="1" height="1"
:x="record.x" :y="record.date.weekday"
@ -28,11 +28,6 @@ import Vue from 'vue';
export default Vue.extend({
props: ['data'],
data() {
return {
weeks: 21
};
},
created() {
for (const d of this.data) {
d.total = d.notes + d.replies + d.renotes;
@ -43,9 +38,8 @@ export default Vue.extend({
const year = now.getFullYear();
const month = now.getMonth();
const day = now.getDate();
if (now.getDay() == 6) this.weeks = 20;
let x = this.weeks - 1;
let x = 20;
this.data.slice().forEach((d, i) => {
d.x = x;

View File

@ -46,7 +46,7 @@ export default Vue.extend({
props: ['data'],
data() {
return {
viewBoxX: 140,
viewBoxX: 147,
viewBoxY: 60,
zoom: 1,
pos: 0,

View File

@ -48,7 +48,7 @@ export default Vue.extend({
this.$root.api('charts/user/notes', {
userId: this.user.id,
span: 'day',
limit: 7 * 20
limit: 7 * 21
}).then(activity => {
this.activity = activity.diffs.normal.map((_, i) => ({
total: activity.diffs.normal[i] + activity.diffs.reply[i] + activity.diffs.renote[i],