Skip to content

Commit 423ad8b

Browse files
committed
Version 2.0
1 parent f40f1ea commit 423ad8b

56 files changed

Lines changed: 273 additions & 252 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// These are the changes that need to be done when upgrading the plugin from 1.0.0 to 2.0.0.
2+
3+
Change the [chained-quiz] shortcode to [triage-algorithm].
4+
5+
Change the Study ID question to a 'none' SOAP TYPE.

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,5 +66,8 @@ None yet.
6666
3. And of course you can define different results depending on the results collected in the quiz
6767

6868
# Changelog
69+
## Version 2.0
70+
- Added Dashboard functionality.
71+
6972
## Version 1.0
70-
- First public release of a triage algorithm
73+
- First public release of a triage algorithm.

SQL/multiple-choice-answers.sql

100644100755
File mode changed.

SQL/query.sql

100644100755
File mode changed.

SQL/quiz-goto-sort.sql

100644100755
File mode changed.

SQL/responses.sql

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
SELECT
2+
tCOM.id as completed_id,
3+
tQUIZ.title as algorithm_name,
4+
tCOM.datetime as response_date,
5+
tUA.answer_text as study_id,
6+
tCOM.snapshot as soap_note
7+
FROM
8+
pEbhDRZAchained_quizzes tQUIZ,
9+
pEbhDRZAchained_completed tCOM,
10+
pEbhDRZAchained_questions tQUES,
11+
pEbhDRZAchained_user_answers tUA
12+
WHERE tQUIZ.id = tCOM.quiz_id
13+
AND tQUIZ.id = tQUES.quiz_id
14+
AND tQUES.id = tUA.question_id
15+
AND tCOM.id = tUA.completion_id
16+
AND tQUES.sort_order = 1
17+
ORDER BY tCOM.datetime DESC
18+
LIMIT 1,2

SQL/soap-note.sql

100644100755
File mode changed.

chained-quiz.pot

100644100755
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# This file is distributed under the same license as the Chained Quiz package.
33
msgid ""
44
msgstr ""
5-
"Project-Id-Version: Chained Quiz 1.0.0\n"
5+
"Project-Id-Version: Chained Quiz 1.0.9.2\n"
66
"Report-Msgid-Bugs-To: http://wordpress.org/tag/chained-quiz\n"
77
"POT-Creation-Date: 2018-08-13 12:54:20+00:00\n"
88
"MIME-Version: 1.0\n"

controllers/ajax.php

100644100755
Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,20 @@
22
if( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
33
// handle all ajax
44
function chainedquiz_ajax() {
5-
$action = empty($_POST['chainedquiz_action']) ? 'answer' : $_POST['chainedquiz_action'];
65

7-
// currently just "answer" but the code will handle future versions
8-
if(!in_array($action, array('answer'))) exit;
6+
// If there is no action specified for this AJAX call, then ABORT.
7+
$action = empty($_POST['chainedquiz_action']) ? 'ABORT' : $_POST['chainedquiz_action'];
8+
if(in_array($action, array('ABORT'))) exit;
99

1010
switch($action) {
1111
// answer a question or quiz
1212
case 'answer':
13-
default:
1413
echo ChainedQuizQuizzes :: answer_question();
15-
break;
14+
break;
15+
case 'feedback':
16+
$comment = $_POST['comment'];
17+
echo ChainedQuizCompleted :: feedback($comment);
18+
break;
1619
}
1720

1821
exit;

controllers/completed.php

100644100755
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,26 @@ static function manage() {
241241

242242
include(CHAINED_PATH."/views/completed.html.php");
243243
} // end manage
244+
245+
// Generate the triage algorithm responses dashboard/table.
246+
static function view_responses() {
247+
global $wpdb;
248+
249+
$results = $wpdb->get_results(
250+
"SELECT tCOM.id as completion_id, tCOM.datetime as response_date, tQUIZ.title as algorithm_name, tUA.answer_text as study_id, tCOM.snapshot as soap_note
251+
FROM ".CHAINED_QUIZZES." tQUIZ
252+
JOIN ".CHAINED_COMPLETED." tCOM
253+
JOIN ".CHAINED_QUESTIONS." tQUES
254+
JOIN ".CHAINED_USER_ANSWERS." tUA
255+
WHERE tQUIZ.id = tCOM.quiz_id
256+
AND tQUIZ.id = tQUES.quiz_id
257+
AND tQUES.id = tUA.question_id
258+
AND tCOM.id = tUA.completion_id
259+
AND tQUES.sort_order = 1
260+
ORDER BY tCOM.datetime DESC");
261+
262+
include(CHAINED_PATH."/views/responses.html.php");
263+
}
244264

245265
// defines whether to sort by ASC or DESC
246266
static function define_dir($col, $ob, $dir) {
@@ -250,4 +270,18 @@ static function define_dir($col, $ob, $dir) {
250270
if($dir == 'asc') return 'desc';
251271
else return 'asc';
252272
}
273+
274+
// Captures feedback for a triage algorithm post-submission.
275+
static function feedback($comment) {
276+
$user_email = 'melvin@windwake.io';
277+
$subject = 'Triage Algorithm Feedback';
278+
$message = $comment;
279+
$headers = 'MIME-Version: 1.0' . "\r\n";
280+
$headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";
281+
$headers .= 'From: ' . $user_email . "\r\n";
282+
$attachments = null;
283+
284+
wp_mail($user_email, $subject, $message, $headers, $attachments);
285+
echo json_encode(array("abc"=>'Email succesful.'));
286+
}
253287
}

0 commit comments

Comments
 (0)