From 8c24f8d84c338de8320596c5a9b8da72c2541080 Mon Sep 17 00:00:00 2001 From: Alex AUVOLAT Date: Mon, 12 Aug 2013 21:17:29 +0200 Subject: Small presentation changes. --- design/style.css | 7 ++++--- js/liststudy.js | 4 ++-- js/reviewdesu.js | 7 ++++--- lib/study/brresults.php | 1 + lib/study/list.php | 9 +++++++-- schema.sql | 13 +++++++------ tpl/general/top.php | 2 ++ tpl/study/list.php | 20 +++++++++++++++++--- 8 files changed, 44 insertions(+), 19 deletions(-) diff --git a/design/style.css b/design/style.css index 5111d78..bb3e2ef 100644 --- a/design/style.css +++ b/design/style.css @@ -305,6 +305,7 @@ hr { margin: auto; border: 1px solid #eeeeee; background: #ffffff; + padding: 8px; } .review_item .box { @@ -317,9 +318,8 @@ hr { .review_item .boxn { border-top: 0px; - height: 74px; + height: 64px; font-size: 0.8em; - padding-top: 6px; } .review_item .boxn em { @@ -334,7 +334,7 @@ hr { .rtk_kr_q_1, .rtk_kr_a_1, .rtk_kr_q_2, .rtk_kr_a_2 { margin: 0px; padding: 0px; padding-top: 50px; } .rtk_kr_q_1, .rtk_kr_a_2 span { font-size: 4em; font-family: "IPAMincho", serif; } -.rtk_kr_q_2, .rtk_kr_a_1 span { font-size: 1.2em; } +.rtk_kr_q_2, .rtk_kr_a_1 span { font-size: 1.3em; } /* blog */ @@ -369,3 +369,4 @@ hr { margin-bottom: 10px; font-size: 1.0em; } + diff --git a/js/liststudy.js b/js/liststudy.js index 5ff6aef..ab6eede 100644 --- a/js/liststudy.js +++ b/js/liststudy.js @@ -88,7 +88,7 @@ function show_contents_table() { if (notes[items[i].info[0]]) { var note = notes[items[i].info[0]]; html += '' + note + ''; + + (items[i].info.length) + '">' + note.replace(/\|\|/g, '
') + ''; } } html += ''; @@ -135,7 +135,7 @@ function show_reviews_table() { function edit_note(id) { var idd = items[id].info[0]; - var note = prompt("Add note for item: ", notes[idd] || ''); + var note = prompt("Add note for item:\n(you might want to add a long note, so I'm adding this text to make the prompt box bigger)", notes[idd] || ''); if (note != null) notes[idd] = note; if (notes[idd] == '') delete notes[idd]; show_contents_table(); diff --git a/js/reviewdesu.js b/js/reviewdesu.js index 6750b4b..d93bda4 100644 --- a/js/reviewdesu.js +++ b/js/reviewdesu.js @@ -96,7 +96,8 @@ function show_answer() { html = '

Question ' + question_nb + ' of ' + total + '

'; html += '
'; html += '
' + question.answer + '
'; - html += '
' + (notes[question.key] || 'click to add note...') + '
'; + html += '
' + + (notes[question.key] || 'click to add note...').replace(/\|\|/g, '
') + '
'; html += '

'; html += ''; html += '

'; @@ -113,10 +114,10 @@ function answer_question(a) { function edit_note() { var idd = question.key; - var note = prompt("Add note for item:", notes[idd] || ''); + var note = prompt("Add note for item:\n(you might want to add a long note, so I'm adding this text to make the prompt box bigger)", notes[idd] || ''); if (note != null) notes[idd] = note; if (notes[idd] == '') delete notes[idd]; - $("notebox").innerHTML = (notes[idd] || 'click to add note...'); + $("notebox").innerHTML = (notes[idd] || 'click to add note...').replace(/\|\|/g, '
'); new Ajax.Request('index.php?p=brresults-study-' + batchid, { method: 'post', diff --git a/lib/study/brresults.php b/lib/study/brresults.php index 9bbafac..93ebfdf 100644 --- a/lib/study/brresults.php +++ b/lib/study/brresults.php @@ -26,6 +26,7 @@ if ($info["bsid"] == 0) { } if (isset($_POST['results']) && isset($_POST['score'])) { + sql("UPDATE batch_study SET before_last_review = last_review WHERE id = " . $info['bsid']); sql("INSERT INTO batch_review(user, batch, results, score, date) ". "VALUES(" . $user['id'] . ", $batchid, '" . escs(esca($_POST['results'])) . "', " . intval($_POST['score']) . ", NOW())"); sql("UPDATE batch_study SET last_review = " . mysql_insert_id() . " WHERE id = " . $info['bsid']); diff --git a/lib/study/list.php b/lib/study/list.php index 928e253..bebffa6 100644 --- a/lib/study/list.php +++ b/lib/study/list.php @@ -26,11 +26,16 @@ $fdefaults = array( $batches = array(); $n = sql( "SELECT batches.id AS id, batches.name AS name, ". - "batch_study.id AS bs_id, batch_review.date AS lr_date, batch_review.score AS lr_score ". + "batch_study.id AS bs_id, ba.date AS lr_date, TO_DAYS(NOW()) - TO_DAYS(ba.date) AS lr_days, ". + "ba.score AS lr_score, bc.date AS blr_date, bc.score AS blr_score, ". + "COUNT(bb.id) AS num_reviews ". "FROM batches ". "LEFT JOIN batch_study ON batch_study.batch = batches.id AND batch_study.user = " . $user['id'] . " " . - "LEFT JOIN batch_review ON batch_review.id = batch_study.last_review ". + "LEFT JOIN batch_review ba ON ba.id = batch_study.last_review ". + "LEFT JOIN batch_review bb ON bb.batch = batches.id AND bb.user = " . $user['id'] . " ". + "LEFT JOIN batch_review bc ON bc.id = batch_study.before_last_review ". "WHERE batches.list = " . $study['listid'] . " " . + "GROUP BY batches.id ". "ORDER BY " . get_filter("order") . " " . get_filter("way") ); while ($b = mysql_fetch_assoc($n)) $batches[] = $b; diff --git a/schema.sql b/schema.sql index e98f1d4..0efc1d5 100644 --- a/schema.sql +++ b/schema.sql @@ -3,7 +3,7 @@ -- http://www.phpmyadmin.net -- -- Client: localhost --- Généré le: Sam 10 Août 2013 à 15:18 +-- Généré le: Lun 12 Août 2013 à 18:25 -- Version du serveur: 5.5.32-MariaDB-log -- Version de PHP: 5.4.17 @@ -85,6 +85,7 @@ CREATE TABLE IF NOT EXISTS `batch_study` ( `batch` int(11) NOT NULL, `last_review` int(11) NOT NULL, `notes_json` text NOT NULL, + `before_last_review` int(11) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `batch_user` (`user`,`batch`), KEY `user_idx` (`user`), @@ -157,7 +158,7 @@ CREATE TABLE IF NOT EXISTS `cards` ( UNIQUE KEY `unique_name` (`deck`,`name`), UNIQUE KEY `unique_number` (`deck`,`number`), KEY `deck_idx` (`deck`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- @@ -173,7 +174,7 @@ CREATE TABLE IF NOT EXISTS `card_study` ( `next_review` date NOT NULL, PRIMARY KEY (`id`), KEY `deck_study` (`deck_study`,`card`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- @@ -190,7 +191,7 @@ CREATE TABLE IF NOT EXISTS `decks` ( PRIMARY KEY (`id`), UNIQUE KEY `unique_name` (`owner`,`name`), KEY `owner_idx` (`owner`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- @@ -209,7 +210,7 @@ CREATE TABLE IF NOT EXISTS `deck_study` ( UNIQUE KEY `unique_user_deck` (`user`,`deck`), KEY `user_idx` (`user`), KEY `deck_idx` (`deck`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- @@ -297,7 +298,7 @@ CREATE TABLE IF NOT EXISTS `notes` ( `public` tinyint(1) NOT NULL, PRIMARY KEY (`id`), KEY `owner` (`owner`,`parent`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; diff --git a/tpl/general/top.php b/tpl/general/top.php index 2eb0862..2e73057 100644 --- a/tpl/general/top.php +++ b/tpl/general/top.php @@ -18,6 +18,7 @@ global $user, $apps; //These might be hidden because this page is called from sq > + +

diff --git a/tpl/study/list.php b/tpl/study/list.php index c44e45e..8d240fb 100644 --- a/tpl/study/list.php +++ b/tpl/study/list.php @@ -3,11 +3,12 @@ $title = "Studying " . $study['listowner'] . ':' . $study['listname']; require("tpl/general/top.php"); + echo ''; echo ''; -echo ''; +echo '
Batch nameactionslast testscore
'; foreach ($batches as $batch) { $color = ""; if ($batch['lr_date']) { @@ -23,12 +24,25 @@ foreach ($batches as $batch) { } if ($color != "") $color = ' style="background-color: ' . $color . '"'; + $days_color = ($batch['lr_days'] >= 30 ? "#BFBFBF" : + ($batch['lr_days'] >= 20 ? "#C7C7C7" : + ($batch['lr_days'] >= 14 ? "#CFCFCF" : + ($batch['lr_days'] >= 10 ? "#D7D7D7" : + ($batch['lr_days'] >= 7 ? "#DFDFDF" : + ($batch['lr_days'] >= 5 ? "#E7E7E7" : + ($batch['lr_days'] >= 3 ? "#EFEFEF" : + ($batch['lr_days'] >= 1 ? "#F7F7F7" : "#FFFFFF")))))))); + $dc = ($batch['lr_date'] ? ' style="background-color: ' . $days_color .'"' : ''); echo ''; echo ''; echo ''; - echo ''; - echo '' . ($batch['lr_date'] ? $batch['lr_score'] . '/100' : 'N/A') . ''; + echo ''; + echo '' . ($batch['lr_date'] ? $batch['lr_date'] : "never") . ''; + echo '' . ($batch['lr_date'] ? $batch['lr_score'] . '/100' : 'N/A') . + ($batch['blr_date'] ? ($batch['lr_score'] > $batch['blr_score'] ? '' : + ($batch['lr_score'] < $batch['blr_score'] ? '' : + '')) : '') . ''; echo ''; } echo '
Batch nameactionstestslast testscore
' . $batch['name'] . 'view | test' . ($batch['lr_date'] ? $batch['lr_date'] : "never") . '' . $batch['num_reviews'] . '
'; -- cgit v1.2.3