MarkUs Blog

MarkUs Developers Blog About Their Project

Remark System

without comments

My semester has been primarily refinements. During an earlier semester, as system for requesting remarks was put into place. Under that system, students could request a remark on any released assignment, and the marker would receive it, and be able to mark and add comments. However, there were some issues in this system, including features that had to be disabled. For instance, under the planned version, students could save their remark requests, then work on them later, without markers being able to see them. Under the current implementation, markers could see the in-progress request, and saving the request to work on it later would sometimes erase the student’s score for that assignment – a bit of a problem. As a stopgap, the saving feature had been completely disabled. One of my major orders of business was to fix these issues and enable the saving feature. Another issue in vein was a quality-of-life improvement for markers. Under ther current implementation, when a remark was requested, the marker could see what all the old scores were, but if they felt the original score was fair, they still had to go through and reenter all of the scores anyway. My fix here was to autopopulate the scores for the remark with the old mark, but the issue was timing. My initial versions crudely set the marks when the screen was loaded by the marker. This was problematic because if the marker went away, then had to log in and go back to the screen, they’d lose the marks when they reloaded. The (in retrospect) obvious fix was to instead set the marks when the remark request is submitted, since that’s when the second marks set appears in the database. Another fix for quality of life was fixing session expiry. Under the current system, your session could silently expire while you were working, then when you tried to save or submit, you’d lose your work and be booted to a login screen. So, I added a modal to warn you if your session was due to expire soon. This was tricky because Rails servers are very strictly RESTful – that is, they respond to actions the user takes. They do not initiate their own actions such as checking if a session has expired. Instead, I used a JQuery function to set up a repeating call to an action on the server, asking the server repeatedly to check if the session was due to expire. Then, I had to filter these checks out, so that they wouldn’t reset the session expiry (which would keep a session from ever timing out). There was also an issue that couldn’t be resolved; namely, we issue a HTTP 302 error when you try to go to a page and your session times out. This is because it gives us a silent redirect. Technically, the correct error for a session timeout would be HTTP 401 Unauthorized. However, because this is a 4xx code, browsers like to throw up a little “You are being redirected” screen. To get around this, I had a ridiculous bit of Javascript hackery, which returned a bit of HTML text with the 401. That text was a script, and the script, when loaded, shoved you back to the login silently using a bit of ERB (Embedded RuBy, being used in a Ruby file). While it worked, it was very un-Rails, confusing, and wasn’t obvious.

I went in to this project with no knowledge of anything in it. Markus runs on Ruby, Rails, JQuery, HTML, MVC pattern, RESTful services, and raw Javascript. Basically, I had none of these things. I’d never touched web development before (barring a small ‘computers’ class in elementary, where a high school student taught me how to link to images on other people’s web sites by reading and writing pure html in the 90’s). I had to give myself a crash course in Ruby and Rails in order to understand enough to begin reversing behaviours through observation. On top of that, I had to learn enough HTML to understand what was going on in the views, and pick up the Javascript and JQuery, since so many of my changes were concentrated on the views – also new to me, since I usually stick to back-end development. Overall, I’ve become a huge fan of Rails, and particularly Ruby. I found this project gave a great understanding of how (and why) MVC systems work the way they do, and really came to appreciate how easy it was to find what needed to be changed when I went looking – you could tell just by looking at if the issue was with data, behaviour, or appearance. Ruby has become one of my favourite languages, barring a few quirks which can lead to consistency issues (you can use begin/end or {/], your boolean logics can be !/&&/|| or not/and/or, and some other similar problems). However, this project was able to mitigate these problems with Hound, a program that hounds you if you try to submit changes that don’t follow the consistency standards. This was a great term for broadening my horizons and getting to experience web development, which I don’t really see taught at SFU.

Written by Christian Millar

April 16th, 2015 at 1:01 pm

RSpec testing in MarkUs II

without comments

MarkUs is the robust and reliable application where testing is used as the main component to make sure those qualities persist. I knew nothing about testing before starting UCOSP this term in January of 2015. Besides the fact that testing is very important for the known reasons (Duh). When I began learning RSpec I realized the philosophy behind writing robust code: consider all the possibilities of how your code can be wrecked before writing it. Are you writing a form with a field prompting for user’s date of birth? Think about dates like 99/99/9999 or javascript code that might end up in that field. Crazy stuff happens, so it’s faulty to write code only assuming the best-case scenario where user actions are always coherent with the functionality implemented.

The Behavior Driven Development (BDD) seems very logical and even optimal for applications like MarkUs. But adopting it means that all the developers should have in-depth knowledge of how testing works. It’s seems unlikely to happen due to the distributive nature of the application and the fact that many people who work on it are coming and going just like me. After spending my term on MarkUs working with RSpec I can say for sure that I’m not even close at becoming pro at testing. So forget about BDD and let’s see what I’ve done over this term.

The tickets I was working on mainly concentrated around different sorts of testing. I started with the easiest kind that involved unit testing where you test a single function to make sure it produces appropriate results using arbitrary scenarios. Sometimes it’s difficult to come up with a good scenario. You have to think about what function supposed to do and test that, but then you also have to consider wild (not too wild) possibilities that could break the function. Writing passing a test is easy, but most of the time I was only satisfied when I was able to break something that resulted in failing test and required fixing.

That happened when I began working on CSV upload functionality for Simple Grade Entry form. The upload relies on rails library parsing methods that are not ideally robust to begin with. So it’s very important that the file passes all the checks before entering the parsing stage. My wild (but not too wild) failing scenarios included checking for: presence of EOF character, appropriate EOL characters, non-CSV files that are pretending they are CSV (sneaky spies!), etc. I also discovered that any file passed through CSV upload would overwrite the original template. Even though this functionality is required for other parts of MarkUs, I thought that it could potentially cause some troubles along the way. Now this concern is handled and corresponding RSpec tests are in place.

RSpec is a powerful testing framework that possesses both great readability and writability aspects. Although it’s not good enough on its own for html parsing (requires Nokogiri), and javascript parsing (requires Capybara/Selenium pair which is not a stable solution for vagrant box developers).  I also found out that RSpec is not multi-thread-friendly and because of that I was unable to finish the last issue that required testing forked processes. Nevertheless, there are currently efforts made by the RSpec core team and, hopefully, we will soon get the capability of testing parallel processes.

I greatly enjoyed working with this test framework and its object-building sister – FactoryGirl. The biggest challenge I was facing is understanding of sometimes complex relationships between different MarkUs entities. And in-depth understanding is required, because there is no way to even start testing without a good idea of how different elements co-operate with each other. And then you start building factories, which have to follow the rules of multiple associations, validation and other model requirements. Testing helps a developer to get almost intimate with the code, so I believe that this term I became not just a better coder, but improved as a programmer.

Written by Maryna Moskalenko

April 10th, 2015 at 8:22 pm

Integrating MathJax

without comments

A feature commonly requested by markers was the ability to annotate student submissions with LaTeX like math. This has now been implemented!

 

Screen Shot 2015-04-10 at 11.38.45 AM

Anywhere annotations exist markers can enter LaTeX like math thanks to MathJax. When creating an annotation the marker just needs to surround the math in a pair of dollar-sign symbols. The entire annotation shown in the image above is:

should actually be $$\lt \frac 1 2$$

As would be expected, students also see LaTeX like math when viewing an annotation with math in it. This math rendering system expands (and reinforces) the utility of Markus for theory-based courses such as calculus, discrete math or linear algebra.

In addition to the MathJax integration, markers can now preview their annotation prior to submitting it.

Screen Shot 2015-04-10 at 11.51.07 AM

The preview functionality will help speedup the marking process for users unfamiliar with MathJax syntax. Instead of submitting an annotation, hovering over it and then editing it, markers can now preview exactly how their annotation will look once submitted. This also allows markers to preview rich HTML annotations with bolded and italicized text.

Written by Paymahn Moghadasian

April 10th, 2015 at 12:54 pm

Posted in New Feature

Status Updates – March 27

without comments

Peter

  • This week
    • Git cleanup of spreadsheets branch
    • Began work on CSV override marks option
  • Next week
    • Continue work on CSV override marks option

Paymahn

  • This week
    • Started working on annotation previews
    • Fixed issue 1727
  • Next week
    • Continue work on annotation previews

Maryna

  • This week
    • wrapping up with file upload testing.
    • All tests are passing except one:
    • There is an error thrown when an uploaded file has no newline at the end of file or non-standard newline
    • Trying to overwrite the file by adding the newline before parse_csv action. More information: #2078
    • Worked on displaying the error message when a user tries to upload the file that would change Simple Grade Template. More information: #2098
  • Next week
    • finish up 2078/2079 and start 1199

Christian

  • This week
    • Changed the seed so A2 has a flexible scheme and some submissions. Also, discovered an interesting bug: if you change an assignment that isn’t due yet to a due date in the past, collecting submissions breaks. Completed issue 2030. Found that reordering works on assignment criteria, but was still broken on annotation categories, so I rejiggered things to work there
  • Next week
    • The only issue currently assigned to me is 2087, so that’s on the list.
    • I’ll also be asking for some more tickets during the meeting.

Ryan

  • This week:
    • Cleaned up the changes I made last week, included fixing url generation
    • Removed some of the unused RJS files
    • Converted some RJS files to erb from the graders page
  • Issues
    • Got stuck debugging why jQuery wasnt working… needed to use jQuery() not $()
    • Took a while to ensure I wasnt removing any functionality
  • Next week
    • Fix up git issue
    • Continue converting RJS to erb files

Written by Paymahn Moghadasian

March 27th, 2015 at 11:34 am

Status Update – Feb 27

without comments

Paymahn

  • This week
    • started writing UTs for MathJax integration. Started having difficulty testing well, took a step back and realized the integration could be significantly simplified.
    • Simplified MathJax integration (deleted lots of code)
    • Finished mathjax integration and put up a PR
  • Next week
    • Unknown. Either pick up a new project or fix any bugs found while checking the PR

Christian

  • This week
    • Wrapped up the last issues with the remarks (adding an extra mark not working and deleting database records for extra marks when they aren’t needed).
    • Started creating a modal that’ll popup when you’re close to expiry (currently thinking it’ll popup, say “You’re about to expire; press here to cancel that”, something like that). Currently got the javascript that’ll check every minute or so hooked up, and figured out how we’re tracking the session timeout.
  • Next week
    • More of the modal. If it turns out way easier than I think it’ll be, I’ll be able to start work on the double login bug too.

Ryan

  • This week
    • Searched though react docs to find way to hide a column for hours, was unsuccessful
    • Figured out how to get data from the conroller to the view with rails
    • Searched for all the section columns and set them to hide if there are no sections set
    • Started to investigate ajax update issue with the marks_graders tables
  • Next week
    • Try to find a solution to the ajax issue, ensure react is implemented correctly on the marks_graders page
  • Issues
    • There doesnt seem to be much documentation on how to use the react tables so I spent a lot of time trying to figure them out
    • This was my first time using the rails MVC style so there was learning curve there
    • Finding all the section columns wasnt as simple as I had hoped

Maryna

  • This week
    • worked on issue 664: Add tests for our routes
    • Re-writing the test from this outdated patch: https://gist.github.com/benjaminvialle/4055208
    • Completed:
      ‘Routing to main page’
      ‘Admin resource’
      ‘An Assignment collection’
      ‘An Assignment member’
      ‘An Assignment’s rubric’
      ‘An Assignment’s flexible criteria’
      ‘An Assignment’s automated test’
  • Next week
    • continue working on tests for csv upload and routes tests
  • Issues
    • as the routes.rb file got changed over the year, some routes became outdated and new routes were added. Have to trace the changes to write new tests and remove outdated

Peter

  • This week
    • Completed the implementation of the Grade Entry Table using React
      • Search, Sorting, and Selecting all working now
  • Next week
    • Work on Issue 1974: Add Bonus Column to Spreadsheet
    • Work on Issue 1762: “total_grade” should be a calculated field in the database.

Josh

  • This week
    • NA
  • Next week
    • NA

 

Written by Paymahn Moghadasian

February 26th, 2015 at 10:11 pm

Status Update – Feb 20

without comments

Paymahn

  • This week
    • Did manual testing of annotation system with MathJax. Found several bugs specific to my work (PDFs and something else I forget) and several on development
    • Opened issues: 2045, 2043 and 2042
  • Next week
    • Unit testing, finally

Maryna

  • This week
    • Finished issue 218: adding tests for “calculate_collection_time” and “calculate_grouping_collection_time”
    • Mid-way done with issue 99: “Create unit tests and functional tests for CSV upload/download”
    • Download unit tests are done:
         ‘tests that action csv_downloads returns OK’
         ‘expects a call to send_data’
         ‘sets disposition as attachment’
         ‘returns vnd.ms-excel type’
         ‘passes naming conventions’
    • Upload is much more complicated. Here are the tests that I have started:
         ‘does not accept an empty file’
         ‘should gracefully fail on non-csv file with .csv extension’
         ‘does not accept .csv file with wrong column names’
  • Next week
    • Right now if we try uploading a non-csv file with csv extension – the application crashes. To catch this exception functional testing must be implemented. I would also have to think about other testing for the upload
  • Problems
    • every time no matter if the file is correct or not, it gets redirected
    • all calls to this upload function return status 302, go somewhere else and respond with the appropriate status code. Unit testing cannot trace such response

Christian

  • This week
    • Refactoring in and around the remarks and results screen, namely changing how (and when) remark results are generated
    • reworking the views in the results screen, since they shouldn’t be checking the user role if they’re in a role-specific folder.
    • Started the add extra mark issue, which’ll likely be fast
  • Next week
    • I’m going to need to pick a new area and set of issues to work on, which I’ll be bringing up in this week’s meeting

Ryan

  • This week
    • Investigated annotation bugs
    • Applied and thoroughly tested the fixes, found a few hidden issues that were already exisiting and fixed them as well
    • Made hound happy
  • Next week
    • Take a big stab at the react stuff! I hope to put in double time next week to make up for this week
  • Issues
    • Hound
    • I didn’t have a lot of time to put in this week (Other classes, V-Day, birthdays, huge hassle getting my washing machine replaced, etc etc)

Josh

  • This week
    • NA
  • Next week
    • NA

Peter

  • This week
    • Continued work on the Admin/Grader spreadsheet implementation using React
    • Updated the React table input textboxes for grades to dynamically save
  • Next week
    • Continue working on and debugging the spreadsheets table implementation using React
    • Potentially start on other issues currently assigned to me
  • Issues
    • There are still issues with the sorting, checkboxing, and searching that I need to look into
  • Notes
    • I was away travelling for most of this week as it was reading break at UBC, so I wasn’t able to get as much work done.

Written by Paymahn Moghadasian

February 20th, 2015 at 12:09 am

Status Update – Feb 13

without comments

Paymahn

  • This week
    • Fixed issue with annotation pop up on mouse hover
    • Figured out how to get math rendering to work on the annotations categories page
  • Next week
    • I’m pretty sure my branch has introduced some regressions, I’m going to investigate those and see how to fix them
    • Time permitting I’ll write UTs
  • Issues
    • Annotations get truncated in the annotation lists and thus don’t render properly. Not sure what to do for this. See image below:
Long annotations get truncated

Notice the bottom entry of the list

Maryna

  • This week
    • I was working on issue99 (Simple Grade Entry: Create unit tests and functional tests for CSV upload/download).
    • While understanding how the csv works for the Marks Spreadsheet I ran into few errors/concerns that I want to discuss during the meeting. (Here goes the text from the word document)
  • Next week
    • continue working on issue99 and issue218 (still have to do that additional test that checks the section due dates)

Ryan

  • This week
    • Implemented style changes for annotation upgrade
    • Fixed failing test cases caused by the addition of column_start and column_end fields to the annotation table
    • Added placeholder texts to react table search fields (including general react research/how-to)
  • Next week
    • Try to make more major changes with the react issues
  • Issues
    • Fixing the test took a long time, Im not familiar with ruby tests and the logs werent very helpful for finding the source of the issue. They gave me an idea what to look for but not where.
    • Getting started with react took a bit

Christian

  • This week
    • Working on issue 1933, re-enabled the save button, found the commit that fixed 1933, set things up so that if a student saves a remark request, the marker can’t see it.
  • Next week
    • More of the save-button related stuff, I don’t like the way it creates new result sets, so that’s getting rebuilt to create the remarks with the old marks (which I should have done the first time), and the results view and files need a bit of refactoring (namely, the marker views render a bunch of the student view components).

Peter

  • This week
    • Continued work on the Admin/Grader spreadsheet implementation using React
    • Provisioned and linked all the student data of the Spreadsheets table to the new React table
    • Working on the input textboxes for grades to dynamically save with React
  • Next week
    • Continue working on and debugging the spreadsheets table implementation using React
    • Potentially start on other issues currently assigned to me
  • Issues
    • The sorting and searching don’t seem to be working properly, currently debugging potential causes
      • Sorting is not ordering the elements properly
      • Entering anything in the search box causes a Uncaught TypeError

Josh

  • This week
    • Began updating rubric criterion to support fewer or more achievement levels
  • Next week
    • Hopefully finish achievement levels upgrade and begin refactoring marking schemes to allow a mix of rubric and flexible criteria
  • Issues
    • Seems like it’ll be extremely difficult to support an arbitrary number of levels. Better to try to stay DRY and robust with arbitrary level implementation, or w

Written by Paymahn Moghadasian

February 13th, 2015 at 12:03 am

Status Update – Feb 6

without comments

Josh

  • This week
    • Explored rubric implementation, took notes/planned future changes
    • Mistakenly began student-side summary page before realizing that the priority was admin table
    • Began work on admin marks summary page
  • Next week
    • Clear all changes and refactorings with supervisor
    • Complete implementing admin marks summary page, hopefully begin on student summary page

Christian

  • This week
    • Save button bugs
  • Next week
    • More of the same
  • Problems
    • Lots of projects came due this week, so I didn’t have much time

Paymahn

  • This week
    • contacted previous students about MathJax integration
    • integrated their work and got several parts of the integration working
  • Next week
    • will spend more time getting familiar with the annotation system
    • finalize integration
    • write tests
  • Problems
    • MathJax isn’t working for viewing the annotations while hovering but works elsewhere

Ryan

  • This week
    • Finished redoing the annotation update that now breaks the spans up and highlights only the selected text
    • Adjusted the mouse listener events so they only showed up on the highlighted text, not the entire line
    • Fixed up the overlapping annotation structure, added third depth to the CSS, and made colors more obvious
    • Noticed that the mouse listeners were not disposed if an annotation was removed and fixed that
    • Made a migration file and removed the changes I made to the schema file (noob move, my bad!)
  • Next week
    • Clean up any style issues or suggestions from David/the markus team
    • Start working on the react/table issues
  • Problems
    • Tracking the annotation depths/IDs was a huge pain! Turns out you cant use a DOM node as a dictionary key

Maryna

  • This week
    • worked on issue 218 regarding creating new tests for two existing functions
    • have two tests for checking if the value is nil and checking if the value is a date
    • want to add one more test to calculate_grouping_collection_time(grouping)
    • right now the testing factories are set up in the way that the grouping parameter is empty. This prevents the test from entering if statement. I want to create a test for the particular piece of code within if(), now I have to figure out the way how to change the grouping parameter
    • the major obstacle: figuring out the relationships between models
    • added final bits to issue 76 (add required file option to fix in the file names). Pure ruby-js communication which can be stubborn at times. Took more hours than I anticipated (basically half of the time this week
  • Next week
    • add that test for #218 and work on issue 99: “Simple Grade Entry: Create unit tests and functional tests for CSV upload/download”

Peter

  • This week
    • Updating the Spreadsheets interface for graders
  • Next week
    • Continue working on the Spreadsheets interface for graders

Written by Paymahn Moghadasian

February 5th, 2015 at 10:22 pm

Status Update – Jan 29 2015

without comments

Christian

  • This week
    • Figured out what was going wrong with displaying remarks to markers
  • Next week
    • figure out why the save button was deleting marks and fixing that

Peter

  • This week
    • Fixed issue-1760 – Converted Student Interface’s marks spreadsheet table to React.js
    • Working on #1974: Add “Bonus” columns to spreadsheets
  • Next week
    • Work on issue #1974
    • Potentially work on #1704: Warn before browsing away whilst uploading spreadsheet marks
  • Others
    • It’s my first time working with React.js so any feedback on implementation would be appreciated

Paymahn

  • This week
    • Finished off #1795. PR still hasn’t been merged but I’m confident it’s done.
  • Next week
    • Start working on integrating MathJax. Will be mostly investigative work and maybe some playing around.

Ryan

  • This week
    • Finished the first iteration of text annotation for specific text selections
      • implemented it by using javas execCommand function
      • this presented several new issues, including breaking original text selection method
      • decided it would be best to redo the highlight function and add classes to the text nodes between the end and start column then split the end/start into two spans, one to leave plain the other to highlight
    • fixed up the way the column offsets were calculated when there were multiple spans in the line
  • Next week
    • I need to finish implementing the new highlight method
      • all that’s left is to clean it up and handle a few edge cases.
  • Problems
    • struggled to parse all the DOM nodes, specifically finding the applied styles

Maryna

  • This week
    • learning respec (BDD, Red/Green testing, basic tests, built in matchers, stubs vs mocks, fixtures and factories
    • examined present markus code
      • Looking at models and associations and attributes to understand DB structure
      • Write the tests for calculate_collection_time and calculate_grouping_collection_time to close ticket #218
  • Next week
    • to continue working on assigned tickets (adding new tests to some implementations)
    • to start looking into translating existing rake tests into RSpec
  • Problems
    • understanding the reasoning/meaning behind some of the code
      • assignment.latest_due_date + hours_sum.hours and hours_sum is always 0. Type casting?

Josh

  • This week
    • NA
  • Next week
    • NA

Written by Paymahn Moghadasian

January 30th, 2015 at 12:28 am

Status Report – Jan 23 2015

without comments

Christian

  • Last week
    • Confirmed existence of #2014
    • Refactored a bit of the remark display in the results controller
    • Made old marks populate the marks fields when remarking assignments (issue 1975)
  • This week
    • Fix issues 2014 and 1869

Maryna

  • Last week
    • worked on issue 76: Disallow non-AssignmentFiles option in Assignment Properties. done and pushed. The major challenge: work on the front end (styling). Had to learn the basis of jQuery to make options pop up in the right places.
    • learning RSpec from the scratch by video tutorials. Reading report provided by one of the students who worked on Markus previously. So far so good.
  • This week
    • review the RSpec tickets assigned by David and find the easiest one to start with.
    • If I would require more time to learn RSpec, my plan is to find some unsigned issues that I could work on in the meantime.

Ryan

  • Last week
    • worked on getting the text annotations to display on only the selected text and not the entire line
    •  managed to get the start and end columns saved into the database while handling a few edge cases
    • made progress getting the data back out of the DB and to the client side.
  • This week
    • Finish off annotations.
  • Having trouble with
    • working with bare bones JS to be consistent with the rest of the annotation class and keep the client side processing to a minimum
    • staying awake after experiencing jet lag and getting back into the swing of things
  • Addendum
    • It turns out that not all of my changes were committed to github, I would assume due to my own user error. It will put me back at least a few hours but I should be able to redo the work and meet my goals regardless. I’ll consider this a lesson learned.

Paymahn

  • Last week
    • Fixed issue 1917. There was an issue with links in the dashboard for spreadsheets and assignments going to settings instead of what would be expected
    • Fixed issue 1884. Flexible criteria could not be downloaded. This was happening because the client was making a POST instead of a GET
    • Worked on issue 1795. The error message for criteria created with a duplicate name was awful. I’ve gotten the message fixed but this broke some tests. I’m in the process of converting the broken tests (and their respective files) to RSPEC
  • This week
    • Looking to finish off issue 1795 (third bullet point above)
    • Will start investigating my project
    • Will need to learn javascript (I’ll probably do some tutorials or something and incessantly annoy Ryan with questions)
  • Having trouble with
    • RSPEC doesn’t make sense (maybe I can’t find the right docs?)
    • Reading docs on relishapp.com
    • Specifically trying to understand how to properly use helper methods for the tests

Peter

  • Last week
    • Learning react framework – tutorials, studying implementations in codebase
    • Updating Student Marks Spreadsheet Table to React (Issue 1760)
  • This week
    • Complete updating Student Marks Spreadsheet Table to React (Issue 1760)
    • Add Bonus Column to Spreadsheet

Josh

  • Last week
    • few more rails tutorials, began (re)familiarizing self with vagrant, bash, virtualbox, etc
    • Not much substantial yet, catching up on classes and stuff
  • This week
    • Begin research/work on #1804 (refactoring Flexible/Rubric criterion models)
    • If possible, begin on issue #1973, but that’s probably a low priority feature atm, and 1804 will likely take at least a few weeks given how little I know of Rails.

Written by Paymahn Moghadasian

January 23rd, 2015 at 2:08 am