Git Product home page Git Product logo

dodona's Introduction

Dodona

GitHub release (latest by date) GitHub Workflow Status Codecov Support chat

Dodona is an online exercise platform for learning to code. It wants to teach students how to program in the most meaningful and effective way possible. Dodona acts as an online co-teacher, designed to give every student access to high quality education. The focus is on automatic corrections and giving meaningful feedback on the submitted solutions from students.

This repository contains the source code of the web application. If you simply want to use Dodona, please go to https://dodona.be.

The documentation for end users can be found at https://docs.dodona.be.

Supporting Dodona

Dodona is free to use for schools and we would like to keep it that way! Keeping this platform up and running takes a lot of time, just as supporting hundreds of schools and thousands of students. If you would like to fund Dodona, you can find more information on https://dodona.be/en/support-us/ or get in touch by emailing us at [email protected].

Contacting us

There are several ways to contact us:

Local development

If you want to help with development, issues tagged with the student label are a good starting point.

Development Setup

  1. Install and start mysql or mariadb.
  2. If using mysql, change the sql-mode in the mysqld configuration block:
    sql-mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION'
    
  3. Create a dodona user with access to the dodona and dodona_test-N databases. You will need as much test databases as you have CPU threads.
    CREATE USER 'dodona'@'localhost' IDENTIFIED BY 'dodona';
    GRANT ALL ON dodona.* TO 'dodona'@'localhost';
    GRANT ALL ON dodona_test.* TO 'dodona'@'localhost';
    GRANT ALL ON `dodona_test-0`.* TO 'dodona'@'localhost';
    ...
    GRANT ALL ON `dodona_test-N`.* TO 'dodona'@'localhost';
  4. Install the correct ruby version using RVM (the currently used version can be found here).
  5. Install the correct node version using nvm and yarn (any modern node version should do).
  6. Run bundle install and yarn install
  7. Create and seed the database with rails db:setup. (If something goes wrong with the database, you can use rails db:reset to drop, rebuild and reseed the database.) If the error "Could not initialize python judge" arises, use SKIP_PYTHON_JUDGE=true rails db:setup
  8. Run bin/server to start the server. More information on how to start the development setup can be found here. Dodona will be available on a subdomain of localhost: http://dodona.localhost:3000.
  9. CAS authentication does not work in development. Instead the seed database from step 7 provides three users via login tokens. The relevant login links are displayed in an announcement on the home page of Dodona.

Evaluating exercises locally

These steps are not required to run the server, but you need docker to actually evaluate exercises.

  1. Install and start docker.
  2. Run docker pull dodona/dodona-python

If you want to build the docker images yourself:

  1. Clone the docker-images repository.
  2. Build a docker image. The build.sh scripts builds all images. But with the initial data, only dodona-python is needed. You can build this image with docker build --pull --force-rm -t "dodona-python" -f "dodona-python.dockerfile" ..

Loading visualisations locally

These steps are not required to run the server, but are needed to let the visualisations load.

  1. Install and start memcached.
  2. Create the following file tmp/caching-dev.txt in the root of the project.

Windows

Some gems and dependencies (such as memcached) do not work on Windows. You should use WSL 2 instead, and run everything inside WSL. This means you use WSL for the database, memcached, git, Docker, etc.

Starting a local server

The simplest way to start the server is with the rails s command. But this will not process the submission queue, and javascript will be compiled by webpack in the background (without output when something goes wrong).

  • To process the submission queue, delayed job needs to be started with the bin/delayed_job start command.
  • With yarn build:css --watch your css is reloaded live (use without the --watch flag when you need to build the stylesheets and live reload is not wanted).
  • With yarn build:js --watch your javascript is reloaded live (use without the --watch flag when you need to build the javascript and live reload is not wanted).

To start the rails server, delayed job, css bundling and js bundling at the same time, simply run bin/server.

This has one letdown: debugging with byebug is broken.

Localhost subdomain

Dodona uses subdomains in order to sandbox exercise descriptions (which are arbitrary HTML pages and could be used for malicious purposes if not properly sandboxed). We serve the main application in development from http://dodona.localhost:3000 and exercise descriptions from http://sandbox.localhost:3000.

If this does not work out of the box you can add the following lines to your /etc/hosts file:

127.0.0.1             dodona.localhost
127.0.0.1             sandbox.localhost

Running linters and tests

To lint the code, run rubocop for Ruby and yarn lint for JavaScript.

We have tests in JavaScript, Ruby, and system tests:

  • For JavaScript, run yarn test
  • For the system tests, run bundle exec rails test:system
  • For the ruby tests, run bundle exec rails test

There is also a type check for code written in TypeScript. This can be executed with yarn typeCheck.

Tips

  • Use the PARALLEL_WORKERS ENV var to specify the number of threads to use.
  • Use TestProf to profile the ruby tests
  • Use bundle exec rails test filename to run a single test file, use bundle exec rails test filename:linenumber to run a specific test

dodona's People

Contributors

arnhoudt avatar beardhatcode avatar bmesuere avatar bramdevlaminck avatar btws2 avatar bwindey avatar chvp avatar dependabot-preview[bot] avatar dependabot[bot] avatar dmouriss avatar freyavs avatar iasoon avatar inteon avatar jeroentbt avatar jorg-vr avatar louisedck avatar lucianoslionakis avatar mrbananapants avatar mrkickkiller avatar niknetniko avatar pdawyndt avatar rien avatar stijndcl avatar thepieterdc avatar tibdhond avatar tibvdm avatar timondb avatar toonijn avatar wddridde avatar winniederidder avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

dodona's Issues

allow judging process to be interrupted

Previous round of judging process should be interrupted when user requests a new round of judging the submitted source code. As long as this has not been implemented, the run button should be disabled as long as the judging process has not terminated.

Original issue by @pdawyndt on Sun Apr 17 2016 at 12:18.
Closed by @bmesuere on Mon Dec 19 2016 at 09:18.

Add JavaScript tutor

For the moment the tutor loads the code from the file testcode.js located in the root directory. This can be seen by surfing to /tutor/....

The view executes jslogger.js (for the moment located in the home directory of the webshare) with node js. This generates a json file that contains the necessary information for the tutor. This json string is loaded in the javascript of the view and the javascript to build the tutor ui is executed.

These are som things that need to be done:

  • installing node js on the server
  • find a way to pass the correct code to the jslogger.js script (either by passing the code as a string or creating a temp file)
  • relocate used javascript/css files that are only used by the tutor (this to avoid conflicts since these files overwrite some basic jquery-ui classes)

Original issue by @dmouriss on Thu Apr 21 2016 at 17:30.

handle time limit in worker executing judge

Time limits should be handled by worker executing the judge, and not by code generating the feedback table. This way, the time limit should not be passed on to the code generating the feedback table, which would allow better processing of time limits being exceeded. This is only possible if the submitted code and test cases are executed in a separate worker or server-side.

Original issue by @pdawyndt on Sun Apr 17 2016 at 12:09.
Closed by @bmesuere on Mon Dec 19 2016 at 09:15.

launch online tutor for specific test cases

The Online Python Tutor also has a JavaScript version the could be launched for specific test cases. In order to do this properly, we should also introduce the concept of a context of test cases, as the test cases might depend on each other. Maybe this is also the time to reflect upon how to represent the test cases. We now have two models:

  • Python judge: uses extension of doctest model to describe test cases
  • JavaScript judge: uses calls to judge to add test cases and their properties

Original issue by @pdawyndt on Sun Apr 17 2016 at 11:25.
Closed by @charvp on Thu Sep 27 2018 at 15:03.

image popups should have white background

The lightbox that is used to show a zoomed in version of an image should better have a white background. When images are transparent (as is the case, for example, in the exercise on the Mars rovers), there is a lot of black on black. Transparent images have been made with a light colored background in mind.

Original issue by @pdawyndt on Fri Apr 15 2016 at 12:57.
Closed by @bmesuere on Sun Apr 24 2016 at 10:04.

execute test cases in Web Worker

Test cases should be executed in a separate Web Worker so that the UI can remain responsive.

  • execute test cases in a separate namespace (function), so that executing test cases does not create global variables
  • added value of Web Workers: submitted source code can no longer use alerts
  • added value of Web Workers: submitted source code can no longer modify the DOM

Original issue by @pdawyndt on Sun Apr 17 2016 at 11:52.
Closed by @pdawyndt on Sun Apr 17 2016 at 11:52.

execute submitted code and test cases in separate Web Worker or server-side

Executing the submitted code and test cases in a separate Web Worker would

  • create sandbox that protects judging environment
  • shields execution of submitted code from judging environment
  • nieuw context -> new Web Worker, so that previous context has no influence on current context (might be run in parallel)

As an alternative, all executions based on submitted source code could also be done server-side, which would even allow better shielding between judging framework and user-submitted code. This would also allow to support other programming languages than just JavaScript.

Original issue by @pdawyndt on Sun Apr 17 2016 at 12:06.
Closed by @bmesuere on Mon Dec 19 2016 at 09:14.

allow users to report bugs or request features

Allow users to report bugs or request features directly from the web interface. They can either make suggestions about the application as a whole, or about a specific exercises. Perhaps this could also include the possibility to ask questions about how to solve an exercise. I've seen frameworks, where an exercise-specific discussion thread was available.

Original issue by @pdawyndt on Sun Apr 17 2016 at 12:23.
Closed by @charvp on Thu Sep 27 2018 at 15:02.

mix object comparison with object diffing

In comparing the expected and generated return values, a message should be generated why the two object differ and a pretty printed versions of the two object should be generated (including diff) to highlight where the object differ. Only if this pretty printing has not been done during object comparison, the generation of a diffed version should be done when generating the feedback table.

We also need a faster implementation of diff.

Original issue by @pdawyndt on Sun Apr 17 2016 at 12:22.
Closed by @bmesuere on Mon Dec 19 2016 at 09:18.

use webhook payload

Right now, when the webhook is triggered, all directories are reimported.
If the collection of exercises grows, this will probably take some time to do.
We could use the payload of the webhook to determine what is change and only update those.

Original issue by @bmesuere on Wed Apr 20 2016 at 10:43.
Closed by @dmouriss on Wed Apr 27 2016 at 15:54.

Inputvak voor code krijgt extra tekens

Wanneer je naar een specifieke oefening gaat en je klikt op vorige en dan volgende in je browser, bevat het inputvak een extra lijn:

12// voeg hier je oplossing inXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Iedere keer dat je dit herhaalt komt er nog extra tekst bij.

Original issue by @dmouriss on Mon Apr 11 2016 at 16:44.
Closed by @bmesuere on Mon Apr 11 2016 at 16:53.

proper handling of expected/generated exceptions

The following situations might occur with respect to exception handling:

  • exception was expected and the same exception was generated
  • exception was expected but a different exception was generated
  • exception was expected and no exception was generated
  • no exception expected and no exception generated
  • no exception expected and exception generated

Original issue by @pdawyndt on Sun Apr 17 2016 at 11:30.
Closed by @pdawyndt on Sun Apr 17 2016 at 11:30.

objects that don't inherit from Object.prototype not supported by judge

Only objects that inherit from Object.prototype are supported by the judge, because it relies on the availability of the hasOwnProperty method for equality testing and pretty printing of objects.

@bmesuere: This has been resolved in the custom judge under the folder geheimschrift van dumas but needs to be applied to the generic judge in this repository. See the equals method in the file js-judge.js and the display function in the file js-judge-utils.js.

Original issue by @pdawyndt on Sat Apr 09 2016 at 10:38.
Closed by @bmesuere on Sun Apr 10 2016 at 22:46.

server side judges

The end goal is to have server side judges that aren't limited to javascript. For this, we need to decide on a few things:

  • how do we manage the jobs: delayed jobs, resque, ...
  • how do we sandbox the judges: docker
  • how do we talk to the judge
    • 1 mandatory file containing a json object containing key/value pairs for judge configuration
    • optional files containing input data, output data, ...
  • in what order do we implement this?
    • figure out how to easily run and configure docker containers
    • run the legacy judge as-is inside a docker container as a proof of concept
    • standardize the input format (#72)
    • standardize the output format (#73)
    • refactor the legacy python judge to work with the new input and output format
    • call the judge from within the ruby code and process the results
    • implement the job queue

Original issue by @bmesuere on Wed Apr 27 2016 at 18:38.
Closed by @bmesuere on Tue Aug 02 2016 at 10:47.

add option to set exercise-specific timeout

In specifying test cases for a specific exercise, it should also be possible to set a specific time limit (and also other exercise-specific parameters).

This can now been done, by including the following statement to the test case file, setting the time limit to 1000 milliseconds in this case.

judge.setTimeout(1000);

Original issue by @pdawyndt on Sun Apr 17 2016 at 11:57.
Closed by @pdawyndt on Sun Apr 17 2016 at 12:09.

sort exercises alphabetically

I know this issue will be resolved better when the grouping of exercises in series and the addition of labels to the exercises (allowing dynamic searches) will be implemented, but I guess it's a simple fix to just list the exercises in alphabetic order in the list that is currently used.

Original issue by @pdawyndt on Fri Apr 15 2016 at 13:04.
Closed by @bmesuere on Fri Apr 15 2016 at 13:09.

proper handling of assignment statements

Check why test case var madlib = new MadLibs(); is properly handled, and test madlib = new MadLibs(); isn't.

The first statement returns undefined whereas the second statement returns the object assigned to the variable. So, different expected return values should be specified in the test cases.

Original issue by @pdawyndt on Sun Apr 17 2016 at 11:37.
Closed by @pdawyndt on Sun Apr 17 2016 at 11:41.

interactive display of test case results

Test case results should be displayed as soon as they are available, and not as soon as all tests have been executed. This can be solved by adding all tests to a queue and keep on executing the next test until all tests in the queue have been processed. This will make the web app much more responsive.

Original issue by @pdawyndt on Sun Apr 17 2016 at 11:34.
Closed by @pdawyndt on Sun Apr 17 2016 at 11:41.

show statement that caused time limit to be exceeded

Time limit can either be exceeded during initial execution of submitted source code, or during processing of a specific test statement. In both cases, additional information should be provided to the end user at what stage the time limit was exceeded, and what particular test statement cause this. For now, the test statement is not displayed when the time limit is exceeded.

Original issue by @pdawyndt on Sun Apr 17 2016 at 12:15.
Closed by @bmesuere on Mon Dec 19 2016 at 09:16.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.