fixed bug where wrong month was selected in estimate_by_month #9
|
|
@ -361,9 +361,9 @@ export class User {
|
||||||
|
|
||||||
get_estimate_by_month(year: number, month: number): number {
|
get_estimate_by_month(year: number, month: number): number {
|
||||||
const query = this._database.query(ESTIMATES_DATABASE_GET_QUART);
|
const query = this._database.query(ESTIMATES_DATABASE_GET_QUART);
|
||||||
const res = query.get({ year: year, quarter: Math.floor(month / 4 + 1) }) as EstimatesEntry;
|
const res = query.get({ year: year, quarter: Math.floor((month-1) / 3) }) as EstimatesEntry;
|
||||||
|
|
||||||
return res?.[`estimate_${month % 3}`] ?? NaN;
|
return res?.[`estimate_${(month - 1) % 3}`] ?? NaN;
|
||||||
}
|
}
|
||||||
|
|
||||||
insert_estimate(year: number, quarter: number, estimate_0: number, estimate_1: number, estimate_2: number) {
|
insert_estimate(year: number, quarter: number, estimate_0: number, estimate_1: number, estimate_2: number) {
|
||||||
|
|
|
||||||
|
|
@ -235,7 +235,7 @@ async function _genLatexRec(user: User, file_pref: string, year: number, month:
|
||||||
}
|
}
|
||||||
|
|
||||||
const records = user.get_entries_by_month(year, month);
|
const records = user.get_entries_by_month(year, month);
|
||||||
const estimate = user.get_estimate_by_month(year, month-1);
|
const estimate = user.get_estimate_by_month(year, month);
|
||||||
const hr_sum = (() => { let s = 0; records.forEach((r) => { s += calculateDuration(r.start, r.end) }); return s; })()
|
const hr_sum = (() => { let s = 0; records.forEach((r) => { s += calculateDuration(r.start, r.end) }); return s; })()
|
||||||
|
|
||||||
if (estimate == null || isNaN(estimate)) {
|
if (estimate == null || isNaN(estimate)) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue