Smart submit page
Review Request #71 - Created Feb. 28, 2009 and submitted
Information | |
---|---|
Bogdan-Cristian Tătăroiu | |
infoarena | |
Reviewers | |
hackers | |
Ticket 366: http://hackers.devnet.ro/ticket/366
-
trunk/common/job.php (Diff revision 1) -
Use "concurs" instead of "runda".
-
trunk/common/job.php (Diff revision 1) -
"concurs" here also.
-
trunk/common/job.php (Diff revision 1) -
What happens to old jobs that don't have a round?
-
trunk/www/controllers/json.php (Diff revision 1) -
Add a FIXME here, we need to refactor this.
-
trunk/www/controllers/submit.php (Diff revision 1) -
Use request() in all of them.
Review request changed
Change Summary:
Done what Mircea said. Fix submitting of new tasks (which don't have any rounds).
Diff: |
Revision 2 (+185 -56) |
---|
Hi! This is a good patch and an important step towards decent rankings and stats.
-
trunk/common/db/task.php (Diff revision 2) -
Extend comment with "running round ids that include this task and $user_id is allowed to submit", otherwise it's just a filtered task_get_parent_rounds()
-
trunk/common/db/task.php (Diff revision 2) -
You shouldn't use identity_can() in common/*. Consider passing a user_id instead.
-
trunk/common/job.php (Diff revision 2) -
Trailing whitespace.
-
trunk/common/task.php (Diff revision 2) -
I think this function should go inside www/ as it depends on $_SESSION and identity_can() and thus requires a www environment. Moreover, it contains UI bits such as "title" => "[ Alegeti runda ]" which are hardly "business logic." :)
-
trunk/common/task.php (Diff revision 2) -
Maintain coding style within files. {
-
trunk/www/controllers/json.php (Diff revision 2) -
You cannot redirect(home) in JSON controllers since all requests are coming from XmlHttpRequest objects and they all expect JSON output. flash() works but probably not as intended. This will store a flash message in the server session and will display it on the next page that the user navigates to. Bad AJAX requests should end with die_http_error(...).
-
trunk/www/controllers/submit.php (Diff revision 2) -
Bleah... this is so contorted! isset($rounds) == True if.f. request_is_post() and $errors in safe_job_submit(...) and !$error in task_id... I think it's nicer to just build $view as the condition tree above executes.
-
trunk/www/controllers/submit.php (Diff revision 2) -
views/submit.php doesn't seem to display a submit warning (task in multiple rounds) even though we might display a pre-selected task and round due to validation errors. Maybe refactoring some <form> code in macro_tasksubmit helps.
-
trunk/www/macros/macro_tasksubmit.php (Diff revision 2) -
No inline styles. :)
-
trunk/www/static/js/submit.js (Diff revision 2) -
Does it work in IE?
-
trunk/www/static/js/submit.js (Diff revision 2) -
OMG! Tabs? :)
-
trunk/www/static/js/submit.js (Diff revision 2) -
typo
-
trunk/www/views/submit.php (Diff revision 2) -
We do (almost) the same in the submit macro. Is it possible to refactor this bit?
This is good work! I just wrote two comment replies. Other than those, this is ready for submission.