Problem with consulting the markbook by term (v26)

Hi,

I am currently testing with the Markbook option to manage student grades.
I created a class with 6 evaluations (columns), 2 evaluations per term.

When I select All terms, I see the 6 evaluations.

When I select term 1, I see evaluations for terms 1, 2 and 3.

When I look at term 2, I see evaluations for terms 2 and 3.

When I view term 2, I see the evaluations for term 3.

I made a SQL query with the Query Builder module to check the information on the definition of my evaluations.

SELECT gibbonMarkbookColumn.gibbonMarkbookColumnID, gibbonMarkbookColumn.gibbonSchoolYearTermID, gibbonSchoolYearTerm.nameshort, gibbonMarkbookColumn.type, gibbonMarkbookColumn.name,
gibbonMarkbookColumn.viewableStudents, gibbonMarkbookColumn.viewableParents
FROM gibbonMarkbookColumn
LEFT OUTER JOIN gibbonSchoolYearTerm ON gibbonSchoolYearTerm.gibbonSchoolYearTermID = gibbonMarkbookColumn.gibbonSchoolYearTermID
WHERE gibbonMarkbookColumn.gibbonCourseClassID = ‘00000002’
ORDER BY gibbonMarkbookColumn.gibbonSchoolYearTermID, gibbonMarkbookColumn.gibbonMarkbookColumnID

I can see that there are indeed 2 evaluations per term in the gibbonMarkbookColumn table.

Are there other things to check?

THANKS !

Sylvain

Hi,

After a few hours of research, I finally found out why I had evaluations showing up in the wrong term.

When I looked at the URL parameters, I could see that the Term was passed (gibbonSchoolYearTermID=00034), but it didn’t work.

http://…/index.php?q=%2Fmodules%2FMarkbook%2Fmarkbook_view.php&search=&gibbonSchoolYearTermID=00034&markbookFilter=&gibbonCourseClassID=00000002

I analyzed the data on my assessments, specifically the dates.

The filter by Term seems to be done based on dates and not based on the selected Term.

If the date field is between the start and end date of the Term OR if the completeDate field is between the start and end date of the Term, the evaluation is displayed in the Term.

I tried to confirm this theory by digging through Markbook’s PHP pages, but PHP is far from the programming languages ​​I’m familiar with.

I changed the dates of my evaluations so that they were within my Terms and now the filter applies correctly.

Could one of the developers confirm to me that the interpretations are correct?

Should there be validation of dates when an evaluation is linked to a Term?

THANK !

Sylvain
Gibbon : v26.0.00 ca-fr, PHP v8.2.10, MySQL v8.0.36, Ubuntu 23.10.1

Hi,

I also have a question about displaying the Markbook with the “All Terms” filter.
Why does the summary column for a Term only appear when the filter is on a single Term?

THANK !

Sylvain
Gibbon : v26.0.00 ca-fr, PHP v8.2.10, MySQL v8.0.36, Ubuntu 23.10.1

Thanks for the detailed info. This is odd, and not the intended behaviour. It looks like it may be related to an issue that is already fixed for v26. Would you be able to apply the following fix (line 57) to see if it fixes the Term/All Terms filter? Markbook: fix All Term selector, fix errors when adding non string va… · GibbonEdu/core@839e6cc · GitHub

Hi @sandra,

I looked at the files referenced in your POST and my installation of Gibbon v26 already contains the up-to-date files.

A good thing is that your POST allowed me to look at the code of the MarkbookColumnGateway.php file.

When I look in the code I can see that there is an OR in the INNER JOIN with the column date.

I modified the source to remove the OR and the problem of having a Term 2 column in the Term 1 columns is resolved.

public function queryMarkbookColumnsByClass(QueryCriteria $criteria, $gibbonCourseClassID)
{
$query = $this
->newQuery()
->from(‘gibbonMarkbookColumn’)
->cols([‘*’,‘gibbonMarkbookColumn.name as name’,‘gibbonMarkbookColumn.sequenceNumber as sequenceNumber’])
->where(‘gibbonMarkbookColumn.gibbonCourseClassID = :gibbonCourseClassID’)
->bindValue(‘gibbonCourseClassID’, $gibbonCourseClassID)
->groupBy([‘gibbonMarkbookColumn.gibbonMarkbookColumnID’]);

    $criteria->addFilterRules([
        'term' => function ($query, $gibbonSchoolYearTermID) {
            if (intval($gibbonSchoolYearTermID) <= 0) return $query;

            return $query
                ->innerJoin('gibbonSchoolYearTerm', 'gibbonSchoolYearTerm.gibbonSchoolYearTermID=gibbonMarkbookColumn.gibbonSchoolYearTermID 
                    OR gibbonMarkbookColumn.date BETWEEN gibbonSchoolYearTerm.firstDay AND gibbonSchoolYearTerm.lastDay')
                ->where('gibbonSchoolYearTerm.gibbonSchoolYearTermID = :gibbonSchoolYearTermID')
                ->bindValue('gibbonSchoolYearTermID', $gibbonSchoolYearTermID);
        },
        'show' => function ($query, $show) {
            switch ($show) {
                case 'marked'  : $query->where("complete = 'Y'"); break;
                case 'unmarked': $query->where("complete = 'N'"); break;
            }
            return $query;
        },
    ]);

    return $this->runQuery($query, $criteria);
}

I’m not sure if this change should be included in v27 or if I should keep this change to reapply in v27.

THANKS!

Sylvain
Gibbon : v26.0.00 ca-fr, PHP v8.2.10, MySQL v8.0.36, Ubuntu 23.10.1

Hmmm, that is odd, as it works as expected on the systems I’ve tested. I’ll check out the query changes when I have a moment, In the meantime, can you share a screenshot of your term dates? I wonder if the dates overlap :thinking:

Hi @sandra,

Here is the screenshot of my terms.
There are no overlaps.

Sylvain