D15937: Do not alter the state of the Scheduler while evaluating

Eric Dejouhanet noreply at phabricator.kde.org
Thu Oct 4 08:27:11 BST 2018


TallFurryMan added inline comments.

INLINE COMMENTS

> scheduler.cpp:1895
>  
> +    Q_ASSERT_X(observationDateTime.isValid(), __FUNCTION__, "Observation time for target culmination is valid.");
> +

This assert is there to catch an issue in which sometimes a job is scheduled without startup time. Haven't reproduced recently.

> scheduler.cpp:2130
> +    appendLogText(i18n("Astronomical twilight: dusk at %1, dawn at %2, and current time is %3",
> +                       dusk.toString(), dawn.toString(), now.toString()));
>  }

I inverted the order because most of the time, the end-user will be preparing the schedule *before* dusk.
In any case, because this order cannot be right every time, I plan to replace this log with either a text label or the same rise/transit/set as in the session planner, with all planned jobs and observatory availability summarized in.

> scheduler.cpp:1710
> +    { return SchedulerJob::JOB_SCHEDULED != job->getState(); }), sortedJobs.end());
> +
>      // Sort again by schedule, sooner first, as some jobs may have shifted during the last step

This sort block is really only a safeguard. No jobs are changing states while rescheduling, so the list cannot get empty and crash the next call to .first() at line 1714.
It's here to prepare that rescheduling part to properly account for fixed-time jobs and support intervals of observatory availability.

> scheduler.cpp:1868
> +        .arg(job->getName())
> +        .arg(transitTime.toString("hh:mm:ss"));
>  

This was replaced to hms because the job display format contains date information, and transit time is only hours.

> scheduler.cpp:1880
> +        .arg(observationDateTime.toString(job->getDateTimeDisplayFormat()))
> +        .arg((double)job->getCulminationOffset(), 0, 'f', 3);
>  

The cast to double avoids a C++ warning, apparently arg() is ambiguous at times.

REPOSITORY
  R321 KStars

REVISION DETAIL
  https://phabricator.kde.org/D15937

To: TallFurryMan, mutlaqja, wreissenberger
Cc: kde-edu, narvaez, apol
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-edu/attachments/20181004/11a047a8/attachment-0001.html>


More information about the kde-edu mailing list