Skip to content

Developper guide

Sytroon edited this page Jan 11, 2025 · 7 revisions

Welcome to the GL02_TriCode developper guide!

Table of Contents

  1. Project Organization
  2. Maintenance Process

Project organization

Overview

This project is organized into three main Javascript files :

  • caporalCli.js : The entry point of the software. This file provides commands for the user and some standard logic for organizing and printing data.
  • CruParser.js : Logical center of the software. All the logic concerning the CRU format and the parsing is in this file.
  • Course.js : Defines the Course class with all its properties. The Course class doesn't contain any method.

Detailed explanation

  • The caporalCli.js file is written using the Caporal.js framework in order to build a command line software. As such, available commands are written as caporal commands with arguments and an action. The action is the function body. These commands only contain standard logic, the CRU parsing is done in a different file dedicated to this job (CruParser.js).

  • The CruParser.js file contains all the CRU related logic. It allows to tokenize data and parse it according to the CRU format. This can create Course objects from CRU files.

  • The Course.js file is a class file with ths structure:

class Course {
  constructor(name) {
    this.name = name;
    this.creneaux = [];
  }

  addCreneau(type, nbPlaces, jour, horaire, sousGroupe, salle) {
    this.creneaux.push({
      type: type,
      nbPlaces: nbPlaces,
      jour: jour,
      horaire: horaire,
      sousGroupe: sousGroupe,
      salle: salle,
    });
  }
}

A course has two properties:

  1. name (string)
  2. creneaux[] (array of timeslots).

It also has a method:

  1. addCreneau(type, nbPlaces, jour, horaire, sousGroupe, salle)

This method allows adding timeslots to a course. A timeslot is defined by its type, its number of places, its day and hour, its subgroup and its classroom.

Maintenance process

Perspectives

At this time, there are several things to work on in this project:

  • Generalizing the use of the recursive function to access data. This can be used in almost every command of the caporalCli.js file.
  • Checking that the provided data is in a CRU format. For now, the extension .cru is enough for a file to be parsed.
  • Writing functions for recurrent actions on data. This will make the code more readable and more easy to refactor.

How to collaborate

Here is the process to follow if you want to edit, improve or change this project:

  1. Open an issue on the Github repository following the given issue template.
  2. Create a new branch to fix the issue on.
  3. Fix the issue.
  4. Push your new branch to the repository and merge it using a pull request. Don't forget to close the issue and delete your branch in the process. This step might need reviews from other collaborators.

Clone this wiki locally