Skip to content

add sorting options for labs, default viewing options for labs#992

Merged
bmcutler merged 8 commits intomasterfrom
Simple_Grader
Jun 7, 2017
Merged

add sorting options for labs, default viewing options for labs#992
bmcutler merged 8 commits intomasterfrom
Simple_Grader

Conversation

@MarisaPLee
Copy link
Contributor

@MarisaPLee MarisaPLee commented May 25, 2017

sorting by first name is using legal name and by not preferred name
closes #899

@MasterOdin
Copy link
Member

Before I do my review, one thing that stands out is that you're only applying the ability to sort differently when we're grading by registration section. Why is this also not applied for rotating sections?

@MasterOdin
Copy link
Member

Talking to Barb, we want to apply sorting to both registration and rotating section grading.

}
else{
$query = "SELECT * FROM users WHERE rotating_section=? AND user_group=? ORDER BY user_id";
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be something like:

$query = "SELECT * FROM users WHERE ";
$query .=  ($grade_by_reg_section) ? "registration_section=?" : "rotating_section=?";
$query .= " AND user_group=? ORDER BY "
if ($sort_by === 0) {
    $query .= "user_firstname, user_lastname, user_id";
}
elseif ($sort_by === 1) {
    $query .= "user_lastname, user_id";
}
else {
    $query .= "user_id";
}

and dynamically build the query making it easier for us to go back and change things about the query without having to apply the changes to 4+ versions of it.

$g_id = $_GET['g_id'];
$section = intval($_GET['section_id']);
$grade_by_reg_section = $_GET['grade_by_reg_section'];
$sort_by = $_GET['sort_by'];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we're only expecting a number to be passed on this, wrap with intval($_GET['sort_by']), especially if you're doing numeric comparisons later against it. Otherwise, this will be a string and then you're doing '0' == 0, '1' == 0, '1' == 1, etc which is a potential source of an error on implicit type coercion.

}
}
$keys = array("registration_section", "rotating_section");
$keys = array("registration_section", "rotating_section", "registration_section_by_first", "registration_section_by_last");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer you add a new argument to the function $sort_key or something and not overload $section_key since it'll lead to a lot of duplicate stuff as we apply the same sorts to both registration and rotating sections (and make it harder to add new sorting methods in the future).

else{
$query .= "
ORDER BY u.{$section_key}, u.user_id";
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Going off the above comments, it'd be nice to see this be something like:

$order_by = array();
$order_by[] = "u.{$section_key};
if ($sort_key === "by_first") {
    $order_by[] = "u.user_firstname";
    $order_by[] = "u.user_lastname";
}
else if ($sort_key === "by_last") {
    $order_by[] = "u.user_lastname";
}
$order_by[] = "u.user_id";
$query .= "ORDER BY ".implode(", ", $order_by);

</div>
</div>
HTML;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix the indentation on this curly brace so it aligns with what ever opened it. That way, we can scroll up in the file and find the associated if or else or whatever that opened it.

<div style="float: right; margin-bottom: 10px">
HTML;
if (!isset($_GET['view']) || $_GET['view'] !== 'all') {
if ($this->core->getUser()->accessFullGrading()){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indent this line since the line above opens a new if block.

}
}
else {
if(count($this->core->getUser()->getGradingRegistrationSections()) !== 0){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indent as the line above opens a new if block.

public function checkpointForm($gradeable, $rows, $graders) {
$return = <<<HTML
<div class="content">
<div style="float: right; margin-bottom: 10px; margin-left: 20px">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unindent as it it should be just one tab (4 spaces). The HTML and PHP content follow different indentation schemes (bit confusing at first, but you get used to it) which makes it easy to see where things start/end for various PHP blocks and HTML blocks.

@bmcutler bmcutler requested a review from wangj35 June 5, 2017 21:40
Copy link
Contributor

@wangj35 wangj35 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • checked that sorting worked for instructor, full access grader (ta), and limited access grader (grader) for both sectional/rotating grading
  • sorting works and applies to the print sheet
  • if grader doesn't have access to a lab, no students show up and there is just a message
  • functionality & code all looks good to me

else{
$query .= "user_id";
}

Copy link
Member

@MasterOdin MasterOdin Jun 6, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't want to sort just on firstname or just one lastname or just on id as this can lead to unpredictable behavior if we have students who have matching first names and last names (it'll be sorted by insertion order which given manual additions might lead to some slight confusion on order).

I'd like to see this be:

$sort = array();
if ($sort_by === 'first') {
    $sort[] = 'user_firstname';
    $sort[] = 'user_lastname';
}
else if ($sort_by === 'last') {
    $sort[] = 'user_lastname';
}
$sort[] = 'user_id';
$query .= implode(', ', $sort);

$query .= "
ORDER BY u.{$section_key}, u.user_id";
$query .= "
ORDER BY u.{$section_key}, {$sort_key}";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as above that we should not just be sorting by first name or last name (though just by id is fine as that's unique).

@bmcutler bmcutler merged commit 530fd58 into master Jun 7, 2017
@bmcutler bmcutler deleted the Simple_Grader branch June 7, 2017 20:32
emaicus pushed a commit that referenced this pull request Jun 19, 2017
* add sorting options for labs, default viewing options for labs

* sorting for registration and rotation grading

* sort by more than just id
bmcutler pushed a commit that referenced this pull request Jun 26, 2017
* Added directories to path in execute.cpp. Added gfx installs and cmake permissions in install_system.sh

* added php zip file fix

* Added very rough version of window_utils

* Added support for screenshotting. Separated window code into window_utils

Author:   Evan Maicus <emaicus@outlook.com>

* Added support for delays and typed commands

* Added detection of window name based on child pid

* Added click and drag support. Added mouse support.

* Added error checking and documentation

* Large overhaul of click and drag.

* Added comments, added alt button support in click and drag, tested in prep for pull request.

* Added support for decimal delays.

* add sorting options for labs, default viewing options for labs (#992)

* add sorting options for labs, default viewing options for labs

* sorting for registration and rotation grading

* sort by more than just id

* Progress on revising navigation page with submission status (#962)

progress on issue #674

* Allow user to specify whether they should stay logged in (past browser closure), defaults to true (#1014)

* Ambersands no longer get truncated (#1022)

* Gradeable layout with only numerics (#1023)

* Looks better when there are zero numeric fields

* Looks better when there are zero numeric fields

* Electronic grader, changes names of functions and default for if instructor has grading (#1026)

* add sorting options for labs, default viewing options for labs

* sorting for registration and rotation grading

* sort by more than just id

* changed function names

* now user id not left aligned

* remove unneeded code

* Creating a new Numeric Gradeable has a total points row (#1025)

* Added a row for total points.

* total row is functional

* is updated when you make a gradeable from a template

* made suggested changes and fixed a typo.

* all updates made

* corrected some unnecessary changes

* First draft of check_everything.py -- checks directory owner/group/permissions (#1030)

* just starting

* progress

* a bit more

* edits to check_everything script

* more checks

* change requests

* rearrange logic

* add to travis after_script

* Extra credit colors (#1024)

* Penalty, extra, and normal credit look diffirent now

* Extra credit and penalty have colors and icons

* The icons are now on the left

* Create Gradeable:  check for invalid dates and gradeable_ids (#1021)

* Added checks for the form for the user

* updated with requested changes

* updated with requested changes

* check for hwcron user at the top of grade_students.sh (#1044)

* Update sample apache configuration for Ubuntu 16.04 configuration (#1020)

* Improved checking of autograding execution of local and system programs (#1050)

replace 'assignment' with 'gradeable' in grade_students.sh (improves consistency)

better error message for attempted use of system programs that are not on the whitelist

now scrapes the config.json for names of compiled_executables to improve the check for local programs

if the config.json uses an unacceptable local, now it complains at BUILD time (not delaying to submission debugging as before)

fix autograding test failures

disabled seccomp because it's broken :( will make a new issue & fix that next, in a new PR #1051.

* remove PHP 5.5 (#1054)

* Added very rough version of window_utils

* Added support for screenshotting. Separated window code into window_utils

Author:   Evan Maicus <emaicus@outlook.com>

* Added support for delays and typed commands

* Added detection of window name based on child pid

* Added click and drag support. Added mouse support.

* Added error checking and documentation

* Large overhaul of click and drag.

* Added comments, added alt button support in click and drag, tested in prep for pull request.

* Added support for decimal delays.

* Refactored comments, fixed spelling issues.

* Fixed formatting, hacked seccomp

* Fixed mislabeled allowed system programs
bmcutler pushed a commit that referenced this pull request Jul 19, 2017
… in Electronic Gradeable Uploads (#1209)

* Added directories to path in execute.cpp. Added gfx installs and cmake permissions in install_system.sh

* added php zip file fix

* Added very rough version of window_utils

* Added support for screenshotting. Separated window code into window_utils

Author:   Evan Maicus <emaicus@outlook.com>

* Added support for delays and typed commands

* Added detection of window name based on child pid

* Added click and drag support. Added mouse support.

* Added error checking and documentation

* Large overhaul of click and drag.

* Added comments, added alt button support in click and drag, tested in prep for pull request.

* Added support for decimal delays.

* add sorting options for labs, default viewing options for labs (#992)

* add sorting options for labs, default viewing options for labs

* sorting for registration and rotation grading

* sort by more than just id

* Progress on revising navigation page with submission status (#962)

progress on issue #674

* Allow user to specify whether they should stay logged in (past browser closure), defaults to true (#1014)

* Ambersands no longer get truncated (#1022)

* Gradeable layout with only numerics (#1023)

* Looks better when there are zero numeric fields

* Looks better when there are zero numeric fields

* Electronic grader, changes names of functions and default for if instructor has grading (#1026)

* add sorting options for labs, default viewing options for labs

* sorting for registration and rotation grading

* sort by more than just id

* changed function names

* now user id not left aligned

* remove unneeded code

* Creating a new Numeric Gradeable has a total points row (#1025)

* Added a row for total points.

* total row is functional

* is updated when you make a gradeable from a template

* made suggested changes and fixed a typo.

* all updates made

* corrected some unnecessary changes

* First draft of check_everything.py -- checks directory owner/group/permissions (#1030)

* just starting

* progress

* a bit more

* edits to check_everything script

* more checks

* change requests

* rearrange logic

* add to travis after_script

* Extra credit colors (#1024)

* Penalty, extra, and normal credit look diffirent now

* Extra credit and penalty have colors and icons

* The icons are now on the left

* Create Gradeable:  check for invalid dates and gradeable_ids (#1021)

* Added checks for the form for the user

* updated with requested changes

* updated with requested changes

* check for hwcron user at the top of grade_students.sh (#1044)

* Update sample apache configuration for Ubuntu 16.04 configuration (#1020)

* Improved checking of autograding execution of local and system programs (#1050)

replace 'assignment' with 'gradeable' in grade_students.sh (improves consistency)

better error message for attempted use of system programs that are not on the whitelist

now scrapes the config.json for names of compiled_executables to improve the check for local programs

if the config.json uses an unacceptable local, now it complains at BUILD time (not delaying to submission debugging as before)

fix autograding test failures

disabled seccomp because it's broken :( will make a new issue & fix that next, in a new PR #1051.

* remove PHP 5.5 (#1054)

* Added very rough version of window_utils

* Added support for screenshotting. Separated window code into window_utils

Author:   Evan Maicus <emaicus@outlook.com>

* Added support for delays and typed commands

* Added detection of window name based on child pid

* Added click and drag support. Added mouse support.

* Added error checking and documentation

* Large overhaul of click and drag.

* Added comments, added alt button support in click and drag, tested in prep for pull request.

* Added support for decimal delays.

* Refactored comments, fixed spelling issues.

* Fixed formatting, hacked seccomp

* Fixed mislabeled allowed system programs

* Added support for image diff.

* added support to view expected image file.

* fixed a regex bug in windowutils, finalized image diff functionality.

* fixed a regex bug in windowutils, finalized image diff functionality.

* checkpoint

* Got text box images working

* finished textbox images. finished image diff. fixed ta grading page image issues. fixed ta grading page error display issues.

* added borders around images.

* Added support for image resizing for textboxes. Resolved local test errors.

* formatted.

* added blue info messages and per image resizing.

* Added new autograding examples for image diffing and textbox images.

* updated travis test.

* Quick fix.

* hotfix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Option to alphabetize checkpoints by first name

5 participants