Skip to content

Commit

Permalink
Interaction counts and feedback averages, both by course
Browse files Browse the repository at this point in the history
  • Loading branch information
hbiede committed Aug 4, 2020
1 parent 843c307 commit e0be455
Show file tree
Hide file tree
Showing 19 changed files with 1,425 additions and 12 deletions.
3 changes: 1 addition & 2 deletions app/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@
"jsx": true
},
"ecmaVersion": 2018,
"sourceType": "module",
"tsconfigRootDir": "."
"sourceType": "module"
},
"plugins": [
"button-label-required",
Expand Down
3 changes: 2 additions & 1 deletion app/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ default: clean local_build upload
local_build:
npm run eslint
npm run build
rm -rf ./build/.idea

upload:
ssh [email protected] "rm -rf ~/public_html/LA-Feedback"
scp -r ./build [email protected]:~/public_html/LA-Feedback
ssh [email protected] "mkdir ~/public_html/LA-Feedback/log; chmod -R 755 public_html/LA-Feedback/*; chmod 700 public_html/LA-Feedback/data/"

clean:
rm -rf ./.idea
rm -rf ./build

11 changes: 11 additions & 0 deletions app/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "la-feedback-system",
"version": "1.2.1",
"version": "1.3.0",
"private": true,
"license": "Apache-2.0",
"description": "A website to gather feedback from students after interactions with LAs",
Expand Down Expand Up @@ -49,7 +49,7 @@
"build": "react-scripts build",
"eject": "react-scripts eject",
"test": "react-scripts test",
"eslint": "eslint . --ext .js,.jsx,.ts,.tsx",
"eslint": "eslint . --ext .ts,.tsx",
"prettify": "npx prettier --write ."
},
"eslintConfig": {
Expand Down
2 changes: 0 additions & 2 deletions app/public/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@

include_once 'sqlManager.php';

session_start();

ini_set('error_log', './log/admin.log');

function get_time_to_complete() {
Expand Down
25 changes: 25 additions & 0 deletions app/public/averages.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

include_once 'sqlManager.php';

ini_set('error_log', './log/times.log');

function get_averages() {
$conn = get_connection();
$ps = $conn->prepare('SELECT course, AVG(rating) AS avg FROM feedback LEFT JOIN interactions i on ' .
'feedback.interaction_key = i.interaction_key WHERE time_of_interaction >= (CURRENT_DATE() - INTERVAL 7 DAY) ' .
'GROUP BY course;');
$returnVal = [];
if ($ps) {
$ps->execute();
$result = $ps->get_result();
while ($row = $result->fetch_assoc()) {
array_push($returnVal, $row);
}
$ps->close();
}
$conn->close();
return $returnVal;
}

echo json_encode(get_averages());
23 changes: 23 additions & 0 deletions app/public/times.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

include_once 'sqlManager.php';

ini_set('error_log', './log/times.log');

function get_times() {
$conn = get_connection();
$ps = $conn->prepare('SELECT time_of_interaction, course FROM interactions ORDER BY time_of_interaction;');
$returnVal = [];
if ($ps) {
$ps->execute();
$result = $ps->get_result();
while ($row = $result->fetch_assoc()) {
array_push($returnVal, $row);
}
$ps->close();
}
$conn->close();
return $returnVal;
}

echo json_encode(get_times());
4 changes: 2 additions & 2 deletions app/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ function App() {
// No Deps == componentDidMount
}, []);

const hasResponse =
(response && response.content.trim().length !== 0) ?? false;
const hasResponse: boolean =
(response && response?.content?.trim().length !== 0) ?? false;

return (
<div className="App">
Expand Down
1 change: 1 addition & 0 deletions app/src/CHANGELOG.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"changes": [
"## 1.3.0\n- Chart interactions based on hour of the day\n- Display the average feedback for the last 7 days based on course",
"## 1.2.1\n- Highlight borderline ratings in admin table",
"## 1.2.0\n- Convert to Redux state management (using Zustand)\n- Implement Dispatch\n- Add version check",
"## 1.1.2\n- Mark low ratings on admin table",
Expand Down
Loading

0 comments on commit e0be455

Please sign in to comment.