Git Product home page Git Product logo

boot-sandre / skii-school-platform Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 0.0 4.47 MB

Planning backend application for skii school with Python/Django/Pydantic/Ninja api

License: Mozilla Public License 2.0

Makefile 2.03% Python 82.71% HTML 0.35% JavaScript 0.51% Vue 9.95% CSS 0.02% TypeScript 4.13% Shell 0.30%
django django-ninja educational planner planning pydantic python python3 school skiing skiing-places skiing-trip student teachers

skii-school-platform's Introduction

Skii platform

Features

  • User management with profile (student/teacher)
  • Planning management with scheduled lesson
  • Place/Skii station promote and location
  • Lesson level and certification (TODO)
📚 Read the documentation
Skii Platform Logo

Development

Code quality

This project uses Pycheck to monitor the quality of the code. To install the code quality tools:

make install-pycheck
# or
yarn global add @pycheck/cli
yarn global add @pycheck/ui
# or
npm install -g @pycheck/cli
npm install -g @pycheck/ui

Analysis and history

Run:

pycheckui

Open localhost:5143 in a browser to run an analysis. Note: this uses a .pycheck.db local Sqlite file to store the code quality history

Command line

To do a quick check in the command line (not recorded in history):

pycheck
# or
make pycheck

Unittest

To launch full set of project unittest

make test

Install

To install project on a local dev environment

make install
# Also if need to be logged
make superuser

Launch and access

To launch

make run

To access api docs you need to follow http://localhost:8000/skii/docs To access django admin you need to http://localhost:8000/admin/

Enjoy

All skii source code is licensed with mozilla MPL 2 and all new source python file needs to integrate this headers

# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
# Copyright © Simon ANDRÉ <[email protected]> synw (https://github.com/synw/)
# project: SkiiSchoolPlatform
# github: https://github.com/boot-sandre/skii-school-platform/
# template: https://github.com/synw/django-spaninja

Enjoy and use it :P

skii-school-platform's People

Contributors

boot-sandre avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

skii-school-platform's Issues

Improve makefile test commands

  • Add new makefile included in main one "Makefile_test"
  • Propose new commands test-cov, test-fast, test-lf, test-lf-pdb
  • Update makefile documentation
  • Include makefile documentation in README or project documentation

Integrate a copyleft license

The mozilla MPL 2 look appropriate.

https://www.mozilla.org/en-US/MPL/2.0/FAQ/

Needs to integrate correctly that license in all the project repository and add contributor on and on README

Any opinion, advice, about license issue is welcome.
The goal is to give the most good safety for authors and contributor of this project about not fair commercial use of them software production but let them the possibility to commercialise parts, plugins, frontend, vue widget.

The license itself
https://www.mozilla.org/en-US/MPL/2.0/

Update readme + documentation

Customize readme for skii school platform and add basic setup makefile commands to install/run/test and use of pycheck/quality tools.
May use isort also ?
Also illustration picture needs to be updated

Datetime internationalization settings

Have to put timezone internationalization. It's a need by the EventEntity abstract.
Actually we having:
E TypeError: can't compare offset-naive and offset-aware times
This software may be use by people from different timezone. So we need to support them and use them.

Define release process and packaging

Needs automated way to update version/release in project and documentation with tagged release and package.

We will also use it for docker build

Improve AgendaView

Agenda view contains actually route to fetch lesson by a teacher or student point of view.
We now needs endpoint to

  • Teacher can create lesson and be assigned to
  • Teacher can create lesson and assign another teacher to
  • Teacher can do subscription for a student to a lesson
  • Student can subscribe lesson

Use Natural FK

Actually we mostly use guid: UUID fields to provide models primary keys.

Django provide a nice way to also manage natural FK.

The goal will be to ban id/uuid from backend/frontend data exchange, and use these natural key to create/update records.

Create agenda endpoints

We already have 4 REST likes routes (student/teacher/location/lesson) with create/read/list/update/delete endpoints.

We want now a route to link AgendaController (actually named AgendaInterface) methods.

This AgendaController have been started here:
skii-platform-interfaces

This controller will be the main entrypoint for planning management.

Improve SkiiTestCase with factory generator

Actual

We provide a fixtures file in skii.platform with 5 teacher and 25 students + a superuser.
They are stored on test case property:

def setUp(self) -> None:
    super().setUp()
    self.profile_to_model["student"] = StudentAgent.objects.all()
    self.profile_to_model["teacher"] = TeacherAgent.objects.all()

profile_to_model: Dict[str, Iterable[AgentEntity]] = {
    "student": [],
    "teacher": [],
}

Looks to much for most of case.

Proposition

The project use actually django factories of factoryboy package.

Import all project factory on testcase setup and provide python generator with them wrap.

Pyright better compliance

The actual pycheck score is low because of pyright check. Need to adapt and check all project type.

Api route have to use unique name

Django ninja use for route url reverse the name of the method/view or a provided named arg on view decorateur args.

@router.get(
    path="/fetch/{pk}/",
    response={
        200: RouterContract,
        422: FormInvalidResponseContract,
    },
)
def record_read(request: HttpRequest, pk: IntStrUUID4):

In this case the reverse url of format "api_name:view_name" will be "skii:record_read"

If we have many view with record_read view function name, it's will be impossible to determine which road needs to provide the url resolver.

We need to check all endpoints and use unique name for all of them.
For our example it's will be:

@router.get(
    path="/fetch/{pk}/",
    response={
        200: RouterContract,
        422: FormInvalidResponseContract,
    },
)
def lesson_read(request: HttpRequest, pk: IntStrUUID4):

With unique route name skii:lesson_read

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.