Code Monkey home page Code Monkey logo

Comments (3)

NeroBurner avatar NeroBurner commented on June 1, 2024

I've narrowed the problem in 'Revenue & Productivity Report' down

When cycling through the report periods the period_view variable is incremented

case 9: // nextperiod
printf("report_zone : nextperiod\n");
period_view = NextValue(period_view, ReportPeriodValue);
Draw(t, 1);
return SIGNAL_OKAY;

period_view can take the following values:

int ReportPeriodValue[] = {
    SP_NONE, SP_DAY, SP_WEEK, SP_2WEEKS, SP_MONTH, SP_QUARTER, SP_YTD, -1 };

When period_view is of value SP_YTD the next value is SP_NONE. This is when things turn bad

1  raise                                           0x7fb39a126d7f 
2  abort                                           0x7fb39a111672 
3  __assert_fail_base.cold.0                       0x7fb39a111548 
4  __assert_fail                                   0x7fb39a11f396 
5  TimeInfo::operator>       time_info.cc     426  0x5623c0a853f6 
6  WorkEntry::Overlap        labor.cc         370  0x5623c09cc645 
7  LaborDB::FigureLabor      labor.cc         1313 0x5623c09d0bc2 
8  BalanceReportWorkFn       system_report.cc 1557 0x5623c09e5271 
9  ??                                              0x7fb39b189c2e 
10 XtAppNextEvent                                  0x7fb39b18b493 
11 StartSystem               manager.cc       944  0x5623c092c999 
12 main                      manager.cc       454  0x5623c092a4cf 

The overlap between start and end should be calculated. But the member variable start is compared to the function variable st with the > operator. The variable st is not valid (st.IsSet() is false) and then the assert in TimeInfo hits

viewtouch/main/labor.cc

Lines 366 to 372 in f72b113

int WorkEntry::Overlap(TimeInfo &st, TimeInfo &et)
{
FnTrace("WorkEntry::Overlap()");
TimeInfo s, e;
if (start > st)
s = start;
else

FigureLabor checks the end time for validity, but not the start time

viewtouch/main/labor.cc

Lines 1290 to 1313 in f72b113

int LaborDB::FigureLabor(Settings *s, TimeInfo &start, TimeInfo &end_time,
int job, int &mins, int &cost, int &otmins, int &otcost)
{
FnTrace("LaborDB::FigureLabor()");
mins = 0;
cost = 0;
otmins = 0;
otcost = 0;
TimeInfo end;
if (!end_time.IsSet() || end_time > SystemTime)
end = SystemTime; // end time can't be ahead of actual time
else
end = end_time;
LaborPeriod *lp = PeriodList();
while (lp)
{
WorkEntry *work_entry = lp->WorkList();
while (work_entry)
{
if ((job <= 0 || work_entry->job == job) && work_entry->pay_rate == PERIOD_HOUR)
{
int m = work_entry->Overlap(start, end);

The issue was silent before my changes, but is now hitting the new asserts. I don't know where start and end are set (or should be set) or how to resolve this issue.

from viewtouch.

NeroBurner avatar NeroBurner commented on June 1, 2024

report bug probably fixed, but new image still available -> reopen

from viewtouch.

NeroBurner avatar NeroBurner commented on June 1, 2024

title changed, therefore closing this bugreport as fixed

from viewtouch.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.