Moodle

Sorting assignment submissions by comment breaks submission page

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Won't Fix
  • Affects Version/s: 1.9.4
  • Fix Version/s: None
  • Labels:
    None
  • Environment:
    Apache 2, PHP 5.2.8, RedHat Linux. MSSQL running on IIS for our DB server.
  • Database:
    Microsoft SQL
  • Difficulty:
    Moderate
  • Affected Branches:
    MOODLE_19_STABLE

Description

When users would try to sort assignment submissions by the Comment field, all of the assignment submissions would disappear. You have to actually logout and log back in again to get the assignments back.

The issue appears to be that MSSQL doesn't allow you to sort records using text or ntext columns – and since the submissioncomment column is ntext, the query fails.

What I've done is modified the flexible_table class in /lib/tablelib.php to have an additional variable, $column_properties, and method, column_properties, which allow you to store arbitrary metadata about columns. I then changed the flexible_table::get_sql_sort() method to check if a column had a property associated with it called 'type'. If a column has a 'type' property, and that property is set to 'text', then the generated $sortstring calls sql_order_by_text() on that column, to generate any DB-specific SQL necessary for sorting an ntext or text column.

I also modified /mod/assignment/lib.php to make use of the new flexible_table::column_properties() method so that the submissioncomment column has a 'type' property associated with it.

Activity

Hide
Charles Fulton added a comment -

We've experienced this same issue trying to sort by "timemodified." We're running Moodle on Server 2003/IIS with a MSSQL backend. I'll give this fix a try and report back.

Show
Charles Fulton added a comment - We've experienced this same issue trying to sort by "timemodified." We're running Moodle on Server 2003/IIS with a MSSQL backend. I'll give this fix a try and report back.
Hide
Lucian DiPeso added a comment -

Interesting. We haven't had any problem with that column. However, if you're having the same symptoms, its probably also caused by a SQL error. Try turning debugging on in Moodle, and seeif there are any errors generated.

Show
Lucian DiPeso added a comment - Interesting. We haven't had any problem with that column. However, if you're having the same symptoms, its probably also caused by a SQL error. Try turning debugging on in Moodle, and seeif there are any errors generated.
Hide
Wen Hao Chuang added a comment -

I think it doesn't make sense to "sort" by the "Comment" column at the first place. Because of this, I think it doesn't make sense to make "Comment" a clickable link for people to "sort" on it as that would give people a wrong expectation (that it would sort correctly). This issue should be fixed anyway as the current behavior (clickable to be sorted, but then it doesn't sort at all) does not make sense. Just my 2 cents

Show
Wen Hao Chuang added a comment - I think it doesn't make sense to "sort" by the "Comment" column at the first place. Because of this, I think it doesn't make sense to make "Comment" a clickable link for people to "sort" on it as that would give people a wrong expectation (that it would sort correctly). This issue should be fixed anyway as the current behavior (clickable to be sorted, but then it doesn't sort at all) does not make sense. Just my 2 cents
Hide
Michael de Raadt added a comment -

Thanks for reporting this issue.

We have detected that this issue has been inactive for over a year has been recorded as affecting versions that are no longer supported.

If you believe that this issue is still relevant to current versions (2.1 and beyond), please comment on the issue. Issues left inactive for a further month will be closed.

Michael d;

lqjjLKA0p6

Show
Michael de Raadt added a comment - Thanks for reporting this issue. We have detected that this issue has been inactive for over a year has been recorded as affecting versions that are no longer supported. If you believe that this issue is still relevant to current versions (2.1 and beyond), please comment on the issue. Issues left inactive for a further month will be closed. Michael d; lqjjLKA0p6
Hide
Michael de Raadt added a comment -

I'm closing this issue as it appears to have become inactive and is probably not relevant to a current supported version. If you are encountering this problem or one similar, please launch a new issue.

Show
Michael de Raadt added a comment - I'm closing this issue as it appears to have become inactive and is probably not relevant to a current supported version. If you are encountering this problem or one similar, please launch a new issue.

People

Vote (4)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: