Added "last_checkout_cleared" valexpr variable
This commit is contained in:
parent
6a0daf634f
commit
c0fa144ca5
5 changed files with 24 additions and 12 deletions
|
|
@ -309,6 +309,10 @@ namespace {
|
||||||
return (! account.self_details().latest_checkout.is_not_a_date_time() ?
|
return (! account.self_details().latest_checkout.is_not_a_date_time() ?
|
||||||
value_t(account.self_details().latest_checkout) : NULL_VALUE);
|
value_t(account.self_details().latest_checkout) : NULL_VALUE);
|
||||||
}
|
}
|
||||||
|
value_t get_latest_checkout_cleared(account_t& account)
|
||||||
|
{
|
||||||
|
return account.self_details().latest_checkout_cleared;
|
||||||
|
}
|
||||||
|
|
||||||
template <value_t (*Func)(account_t&)>
|
template <value_t (*Func)(account_t&)>
|
||||||
value_t get_wrapper(call_scope_t& args) {
|
value_t get_wrapper(call_scope_t& args) {
|
||||||
|
|
@ -405,6 +409,8 @@ expr_t::ptr_op_t account_t::lookup(const symbol_t::kind_t kind,
|
||||||
return WRAP_FUNCTOR(get_wrapper<&get_latest>);
|
return WRAP_FUNCTOR(get_wrapper<&get_latest>);
|
||||||
else if (fn_name == "latest_checkout")
|
else if (fn_name == "latest_checkout")
|
||||||
return WRAP_FUNCTOR(get_wrapper<&get_latest_checkout>);
|
return WRAP_FUNCTOR(get_wrapper<&get_latest_checkout>);
|
||||||
|
else if (fn_name == "latest_checkout_cleared")
|
||||||
|
return WRAP_FUNCTOR(get_wrapper<&get_latest_checkout_cleared>);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'n':
|
case 'n':
|
||||||
|
|
@ -662,8 +668,10 @@ void account_t::xdata_t::details_t::update(post_t& post,
|
||||||
earliest_checkin = *post.checkin;
|
earliest_checkin = *post.checkin;
|
||||||
|
|
||||||
if (post.checkout && (latest_checkout.is_not_a_date_time() ||
|
if (post.checkout && (latest_checkout.is_not_a_date_time() ||
|
||||||
*post.checkout > latest_checkout))
|
*post.checkout > latest_checkout)) {
|
||||||
latest_checkout = *post.checkout;
|
latest_checkout = *post.checkout;
|
||||||
|
latest_checkout_cleared = post.state() == item_t::CLEARED;
|
||||||
|
}
|
||||||
|
|
||||||
if (post.state() == item_t::CLEARED) {
|
if (post.state() == item_t::CLEARED) {
|
||||||
posts_cleared_count++;
|
posts_cleared_count++;
|
||||||
|
|
|
||||||
|
|
@ -183,6 +183,7 @@ public:
|
||||||
|
|
||||||
datetime_t earliest_checkin;
|
datetime_t earliest_checkin;
|
||||||
datetime_t latest_checkout;
|
datetime_t latest_checkout;
|
||||||
|
bool latest_checkout_cleared;
|
||||||
|
|
||||||
std::set<path> filenames;
|
std::set<path> filenames;
|
||||||
std::set<string> accounts_referenced;
|
std::set<string> accounts_referenced;
|
||||||
|
|
|
||||||
|
|
@ -431,7 +431,7 @@ void instance_t::read_next_directive(bool& error_flag)
|
||||||
|
|
||||||
#if defined(TIMELOG_SUPPORT)
|
#if defined(TIMELOG_SUPPORT)
|
||||||
|
|
||||||
void instance_t::clock_in_directive(char * line, bool /*capitalized*/)
|
void instance_t::clock_in_directive(char * line, bool capitalized)
|
||||||
{
|
{
|
||||||
string datetime(line, 2, 19);
|
string datetime(line, 2, 19);
|
||||||
|
|
||||||
|
|
@ -452,7 +452,7 @@ void instance_t::clock_in_directive(char * line, bool /*capitalized*/)
|
||||||
position.end_line = context.linenum;
|
position.end_line = context.linenum;
|
||||||
position.sequence = context.sequence++;
|
position.sequence = context.sequence++;
|
||||||
|
|
||||||
time_xact_t event(position, parse_datetime(datetime),
|
time_xact_t event(position, parse_datetime(datetime), capitalized,
|
||||||
p ? top_account()->find_account(p) : NULL,
|
p ? top_account()->find_account(p) : NULL,
|
||||||
n ? n : "",
|
n ? n : "",
|
||||||
end ? end : "");
|
end ? end : "");
|
||||||
|
|
@ -460,7 +460,7 @@ void instance_t::clock_in_directive(char * line, bool /*capitalized*/)
|
||||||
timelog.clock_in(event);
|
timelog.clock_in(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void instance_t::clock_out_directive(char * line, bool /*capitalized*/)
|
void instance_t::clock_out_directive(char * line, bool capitalized)
|
||||||
{
|
{
|
||||||
string datetime(line, 2, 19);
|
string datetime(line, 2, 19);
|
||||||
|
|
||||||
|
|
@ -481,7 +481,7 @@ void instance_t::clock_out_directive(char * line, bool /*capitalized*/)
|
||||||
position.end_line = context.linenum;
|
position.end_line = context.linenum;
|
||||||
position.sequence = context.sequence++;
|
position.sequence = context.sequence++;
|
||||||
|
|
||||||
time_xact_t event(position, parse_datetime(datetime),
|
time_xact_t event(position, parse_datetime(datetime), capitalized,
|
||||||
p ? top_account()->find_account(p) : NULL,
|
p ? top_account()->find_account(p) : NULL,
|
||||||
n ? n : "",
|
n ? n : "",
|
||||||
end ? end : "");
|
end ? end : "");
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ namespace {
|
||||||
VERIFY(amt.valid());
|
VERIFY(amt.valid());
|
||||||
|
|
||||||
post_t * post = new post_t(in_event.account, amt, POST_VIRTUAL);
|
post_t * post = new post_t(in_event.account, amt, POST_VIRTUAL);
|
||||||
post->set_state(item_t::CLEARED);
|
post->set_state(out_event.completed ? item_t::CLEARED : item_t::UNCLEARED);
|
||||||
post->pos = in_event.position;
|
post->pos = in_event.position;
|
||||||
post->checkin = in_event.checkin;
|
post->checkin = in_event.checkin;
|
||||||
post->checkout = out_event.checkin;
|
post->checkout = out_event.checkin;
|
||||||
|
|
|
||||||
|
|
@ -56,6 +56,7 @@ class time_xact_t
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
datetime_t checkin;
|
datetime_t checkin;
|
||||||
|
bool completed;
|
||||||
account_t * account;
|
account_t * account;
|
||||||
string desc;
|
string desc;
|
||||||
string note;
|
string note;
|
||||||
|
|
@ -66,16 +67,18 @@ public:
|
||||||
}
|
}
|
||||||
time_xact_t(const optional<position_t>& _position,
|
time_xact_t(const optional<position_t>& _position,
|
||||||
const datetime_t& _checkin,
|
const datetime_t& _checkin,
|
||||||
account_t * _account = NULL,
|
const bool _completed = false,
|
||||||
const string& _desc = "",
|
account_t * _account = NULL,
|
||||||
const string& _note = "")
|
const string& _desc = "",
|
||||||
: checkin(_checkin), account(_account), desc(_desc), note(_note),
|
const string& _note = "")
|
||||||
|
: checkin(_checkin), completed(_completed), account(_account),
|
||||||
|
desc(_desc), note(_note),
|
||||||
position(_position ? *_position : position_t()) {
|
position(_position ? *_position : position_t()) {
|
||||||
TRACE_CTOR(time_xact_t,
|
TRACE_CTOR(time_xact_t,
|
||||||
"position_t, datetime_t, account_t *, string, string");
|
"position_t, datetime_t, bool, account_t *, string, string");
|
||||||
}
|
}
|
||||||
time_xact_t(const time_xact_t& xact)
|
time_xact_t(const time_xact_t& xact)
|
||||||
: checkin(xact.checkin), account(xact.account),
|
: checkin(xact.checkin), completed(xact.completed), account(xact.account),
|
||||||
desc(xact.desc), note(xact.note), position(xact.position) {
|
desc(xact.desc), note(xact.note), position(xact.position) {
|
||||||
TRACE_CTOR(time_xact_t, "copy");
|
TRACE_CTOR(time_xact_t, "copy");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue