fix: Pass from date to energy_point_history

- So that it can only show logs of current point
This commit is contained in:
Suraj Shetty 2019-04-24 07:35:40 +05:30
parent 8331510fad
commit 488dbd2949
2 changed files with 26 additions and 22 deletions

View file

@ -22,13 +22,13 @@
</template>
<script>
export default {
props: ['user'],
props: ['user', 'from_date'],
data() {
return {
history_logs: [],
fetching: false,
has_more_logs: true
}
};
},
created() {
this.get_logs();
@ -37,34 +37,37 @@ export default {
get_logs() {
this.fetching = true;
const pull_limit = 10;
frappe.db.get_list('Energy Point Log', {
filters: {
user: this.user,
type: ['!=', 'Review']
},
fields: ['*'],
limit: pull_limit,
limit_start: this.history_logs.length
}).then(data => {
this.history_logs = this.history_logs.concat(data);
this.has_more_logs = data.length === pull_limit;
}).finally(() => {
this.fetching = false;
})
frappe.db
.get_list('Energy Point Log', {
filters: {
user: this.user,
type: ['!=', 'Review'],
creation: ['>=', this.from_date]
},
fields: ['*'],
limit: pull_limit,
limit_start: this.history_logs.length
})
.then(data => {
this.history_logs = this.history_logs.concat(data);
this.has_more_logs = data.length === pull_limit;
})
.finally(() => {
this.fetching = false;
});
}
},
}
}
};
</script>
<style lang="less">
@import "frappe/public/less/common";
@import 'frappe/public/less/common';
.log-list {
padding: 15px;
padding-left: 0px;
position: relative;
}
.log-list:before {
content: " ";
content: ' ';
border-left: 1px solid @border-color;
position: absolute;
top: 0px;
@ -82,7 +85,7 @@ export default {
position: relative;
}
.history-log:before {
content: " ";
content: ' ';
width: 7px;
height: 7px;
background-color: @border-color;

View file

@ -47,6 +47,7 @@
v-show="show_log_for===user.name"
class="energy-point-history"
:user="user.name"
:from_date="from_date"
:key="user.name + user.energy_points"
></energy-point-history>
</li>