From 2d40b5722dff5d7291c5fcdaad85648dd9a765fb Mon Sep 17 00:00:00 2001 From: David Anderson Date: Thu, 3 Jan 2008 17:37:38 +0000 Subject: [PATCH] - web: fix broken link for profile like/don't like. TODO: currently these don't do anything useful. Fix this. svn path=/trunk/boinc/; revision=14461 --- checkin_notes | 7 +++++++ db/bolt_schema.sql | 28 +++++++++++++++++++++++----- html/inc/bolt_xset.inc | 26 ++++++++++++++++---------- html/inc/profile.inc | 4 ++-- html/user/bolt_sched.php | 2 +- 5 files changed, 49 insertions(+), 18 deletions(-) diff --git a/checkin_notes b/checkin_notes index edc8588b75..24aaa5674a 100644 --- a/checkin_notes +++ b/checkin_notes @@ -69,3 +69,10 @@ David Jan 3 2008 update_profile_pages.php tools/ make_project + +David Jan 3 2008 + - web: fix broken link for profile like/don't like. + TODO: currently these don't do anything useful. Fix this. + + html/inc/ + profile.inc diff --git a/db/bolt_schema.sql b/db/bolt_schema.sql index 07bee7f343..be1f30704b 100644 --- a/db/bolt_schema.sql +++ b/db/bolt_schema.sql @@ -69,23 +69,41 @@ create table bolt_exercise_result ( primary key(id) ); --- represents the result of an exercise set +-- represents the result of a completed exercise set, +-- where "completed" means the student clicked Next on the final answer page. +-- This is slightly redundant - +-- it could be reconstructed from the individual exercise results - +-- but this way makes it easier for analytics to treat exercise sets as units. -- -create table bolt_exercise_set_result ( +create table bolt_xset_result ( id integer not null auto_increment, + create_time integer not null, + user_id integer not null, + course_id integer not null, + name varchar(255) not null, + -- logical name of result set unit score double not null, view_id integer not null, -- the answer page of last exercise in set - name varchar(255) not null, - -- logical name of result set unit primary key(id) ); +-- represents a refresh/repeat of an exercise set, +-- either pending (not due yet), +-- due but not started, or in progress. +-- create table bolt_refresh ( id integer not null auto_increment, + create_time integer not null, + user_id integer not null, + course_id integer not null, + name varchar(255) not null, + -- logical name of result set unit + last_view_id integer not null, + -- if refresh is in progress, the last view set_result_id integer not null, -- most recent result for this set due_time integer not null, - -- when to trigger review + -- when refresh will be due primary key (id) ); diff --git a/html/inc/bolt_xset.inc b/html/inc/bolt_xset.inc index d5395d8903..d94edef54d 100644 --- a/html/inc/bolt_xset.inc +++ b/html/inc/bolt_xset.inc @@ -15,10 +15,7 @@ class BoltExerciseSet extends BoltUnit { // the scheduler calls this when an exercise in this set // has just been graded. - // - record the score - // - if this is the last exercise in the set, - // create exercise_set_result record - // and optionally create or update bolt_refresh record + // - record the score in our state structure // - return a structure saying what navigation info to show: // - review // - repeat now @@ -28,13 +25,22 @@ class BoltExerciseSet extends BoltUnit { $state_rec = $iter->state[$this->name]; $number_shown = $state_rec['number_shown']; $state_rec['scores'][$number_shown] = $score; - if ($number_shown == $this->number) { - $is_last = false; - return; + $is_last = ($number_shown == $this->number); + if ($is_last) { + } else { } - $is_last = true; - BoincResult::insert(""); - BoincRefresh::replace(""); + } + + // The user clicked "Next" on last answer page, + // so this exercise set is now "completed". + // - create exercise_set_result record + // - optionally create or update bolt_refresh record + // + function completed($score, $view_id) { + $now = time(); + $id = BoincXsetResult::insert("(create_time, user_id, course_id, name, score, view_id) values ($now, $user->id, $course->id, '$this->name', $score, $view_id)"); + $due_time = $now + 100000; + BoincRefresh::replace("create_time=$now, user_id=$user->id, course_id=$course->id, name='$this->name', set_result_id=$id, due_time=$due_time"); } function walk(&$iter, $incr, &$frac_done) { diff --git a/html/inc/profile.inc b/html/inc/profile.inc index 8bd643d9ee..f66c8aa376 100644 --- a/html/inc/profile.inc +++ b/html/inc/profile.inc @@ -228,11 +228,11 @@ function show_profile($user, $logged_in_user, $screen_mode = false) { row1("Your feedback on this profile"); row2( "Recommend this profile for User of the Day:", - "I like this profile" + "I id&vote=recommend>like this profile" ); row2( "Alert administrators to an offensive profile:", - "I don't like this profile" + "I id&vote=reject>don't like this profile" ); } } diff --git a/html/user/bolt_sched.php b/html/user/bolt_sched.php index 35bd881b6d..e687024764 100644 --- a/html/user/bolt_sched.php +++ b/html/user/bolt_sched.php @@ -75,7 +75,7 @@ function create_view($user, $course, $iter, $mode, $prev_view_id) { function show_finished_page($course, $view_id, $prev_view_id) { page_head(null); if (function_exists('bolt_header')) bolt_header("Course completed"); - echo "Congratulation - you have completed this course."; + echo "Congratulations - you have completed this course."; $prev = "id&action=prev&view_id=$view_id><< Prev"; echo "