nvladimiroff / CSUSeniorProject

Group 4's classroom clicker app
MIT License
0 stars 2 forks source link

Syncing the student views. #9

Closed nvladimiroff closed 8 years ago

nvladimiroff commented 8 years ago

So right now the student frontend just loads questions from the server and displays them all in row, but won't sync multiple students at all. Ideally we want to actually sync everyone together.

This probably isn't too hard to do, but I would need information from the professor view. Some kind of JSON object that has:

Then in the student view, I could just ajax request this, and then syncing everything up should be easy. I know you're still working on the professor view, Glen, so I didn't want to mess with things too much there myself.

devglen commented 8 years ago

Yes, I thought of this, in One of the tables (one of the log tables I think, I have to look at it to tell you exactly which one) there is a flag to delineate between an active question or non active question and as I parse through the questions I update that flag so you can send an Ajax request every second or so to see if the value has changed.

Also when you from the student view answers a question are you updating the answer log table? I'll be reading from that table to display statistics on the answers on the professor page.

Thanks,

Glen

Sent from my iPhone

On Apr 20, 2016, at 11:24 AM, Nick Vladimiroff notifications@github.com wrote:

So right now the student frontend just loads questions from the server and displays them all in row, but won't sync multiple students at all. Ideally we want to actually sync everyone together.

This probably isn't too hard to do, but I would need information from the professor view. Some kind of JSON object that has:

A boolean telling us if the id is even active right now. The current question an id is on. The time the question started. Then in the student view, I could just ajax request this, and then syncing everything up should be easy. I know you're still working on the professor view, Glen, so I didn't want to mess with things too much there myself.

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub

nvladimiroff commented 8 years ago

Right now I'm not updating any tables, just sending a POST request to /api/teacher/:id (that doesn't actually do anything yet) with the selected answer, but I can add that in.

devglen commented 8 years ago

I'll be committing my changes probably tonight or tomorrow, I have been holding off because I wanted to just finish it because there was only a few items left and merging sucks! Lol but I'll commit what I have tonight.

Sent from my iPhone

On Apr 20, 2016, at 11:55 AM, Nick Vladimiroff notifications@github.com wrote:

Right now I'm not updating any tables, just sending a POST request to /api/teacher/:id (that doesn't actually do anything yet) with the selected answer, but I can add that in.

— You are receiving this because you commented. Reply to this email directly or view it on GitHub

nvladimiroff commented 8 years ago

Sounds good!

devglen commented 8 years ago

Can we do Monday at 6pm 5/2 for the final presentation?

Sent from my iPhone

On Apr 20, 2016, at 12:22 PM, Nick Vladimiroff notifications@github.com wrote:

Sounds good!

— You are receiving this because you commented. Reply to this email directly or view it on GitHub

nvladimiroff commented 8 years ago

Works for me. Also did you see our grade, Glen? He took a bunch of points off for no documentation, so we're gonna have to start writing that. On Thu, Apr 21, 2016 at 5:58 PM Glen Fannin notifications@github.com wrote:

Can we do Monday at 6pm 5/2 for the final presentation?

Sent from my iPhone

On Apr 20, 2016, at 12:22 PM, Nick Vladimiroff notifications@github.com wrote:

Sounds good!

— You are receiving this because you commented. Reply to this email directly or view it on GitHub

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/nvladimiroff/CSUSeniorProject/issues/9#issuecomment-213129113

devglen commented 8 years ago

Ugh yea I saw damn him. I'll the analysis document this weekend, what exactly does he want from the "programmer guide" ?? I don't know what that means. Connor can do the user guide as it is just taking screen shots and giving instructions on how to use it. I think we can have this done by next week since I'm almost done with the coding part to advance questions from the professor view.

Sent from my iPhone

On Apr 21, 2016, at 6:00 PM, Nick Vladimiroff notifications@github.com wrote:

Works for me. Also did you see our grade, Glen? He took a bunch of points off for no documentation, so we're gonna have to start writing that. On Thu, Apr 21, 2016 at 5:58 PM Glen Fannin notifications@github.com wrote:

Can we do Monday at 6pm 5/2 for the final presentation?

Sent from my iPhone

On Apr 20, 2016, at 12:22 PM, Nick Vladimiroff notifications@github.com wrote:

Sounds good!

— You are receiving this because you commented. Reply to this email directly or view it on GitHub

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/nvladimiroff/CSUSeniorProject/issues/9#issuecomment-213129113

— You are receiving this because you commented. Reply to this email directly or view it on GitHub

nvladimiroff commented 8 years ago

I think all he wants is a rundown of how the code works and stuff. I might need to ask you stuff about the professor view, but I should at least be able to get a good start on it over the weekend. Also as soon as you commit the professor stuff, I'll be able to get syncing working and we'll be mostly done. On Thu, Apr 21, 2016 at 6:06 PM Glen Fannin notifications@github.com wrote:

Ugh yea I saw damn him. I'll the analysis document this weekend, what exactly does he want from the "programmer guide" ?? I don't know what that means. Connor can do the user guide as it is just taking screen shots and giving instructions on how to use it. I think we can have this done by next week since I'm almost done with the coding part to advance questions from the professor view.

Sent from my iPhone

On Apr 21, 2016, at 6:00 PM, Nick Vladimiroff notifications@github.com wrote:

Works for me. Also did you see our grade, Glen? He took a bunch of points off for no documentation, so we're gonna have to start writing that. On Thu, Apr 21, 2016 at 5:58 PM Glen Fannin notifications@github.com wrote:

Can we do Monday at 6pm 5/2 for the final presentation?

Sent from my iPhone

On Apr 20, 2016, at 12:22 PM, Nick Vladimiroff < notifications@github.com> wrote:

Sounds good!

— You are receiving this because you commented. Reply to this email directly or view it on GitHub

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub < https://github.com/nvladimiroff/CSUSeniorProject/issues/9#issuecomment-213129113

— You are receiving this because you commented. Reply to this email directly or view it on GitHub

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/nvladimiroff/CSUSeniorProject/issues/9#issuecomment-213131682

devglen commented 8 years ago

I'll try to finish that part tonight then and get it committed since its the last part to make the whole app complete. I'll email you as soon as i do so you know it's out there. Just let me know if you have questions about anything

Sent from my iPhone

On Apr 21, 2016, at 6:13 PM, Nick Vladimiroff notifications@github.com wrote:

I think all he wants is a rundown of how the code works and stuff. I might need to ask you stuff about the professor view, but I should at least be able to get a good start on it over the weekend. Also as soon as you commit the professor stuff, I'll be able to get syncing working and we'll be mostly done. On Thu, Apr 21, 2016 at 6:06 PM Glen Fannin notifications@github.com wrote:

Ugh yea I saw damn him. I'll the analysis document this weekend, what exactly does he want from the "programmer guide" ?? I don't know what that means. Connor can do the user guide as it is just taking screen shots and giving instructions on how to use it. I think we can have this done by next week since I'm almost done with the coding part to advance questions from the professor view.

Sent from my iPhone

On Apr 21, 2016, at 6:00 PM, Nick Vladimiroff notifications@github.com wrote:

Works for me. Also did you see our grade, Glen? He took a bunch of points off for no documentation, so we're gonna have to start writing that. On Thu, Apr 21, 2016 at 5:58 PM Glen Fannin notifications@github.com wrote:

Can we do Monday at 6pm 5/2 for the final presentation?

Sent from my iPhone

On Apr 20, 2016, at 12:22 PM, Nick Vladimiroff < notifications@github.com> wrote:

Sounds good!

— You are receiving this because you commented. Reply to this email directly or view it on GitHub

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub < https://github.com/nvladimiroff/CSUSeniorProject/issues/9#issuecomment-213129113

— You are receiving this because you commented. Reply to this email directly or view it on GitHub

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/nvladimiroff/CSUSeniorProject/issues/9#issuecomment-213131682

— You are receiving this because you commented. Reply to this email directly or view it on GitHub

devglen commented 8 years ago

I just committed my new changes. The last thing i have to implement is the completion of a session other than that everything else works.

Let me know if you need anything, in the meantime I am going to complete the analysis doc and that last coding part.

Thanks,

Glen

On Apr 21, 2016, at 6:13 PM, Nick Vladimiroff notifications@github.com wrote:

I think all he wants is a rundown of how the code works and stuff. I might need to ask you stuff about the professor view, but I should at least be able to get a good start on it over the weekend. Also as soon as you commit the professor stuff, I'll be able to get syncing working and we'll be mostly done. On Thu, Apr 21, 2016 at 6:06 PM Glen Fannin notifications@github.com wrote:

Ugh yea I saw damn him. I'll the analysis document this weekend, what exactly does he want from the "programmer guide" ?? I don't know what that means. Connor can do the user guide as it is just taking screen shots and giving instructions on how to use it. I think we can have this done by next week since I'm almost done with the coding part to advance questions from the professor view.

Sent from my iPhone

On Apr 21, 2016, at 6:00 PM, Nick Vladimiroff notifications@github.com wrote:

Works for me. Also did you see our grade, Glen? He took a bunch of points off for no documentation, so we're gonna have to start writing that. On Thu, Apr 21, 2016 at 5:58 PM Glen Fannin notifications@github.com wrote:

Can we do Monday at 6pm 5/2 for the final presentation?

Sent from my iPhone

On Apr 20, 2016, at 12:22 PM, Nick Vladimiroff < notifications@github.com> wrote:

Sounds good!

— You are receiving this because you commented. Reply to this email directly or view it on GitHub

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub < https://github.com/nvladimiroff/CSUSeniorProject/issues/9#issuecomment-213129113

— You are receiving this because you commented. Reply to this email directly or view it on GitHub

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/nvladimiroff/CSUSeniorProject/issues/9#issuecomment-213131682

— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/nvladimiroff/CSUSeniorProject/issues/9#issuecomment-213135313

nvladimiroff commented 8 years ago

So I took a look at your code, and it looks pretty good, but what do we want to do about going to the next question? Right now, the student view is on a timer; it cycles to the next question every 15 seconds, but your code just has the professor press a button for the next question.

Something is gonna have to be rewritten. Which do we want to go with?

devglen commented 8 years ago

Well, the database is already set up for the student view to be controlled by the professor clicking next. If you check my code you will see when you click next here it will update the “session_log” table for this session id to mark the “current_question_id” column with the current question Id, so what you could do is just read that value, and query the answers table for that question ID and you will get back all of the answers for that question and display them.

I think that makes more sense logically than a timer, because if the professor is explaining the question and it takes longer than 15 seconds then you won’t be synced across all viewers. Also depending on when people join the session they will all be out f sync.

On Apr 24, 2016, at 6:33 PM, Nick Vladimiroff notifications@github.com wrote:

So I took a look at your code, and it looks pretty good, but what do we want to do about going to the next question? Right now, the student view is on a timer; it cycles to the next question every 15 seconds, but your code just has the professor press a button for the next question.

Something is gonna have to be rewritten. Which do we want to go with?

— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/nvladimiroff/CSUSeniorProject/issues/9#issuecomment-214053193

nvladimiroff commented 8 years ago

I picked 15 just so I'd have some number, it didn't have to be only 15. And for the syncing stuff, that's why I wanted a start time I could query, it would be pretty easy to sync everyone up as long as I had that.

But if the database is already set up like this, then it'll probably be less work to change my code than yours. So I'll do that, it'll just take me a bit longer to finish than I thought at first.

devglen commented 8 years ago

Actually, I misspoke, you want to query the sessions table not session_log. But it would be very easy, much easier than trying to synch each user that hits the page based on a start time.

It would be one query and one ajax call.

assuming you have the session ID (which I think you do)

this is assuming your session ID is 1 or if you want to use the token that I generate and display on the professor page instead of the ID just change ID to token and pass the token value. query: select * from answers where question_id = (select current_question_id from sessions where id = 1)

then in your route you would use app.get(‘/answer/getanswers', function(request, response) { sequelize.query( 'select * from answers where question_id = (select current_question_id from sessions where id = 1)' ).then(function(data){ response.json(data); }); });

then just make the ajax call to that route and boom you have all your answers. :)

On Apr 24, 2016, at 6:46 PM, Nick Vladimiroff notifications@github.com wrote:

I picked 15 just so I'd have some number, it didn't have to be only 15. And for the syncing stuff, that's why I wanted a start time I could query, it would be pretty easy to sync everyone up as long as I had that.

But if the database is already set up like this, then it'll probably be less work to change my code than yours. So I'll do that, it'll just take me a bit longer to finish than I thought at first.

— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/nvladimiroff/CSUSeniorProject/issues/9#issuecomment-214057020

nvladimiroff commented 8 years ago

Right now my code already handles the questions, answers and current question by itself (through querying /questions/question_set) because we didn't have sessions before. I think if this was a real project, I'd gut my code and go with that, but right now it'll just be easier to throw in a setInterval that queries /sessions/questionset and updates the current question.

devglen commented 8 years ago

When we demonstrate this though I don’t want him to take off points because it doesn’t work correctly. He has been a real d bag lately about this kind of stuff. I’m sure that will be one of the questions because that is a key feature for the “clicker” app is it being in synch with what the professor is displaying. Why can’t your code query sessions table? I only ask because I am writing this analysis and design document and I put functional requirements in it one being that the professor view and student view will be synced.

Also another feature I added was reporting for each question as they are being answered, I am querying the answer_log table, so when you answer a question are you logging the answer ID in that table? When I query that table I need the answer Id and session Id (all existing columns).

On Apr 24, 2016, at 7:06 PM, Nick Vladimiroff notifications@github.com wrote:

Right now my code already handles the questions, answers and current question by itself (through querying /questions/question_set) because we didn't have sessions before. I think if this was a real project, I'd gut my code and go with that, but right now it'll just be easier to throw in a setInterval that queries /sessions/questionset and updates the current question.

— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/nvladimiroff/CSUSeniorProject/issues/9#issuecomment-214061532

nvladimiroff commented 8 years ago

Everything will be synced, don't worry. I'm having setInterval query /sessions/question_set every second, and if there's a change, I just update everything to the new question. /sessions/question_set still queries the session table. What I meant was that some chunks of my code could be simplified now that we have a sessions route, but that would take some time that we probably don't have.

It's not adding anything to the table yet, but it will be soon. The client side is all setup for it, I just need another post block and a bit of sequelize in the server code.

devglen commented 8 years ago

We may need to test this before we demonstrate it. I don’t update the question_set table at all during a session. the only updating I do is to the sessions table. So if you are looking for an update there I don’t think it will ever change, from question to question.

On Apr 24, 2016, at 7:21 PM, Nick Vladimiroff notifications@github.com wrote:

Everything will be synced, don't worry. I'm having setInterval query /sessions/question_set every second, and if there's a change, I just update everything to the new question. /sessions/question_set still queries the session table. What I meant was that some chunks of my code could be simplified now that we have a sessions route, but that would take some time that we probably don't have.

It's not adding anything to the table yet, but it will be soon. The client side is all setup for it, I just need another post block and a bit of sequelize in the server code.

— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/nvladimiroff/CSUSeniorProject/issues/9#issuecomment-214064949

nvladimiroff commented 8 years ago

No, I mean the /sessions/questionset route in sessions.js. It doesn't query the question_set table, it queries the sessions table. It gives a chunk of JSON like this: {"id":2,"token":"c82703b0-0a6a-11e6-89d9-996e2993c1a6","question_set_id":2,"current_question_id":5,"owner_id":"nickv","created":"2016-04-24T22:20:42.000Z","modified":"2016-04-24T22:24:55.000Z","status":true,"is_active":true}

devglen commented 8 years ago

Ahh I see, so how do you get the answers for the question? It seems like a very round about way of doing it as opposed to the one query but I guess its ok as long as it works. We probably should test it though so there aren’t any surprises when we demonstrate it to him. I just can’t fail this stupid class because I’m graduating and the last time I took a class by Blake everything seemed fine until the last project and I failed because of something stupid. He’s doing the same thing in 368, he gave everyone perfect scores for all the assignments but our final grade is going to be based on the final project, and if we don’t do that correctly he is for sure going to fail them.

On Apr 24, 2016, at 7:36 PM, Nick Vladimiroff notifications@github.com wrote:

No, I mean the /sessions/question_set route in sessions.js https://github.com/nvladimiroff/CSUSeniorProject/blob/master/routes/sessions.js#L27. It doesn't query the question_set table, it queries the sessions table. It gives a chunk of JSON like this: {"id":2,"token":"c82703b0-0a6a-11e6-89d9-996e2993c1a6","question_set_id":2,"current_question_id":5,"owner_id":"nickv","created":"2016-04-24T22:20:42.000Z","modified":"2016-04-24T22:24:55.000Z","status":true,"is_active":true}

— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/nvladimiroff/CSUSeniorProject/issues/9#issuecomment-214066306

devglen commented 8 years ago

I also don’t want a C lol I want an A because that what I think we deserve and I need to get a 3.5 or higher this semester and this class I counted as an A.

On Apr 24, 2016, at 7:36 PM, Nick Vladimiroff notifications@github.com wrote:

No, I mean the /sessions/question_set route in sessions.js https://github.com/nvladimiroff/CSUSeniorProject/blob/master/routes/sessions.js#L27. It doesn't query the question_set table, it queries the sessions table. It gives a chunk of JSON like this: {"id":2,"token":"c82703b0-0a6a-11e6-89d9-996e2993c1a6","question_set_id":2,"current_question_id":5,"owner_id":"nickv","created":"2016-04-24T22:20:42.000Z","modified":"2016-04-24T22:24:55.000Z","status":true,"is_active":true}

— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/nvladimiroff/CSUSeniorProject/issues/9#issuecomment-214066306

nvladimiroff commented 8 years ago

I get the answers from /questions/question_set/. And yeah, like I said this is a bit roundabout because I wrote all this code before we had sessions, so this was the only way to do it then. We just have too much to do to bother rewriting something that already works.

As long as we have all our documentation and our shit works, I'm sure we'll get an A. Also, I've been hearing pretty much everyone complain about 368. Kyle especially was pretty pissed.

nvladimiroff commented 8 years ago

Ok, syncing works and is committed now. I'll get the answers in the database probably on Wednesday. Once you finish finishing sessions, I should be able to throw that in really quick as well.