echo "<p>\n When multiple projects have the same postednum,\n this usually means that a single book was split into multiple projects\n to go through the rounds.\n And when this is easy to detect (titles differ only by a digit),\n this page skips over the set.\n However, a shared postednum could also happen\n when a project was mistakenly assigned another project's postednum.\n This page should help find those cases.\n</p>\n"; $res = dpsql_query("\n SELECT postednum, COUNT(*) as c\n FROM projects\n GROUP BY postednum\n HAVING c > 1\n ORDER BY postednum\n"); while (list($postednum, $count) = mysql_fetch_row($res)) { if (is_null($postednum)) { continue; } echo "<br>{$postednum}:\n"; $res2 = dpsql_query("\n SELECT nameofwork\n FROM projects\n WHERE postednum={$postednum}\n ORDER BY nameofwork\n "); $titles = array(); while (list($title) = mysql_fetch_row($res2)) { $titles[] = $title; } list($left, $middles, $right) = factor_strings($titles); if (strings_count_up($middles)) { echo "skipping '{$left}<N>{$right}'...<br>\n"; continue; } dpsql_dump_query("\n SELECT FROM_UNIXTIME(modifieddate), state, nameofwork\n FROM projects\n WHERE postednum={$postednum}\n ORDER BY nameofwork\n "); } function strings_count_up($strings) { for ($i = 0; $i < count($strings); $i++) { if ($strings[$i] == '' . ($i + 1)) { // good so far } else { return FALSE; } } return TRUE; } // vim: sw=4 ts=4 expandtab
// and then a listing (one line per page). echo "<h2>" . sprintf(_("Pages available to Mentors in round %s"), $mentoring_round->id) . "</h2>"; echo "<br>" . _("Oldest project listed first.") . "<br>"; $mentored_round = $mentoring_round->mentee_round; $result = mysql_query(project_sql($mentoring_round)); while ($proj = mysql_fetch_object($result)) { // Display project summary info echo "<br>"; $proj_url = "{$code_url}/project.php?id={$proj->projectid}"; // TRANSLATORS: format is <title> by <author>. echo "<b>" . sprintf("%1\$s by %2\$s", "<a href='{$proj_url}'>{$proj->nameofwork}</a>", $proj->authorsname) . "</b>"; echo "<br>"; dpsql_dump_query(page_summary_sql($mentored_round, $proj->projectid)); echo "<br>"; echo _('Which proofreader did each page...'); dpsql_dump_query(page_list_sql($mentored_round, $proj->projectid)); } echo "<br><br><br><hr>\n"; // XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX function project_sql($mentoring_round) { return "\n SELECT\n projectid,\n nameofwork,\n authorsname\n FROM\n projects\n WHERE\n difficulty = 'BEGINNER'\n AND\n state='{$mentoring_round->project_available_state}'\n ORDER BY\n modifieddate ASC"; } // ------------------------------------------------------------------- function page_summary_sql($mentored_round, $projectid) { global $code_url; $round_tallyboard = new TallyBoard($mentored_round->id, 'U'); list($joined_with_user_page_tallies, $user_page_tally_column) = $round_tallyboard->get_sql_joinery_for_current_tallies('u.u_id'); return "\n SELECT\n CASE WHEN u.u_privacy = " . PRIVACY_ANONYMOUS . " THEN 'Anonymous'\n ELSE CONCAT('<a href=\"" . $code_url . "/stats/members/mdetail.php?&id=',u.u_id,\n '\">',u.username,'</a>')\n END AS '" . mysql_real_escape_string(_("Proofreader")) . "',\n COUNT(1) AS '" . mysql_real_escape_string(_("Pages this project")) . "',\n {$user_page_tally_column} AS '" . mysql_real_escape_string(sprintf(_("Total %s Pages"), $mentored_round->id)) . "',\n DATE_FORMAT(FROM_UNIXTIME(u.date_created),'%M-%d-%y') AS '" . mysql_real_escape_string(_("Joined")) . "'\n FROM {$projectid} AS p\n INNER JOIN users AS u ON p.{$mentored_round->user_column_name} = u.username\n {$joined_with_user_page_tallies}\n GROUP BY p.{$mentored_round->user_column_name}"; }