Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Priority Queue #405

Merged
merged 34 commits into from
Nov 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
4b75c98
screwing around
Sep 13, 2020
c6a0e40
fsm screwing around
Sep 14, 2020
0dffd42
fixing new limbo status references
Sep 17, 2020
72b072c
delete xstate
Sep 17, 2020
21fbe61
Merge branch 'master' into dc-limbo-fsm
Sep 17, 2020
22ef6ea
added question integration and cleanedup
Sep 17, 2020
d924855
actually close queues :|
Sep 17, 2020
5fb89bd
imports
Sep 17, 2020
c129276
fsm status check in PATCH endpoitn
Sep 17, 2020
f9054b5
list questions response
Oct 18, 2020
2de08d4
Refactor getQuestions to get new questions response
ofloody Oct 18, 2020
1e5ee08
Merge branch 'master' into dc-limbo-fsm
Oct 18, 2020
b31ccb1
Got App to almost work
ofloody Oct 18, 2020
7b6760f
got the app back to a workable state with questions refactor
NEUDitao Oct 25, 2020
34cacc3
Got core functionality working for frontend :)
NEUDitao Oct 25, 2020
1054066
cypress tests for priority queue on student side
NEUDitao Nov 1, 2020
3a04824
cypress tests for priority queue on TA side
NEUDitao Nov 1, 2020
7dd6254
allowed for student questsiont o be deleted more in FSM
NEUDitao Nov 1, 2020
025ab69
made test to prove student can leave priority queue
NEUDitao Nov 1, 2020
25dd547
Merge remote-tracking branch 'origin/master' into dc-limbo-fsm
NEUDitao Nov 1, 2020
c15e2e3
missed one
NEUDitao Nov 1, 2020
039a037
refactored questions to be filtered instead of three separate db queries
NEUDitao Nov 2, 2020
b7fe734
added tooltip to TA's priority queue
NEUDitao Nov 2, 2020
4195dcd
Merge remote-tracking branch 'origin/master' into dc-limbo-fsm
Nov 2, 2020
bdd2287
Prettified Code!
dajinchu Nov 2, 2020
25c9f4b
made the tooltips on student banners as asked during standup
NEUDitao Nov 8, 2020
3f38903
styled components
NEUDitao Nov 8, 2020
446248f
will feedback
NEUDitao Nov 8, 2020
38492b2
new colors
NEUDitao Nov 13, 2020
d1fe092
removed some TODOs
NEUDitao Nov 13, 2020
ad88889
cypress fix
NEUDitao Nov 13, 2020
6401447
changed back
NEUDitao Nov 14, 2020
cacecc0
Revert "changed back"
NEUDitao Nov 14, 2020
ea3bae2
fix queue query
Nov 14, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
70 changes: 35 additions & 35 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
# The branches below must be a subset of the branches above
branches: [master]
schedule:
- cron: '0 17 * * 4'
- cron: "0 17 * * 4"

jobs:
analyze:
Expand All @@ -24,48 +24,48 @@ jobs:
matrix:
# Override automatic language detection by changing the below list
# Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python']
language: ['javascript']
language: ["javascript"]
# Learn more...
# https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection

steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
# We must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head.
fetch-depth: 2
- name: Checkout repository
uses: actions/checkout@v2
with:
# We must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head.
fetch-depth: 2

# If this run was triggered by a pull request event, then checkout
# the head of the pull request instead of the merge commit.
- run: git checkout HEAD^2
if: ${{ github.event_name == 'pull_request' }}
# If this run was triggered by a pull request event, then checkout
# the head of the pull request instead of the merge commit.
- run: git checkout HEAD^2
if: ${{ github.event_name == 'pull_request' }}

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release
#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
2 changes: 1 addition & 1 deletion .github/workflows/cypress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
record: ${{ github.event_name == 'pull_request' }}
start: yarn ci:start
wait-on: "http://localhost:3000"
command-prefix: 'yarn run percy exec'
command-prefix: "yarn run percy exec"
env:
CYPRESS_USE_LIVE_API: true
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
## Ensure no new changes have been pushed in the time we spent building
- run: git fetch && echo "::set-output name=version::$(git rev-parse origin/master)"
id: post-version
- if: steps.pre-version.outputs.version == steps.post-version.outputs.version
- if: steps.pre-version.outputs.version == steps.post-version.outputs.version
uses: EndBug/add-and-commit@v4
with:
add: "packages"
Expand Down
141 changes: 141 additions & 0 deletions cypress/integration/student/cant_find_test.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
describe("can't be found", () => {
beforeEach(() => {
// Set the state
cy.request("POST", "/api/v1/seeds/createUser", { role: "student" })
.then((res) => res.body)
.as("student");

cy.get("@student").then((student) => {
cy.request("POST", "/api/v1/seeds/createQueue", {
courseId: student.course.id,
allowQuestions: true,
})
.then((res) => res.body)
.as("queue");
});

//creates TA
cy.get("@student").then((student) => {
cy.request("POST", "/api/v1/seeds/createUser", {
role: "ta",
courseId: student.course.id,
})
.then((res) => res.body)
.as("ta");
});

cy.get("@queue").then((queue) => {
cy.get("@ta").then((ta) => {
cy.visit(`/api/v1/login/dev?userId=${ta.user.id}`);

// Check the TA into the queue
cy.request(
"POST",
`/api/v1/courses/${queue.course.id}/ta_location/${queue.room}`
);
});
});

// Login the student
cy.get("@student").then((student) => {
cy.visit(`/api/v1/login/dev?userId=${student.user.id}`);
});

// Visit the queue page and create a question
cy.get("@queue").then((queue) =>
cy.visit(`/course/${queue.courseId}/queue/${queue.id}`).then(() => {
// Click "Join Queue"
cy.get("body").should("contain", "Join Queue");
cy.get('[data-cy="join-queue-button"]').click();

// Fill out the question form
cy.get("body").should("contain", "Concept");
cy.get("label").contains("Concept").click({
force: true,
});
cy.get("[data-cy='questionText']").type(
"How do I use the design recipe?"
);

// Click Submit
cy.get("[data-cy='finishQuestion']").click();
})
);

//TA opens the student's question
cy.get("@queue").then((queue) => {
cy.get("@ta").then((ta) => {
cy.visit(`/api/v1/login/dev?userId=${ta.user.id}`);

cy.get(".ant-modal-close-x").click();
// Visit the queue page
cy.visit(`/course/${queue.courseId}/queue/${queue.id}`);
});
});
});

it("Can't find student and student leaves the queue", () => {
cy.get("@queue").then((queue) => {
cy.get("@ta").then((ta) => {
cy.get("body").should("contain", "Help Next");
cy.get("button").contains("Help Next").click();

// Click Can't Find
cy.get("body").should("contain", "Can't Find");
cy.get("button").contains("Can't Find").click();

cy.get("body").should("contain", "Yes");
cy.get("button").contains("Yes").click();
});
});

// Login the student
cy.get("@student").then((student) => {
cy.visit(`/api/v1/login/dev?userId=${student.user.id}`);
});
cy.get("@queue").then((queue) =>
cy.visit(`course/${queue.courseId}/queue/${queue.id}`).then(() => {
cy.get("body").should(
"contain",
"A TA tried to help you, but couldn't reach you. Are you still in the queue? If you are, make sure you have Teams open, and rejoin the queue."
);

//cy.get(".ant-modal").should("contain", "Leave Queue");
cy.get("button").contains("Leave Queue").click();
})
);
});

it("Can't find student and student rejoins the queue", () => {
cy.get("@queue").then((queue) => {
cy.get("@ta").then((ta) => {
cy.get("body").should("contain", "Help Next");
cy.get("button").contains("Help Next").click();
// Click Can't Find
cy.get("body").should("contain", "Can't Find");
cy.get("button").contains("Can't Find").click();

cy.get("body").should("contain", "Yes");
cy.get("button").contains("Yes").click();
});
});

// Login the student
cy.get("@student").then((student) => {
cy.visit(`/api/v1/login/dev?userId=${student.user.id}`);
});
cy.get("@queue").then((queue) =>
cy.visit(`course/${queue.courseId}/queue/${queue.id}`).then(() => {
cy.get("body").should(
"contain",
"A TA tried to help you, but couldn't reach you. Are you still in the queue? If you are, make sure you have Teams open, and rejoin the queue."
);

cy.get("button").contains("Rejoin Queue").click();
cy.contains(
"You are now in a priority queue, you will be helped soon. You were last helped by User."
);
})
);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,17 @@ describe("Removed from queue", () => {
cy.visit(`course/${queue.courseId}/queue/${queue.id}`).then(() => {
cy.get("body").should(
"contain",
"You've been removed from the queue by a TA. If you have any questions, please reach out to the TA. If you'd like to join back into the queue with your previous question, click Rejoin Queue, otherwise click Leave Queue."
"A TA tried to help you, but couldn't reach you. Are you still in the queue? If you are, make sure you have Teams open, and rejoin the queue."
);

cy.get("body").should("contain", "Rejoin Queue");
cy.percySnapshot("Student Queue Page - Rejoin Queue Modal");
cy.get("button").contains("Rejoin Queue").click();

// Check that the student was sucessfully but back into the queue
cy.contains("You are 1st");
cy.contains(
"You are now in a priority queue, you will be helped soon. You were last helped by User."
);
})
);
});
Expand Down Expand Up @@ -144,69 +146,4 @@ describe("Removed from queue", () => {
})
);
});

/*
it("Can't find student and student leaves the queue", () => {

cy.get("@queue").then((queue) => {
cy.get("@ta").then((ta) => {

// Click Can't Find
cy.get("body").should("contain", "Can't Find");
cy.get("button").contains("Can't Find").click();

cy.get("body").should("contain", "Yes");
cy.get("button").contains("Yes").click();
});
});

// Login the student
cy.get("@student").then((student) => {
cy.visit(`/api/v1/login/dev?userId=${student.user.id}`);
});
cy.get("@queue").then((queue) =>
cy.visit(`course/${queue.courseId}/queue/${queue.id}`).then(() => {
cy.get("body").should(
"contain",
"A TA tried to help you, but couldn't reach you. Are you still in the queue? If you are, make sure you have Teams open, and rejoin the queue."
);

//cy.get(".ant-modal").should("contain", "Leave Queue");
cy.get("button").contains("Leave Queue").click();
})
);
});


it("Can't find student and student rejoins the queue", () => {

cy.get("@queue").then((queue) => {
cy.get("@ta").then((ta) => {

// Click Can't Find
cy.get("body").should("contain", "Can't Find");
cy.get("button").contains("Can't Find").click();

cy.get("body").should("contain", "Yes");
cy.get("button").contains("Yes").click();
});
});

// Login the student
cy.get("@student").then((student) => {
cy.visit(`/api/v1/login/dev?userId=${student.user.id}`);
});
cy.get("@queue").then((queue) =>
cy.visit(`course/${queue.courseId}/queue/${queue.id}`).then(() => {
cy.get("body").should(
"contain",
"A TA tried to help you, but couldn't reach you. Are you still in the queue? If you are, make sure you have Teams open, and rejoin the queue."
);

//cy.get("body").should("contain", "Rejoin Queue");
cy.get("button").contains("Rejoin Queue").click();
})
);
});
*/
});