Skip to content

Commit

Permalink
Merge pull request #34 from gelic-idealab/dev
Browse files Browse the repository at this point in the history
Data export page, About page and learn more button, Course sidebar fix
  • Loading branch information
parseccentric authored Aug 3, 2021
2 parents a1799a6 + a43c735 commit ba7f526
Show file tree
Hide file tree
Showing 22 changed files with 371 additions and 156 deletions.
20 changes: 17 additions & 3 deletions backend/controller/data.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const express = require("express");
const { getAllInteractions, getAllRaw } = require("../service/data");
const { getAllInteractions, getAllRawCapture, getAllRawLab, getAllRawCourse } = require("../service/data");
const dataController = express.Router();


Expand All @@ -14,10 +14,24 @@ dataController.get("/interactions",
res.status(200).json(results.data);
});

dataController.get("/export/raw/:captureId",
dataController.get("/export/raw/capture/:captureId",
async (req, res) => {
const { captureId } = req.params;
let results = await getAllRaw(captureId);
let results = await getAllRawCapture(captureId);
res.status(200).json(results.data);
});

dataController.get("/export/raw/lab/:labId",
async (req, res) => {
const { labId } = req.params;
let results = await getAllRawLab(labId);
res.status(200).json(results.data);
});

dataController.get("/export/raw/course/:courseId",
async (req, res) => {
const { courseId } = req.params;
let results = await getAllRawCourse(courseId);
res.status(200).json(results.data);
});

Expand Down
4 changes: 2 additions & 2 deletions backend/controller/lab.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ labController.get("/",
// get list of Lab captures
labController.get("/captures",
async (req, res) => {
const { courseId } = req.query;
const { labId } = req.query;
const results = await getCaptures({
courseId,
labId,
});
res.status(results.code || 200).json(results.data);
});
Expand Down
23 changes: 19 additions & 4 deletions backend/query/data.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
const getAllInteractions = `SELECT * FROM KP_Interactions WHERE capture_id IS NOT NULL`
const getRawPos = `SELECT * FROM positions p JOIN captures c ON p.session_id = c.session_id WHERE c.capture_id = ?`;
const getRawInt = `SELECT * FROM interactions i JOIN captures c ON i.session_id = c.session_id WHERE c.capture_id = ?`;
const getAllInteractions = `SELECT * FROM KP_Interactions WHERE capture_id IS NOT NULL`;

module.exports = { getAllInteractions, getRawPos, getRawInt }
const getRawPosCapture = `SELECT * FROM positions p WHERE capture_id = ?`;
const getRawIntCapture = `SELECT * FROM interactions i WHERE capture_id = ?`;

const getRawPosLab = `SELECT * FROM positions WHERE session_id = ?`;
const getRawIntLab = `SELECT * FROM interactions WHERE session_id = ?`;

const getRawPosCourse = `SELECT * FROM positions p JOIN KP_Lab l ON p.session_id = l.session_id WHERE l.course_id = ?`;
const getRawIntCourse = `SELECT * FROM interactions i JOIN KP_Lab l ON i.session_id = l.session_id WHERE l.course_id = ?;`;

module.exports = {
getAllInteractions,
getRawPosCapture,
getRawIntCapture,
getRawPosLab,
getRawIntLab,
getRawPosCourse,
getRawIntCourse
}
6 changes: 2 additions & 4 deletions backend/query/lab.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,8 @@ WHERE session_id = ?;

const capturesQuery = `
SELECT *
FROM KP_Lab l
JOIN captures c
WHERE l.session_id = c.session_id
AND l.course_id = ?
FROM captures
WHERE session_id = ?;
`

module.exports = {
Expand Down
29 changes: 25 additions & 4 deletions backend/service/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,37 @@ const getAllInteractions = async() => {
}
}

const getAllRaw = async(captureId) => {
const getAllRawCapture = async(id) => {
const results = {}
results.pos = await pool.execute(dataQuery.getRawPos, [captureId]);
results.int = await pool.execute(dataQuery.getRawInt, [captureId]);
results.pos = await pool.execute(dataQuery.getRawPosCapture, [id]);
results.int = await pool.execute(dataQuery.getRawIntCapture, [id]);
return {
data: results
}
}

const getAllRawLab = async(id) => {
const results = {}
results.pos = await pool.execute(dataQuery.getRawPosLab, [id]);
results.int = await pool.execute(dataQuery.getRawIntLab, [id]);
return {
data: results
}
}

const getAllRawCourse = async(id) => {
const results = {}
results.pos = await pool.execute(dataQuery.getRawPosCourse, [id]);
results.int = await pool.execute(dataQuery.getRawIntCourse, [id]);
return {
data: results
}
}


module.exports = {
getAllInteractions,
getAllRaw
getAllRawCapture,
getAllRawLab,
getAllRawCourse
};
6 changes: 3 additions & 3 deletions backend/service/lab.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,11 @@ const deleteLab = async({labId}) => {
}
}

// Get captures for the specific course id
const getCaptures = async ({ courseId }) => {
// Get captures for the specific lab id
const getCaptures = async ({ labId }) => {
const results = await pool.execute(
labQuery.capturesQuery,
[courseId || 0]
[labId || 0]
);
const captures = results[0];
return {
Expand Down
3 changes: 2 additions & 1 deletion frontend/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
node_modules
*.local
.env.development
.env.production
.env.production
dist
2 changes: 1 addition & 1 deletion frontend/package-lock.json

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

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added frontend/src/assets/img/rusa-chatstaff.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added frontend/src/assets/img/rusa-libraryh3lp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added frontend/src/assets/img/rusa-logo-large.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 5 additions & 2 deletions frontend/src/components/Layout/SideBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@
:append-icon-name="showCourses ? 'mdi-menu-down' : 'mdi-menu-left'"
@click.native="switchShowCourses"
/>
<!-- TODO -- wrap the following so that menu items only show if showCourses is true -->
<SideBarMenuItem
v-if="showCourses"
v-show="showSideBarCourseList"
v-for="course in courseList"
:key="course.courseId"
:title="course.courseNo"
Expand Down Expand Up @@ -67,12 +68,14 @@ export default {
user: this.$store.getters.user,
logoPath: require("../../assets/img/komodo-logo-white.svg"),
courseList: this.$store.getters.courses.sort((a, b) => (a.courseNo > b.courseNo) ? 1 : -1),
showCourses: false
showCourses: false,
showSideBarCourseList: false
}
},
methods: {
switchShowCourses() {
this.showCourses = !this.showCourses;
this.showSideBarCourseList = !this.showSideBarCourseList;
},
goToAccountPage() {
this.$router.push({
Expand Down
Loading

0 comments on commit ba7f526

Please sign in to comment.