Giter Site home page Giter Site logo

ksg-it / ksg-nett Goto Github PK

View Code? Open in Web Editor NEW
9.0 9.0 1.0 3 MB

Backend for KSG-nett

Home Page: https://app.ksg-nett.no

License: GNU General Public License v3.0

Python 87.97% Makefile 0.14% HTML 5.27% Shell 0.14% JavaScript 5.22% CSS 1.17% Dockerfile 0.09%
ksg samfundet

ksg-nett's Introduction

KSG-nett backend

Build Status

Overview

This repository contains the source code for KSG's web page. The project is written in Django exposing a graphQL API using graphene. KSG-nett is a two-part webapplication, this being the backend and requires a fucntioning frontend instance to be running. Follow the link and the quickstart section over there in addition to here to get everything up and running.

Quickstart

Dependencies are managed with poetry. To run the code do the following

  1. Make sure you have python 3.8 available on the computer
  2. install poetry on your computer
  3. Install Weasyprint (make sure to follow instructions thoroughly before going on to the next step)
  4. Clone and Navigate to this folder
  5. Install the dependencies by running poetry install
  6. Migrate the database with poetry run python manage.py migrate
  7. Run the projects by running poetry run python manage.py runserver

Other dependencies

We use black as a code formatter. We enforce this with the use pre-commit. Make sure to have this installed locally otherwise code formatting will not be automaically applied.

Branch formatting guidelines

Usually tasks are assigned through Shortcut stories, with a story type which is either a feature, bug or chore, and a story id. This is used to track progress on the task throughout development. A given branch will automatically get tracked if the branch includes sc-<story-id> anywhere in its name.

  • Our branches follows a convention of story-type/sc-<story-id>/branch-name

So a story which is a bug type, with an id of 666 and a title of "Dashboard renders wrong data" would be named bug/sc-666/dashboard-renders-wrong-data or similar.

ksg-nett's People

Contributors

alexaor avatar catthiba avatar chdefrene avatar dependabot-preview[bot] avatar dependabot-support avatar dependabot[bot] avatar haakonte avatar kharann avatar oystebha avatar plebbimon avatar togg1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

deepanshumehtaa

ksg-nett's Issues

Initial Update

The bot created this issue to inform you that pyup.io has been set up on this repo.
Once you have closed it, the bot will open pull requests for updates as soon as they are available.

Auto-terminate inactive sessions / Crontab

While implementing soci sessions, I thought about the possibility of users forgetting to log out when leaving Soci (something that happens fairly often). While the client could handle this and terminate the active session after a certain period of inactivity, this will not work if the program is closed or has lost the connection.
The result in this case will be that the session lasts until a new session is started - which might be everywhere from a few hours to many days.

If we indeed deem this a problem, one possible solution could be to install a crontab utility and have an auto-termination job running. We could potentially also remove manual termination of sessions altogether with this feature on. And, of course, we will have a fully functioning crontab that can be used for other stuff as well.

Initial economy homepage design implementation

The /internal/economy/ view has a lot of functionality but absolutely no design implementation. We should have an initial implementation of the view such that one can easily see ones own account balance, make a deposit and see all approved and unapproved deposits.,

Redesign of menu header

Posting this to see what other people feel about this. The current design looks good with a dropdown menu with subcontent, however I feel like this comes at the cost of ease of access. Could we consider a design where the subcontent is accessible from the header itself?

Some of this is solved with the not implemented footer although this then again is not as readily available as the page-header.

This eesentially means a split going from:
KSG MENY PROFILE
where MENY expands into

  • Vakter
  • Referater
  • Gjengen
  • Info
  • Underholdning
  • Kalender
  • Sitater
  • Logout

To a header where the points above are included from the getgo.

Issue is relevant for @KSG-IT/design

API endpoint to check user ability to afford products for burger-list

Suggestion to have API endpoints such that whenever we get a tablet-application rolling that one can generate a list of whoever is working, with the ability to modify said list and then do a "check" for that list returning whether or not anyone on the list cannot afford what they are about to purchase for stilletime. This is not to be confused with a purchase-order, the idea is that people can make orders, which are then added to the list, if anyone does not have sufficient funds the tablet-user would get feedback regarding who does not have sufficient funds. The list could then later be "locked" when people have had the opportunity to transfer funds.

TL;DR
API endpoint that accepts a complete list of people and their respective orders, returns list of boolean values whether or not people have sufficient funds. Then maybe another endpoint for the actual locking and withdrawal of funds if it is not implemented already.

Create model SociSession

Should be used to keep track of what user was responsible for a session at Soci.

Needs a field for start and end datetime.

Connect the model to /authentication/obtain-token/ in order to automatically create a session when a user logs in.

Need to discuss whether we need a new EP for users to end the soci session, or if we end it when a new login is made.

Admission list view

A list view of past admissions with the possibility to open up a new admission process, this issue should solve the following:

  • Display all past and ongoing admission processes
  • Allow for opening a new admission process
  • Allow for closing an ongoing admission process
  • Click on an admission entry which links to a detail view of an admission

This is currently missing a design spec which means the implementation can focus on mostly the functional aspect of it. This is blocked by issue #156

Fix one summary per line

The links to the summaries on the landing page currently wraps more than one summary per line.

Should be fixed by amending the css wit ha display: inline-block

Move dependency management to pipenv?

There seems to be some traction behind the tool pipenv.
The tool seems to greatly simplify dependency management for python projects.

Should we perhaps consider moving to using pipenv, and hence the new Pipfile/Pipfile.lock format?

SociProducts `valid_from` field

This way, users can plan ahead before their shift starts and add new products that should be sold at some point in the future.

Schedule statistic manager

Would be neat to have a manager to do an aggregation of useful data with regards to managing shifts. Things which I can think of on the top of my head would be the average number of shifts for a given group e.g. "Barservitør", then it would be possible to return the deviation a single person has from the average number of shifts which essentially gives a specific number of how many shifts extra or missing shifts a person has.

Add some guidelines for how to name css-classes

Personally I have written some light version of BEM for all css-classes. We should probably make some project-wide recommendations in CONTIRBUTING.md or the wiki.

We don't have to follow BEM, though I personally like it.

InternalGroup and InternalGroupPosition

Looking at the InternalGroup and InternalGroupPosition models, I think perhaps they should be rewritten slightly. I am not actually sure that it makes sense to limit the names by choices. Or put differently, I am not sure if the possible groups should be limited from the code-side.

Also, InternalGroupPosition should potentially be directly related to one InternalGroup.

I am assigning this task to myself, as I am due to start implement the frontend pages related to these (and similar models). This issue should be potentially resolved before the frontend is implemented.

Implement people quiz

Create the quiz. Very good issue message. Please update.

Quizes

  • De nye.
  • De gamle.
  • De aktive.
  • Funkene
  • Generelt per commission.

Implement detail view for a X-list

Implement a rough draft of the X-list (Krysseliste). Should be able to do the following

  • Add an entry with product, amount and user as a list entry
  • Edit existing entry
  • Remove existing entry
    All these actions should only be executable if a list is not closed.

There is not an existing design to this detail view, but in the first round it could prioritize a series list entries where each entry equates to a given post request. Bank accounts should not be charged before closing a list for simplicity's sake

'Dine vakter' styling when number of upcoming shifts < 2

The position of the title in the 'next-shift' block should be fixed.

Should be fixed by giving the container constant height instead of a function of its content, then letting any upcoming shifts cascade downwards. If there are no upcoming shifts this should be reflected in the containers content as well

SIngle user select component

A component which can be used to select a user.

Preferably one with search filtering enabled.

See design spec at figma

Implement image slideshow

Implementation of basic slideshow. The intent of this is to have a slideshow with different events or latest album added or something like that.

The confirmed quotes shown in quotes_list is hardcoded

The particular line performing the logic is

    {% if quote.get_semester_of_quote == 'H18' %}

We can work around doing a check in the view, by filtering the correct quotes on the backend. For instance, by adding a custom manager for the Quote model, eg named this_semester, so we can filter

Quote.this_semester.all()

This can of course also be solved by doing the filtering every location it is needed, e.g. in the quotes_list view.

Comments on deposits

Make it possible for users to comment back, admins to add comments and change it to a DepositComment with a foreign key to Deposit.

Register applicant to admission process

A view to register an applicant to an admission process.

No current design spec, but should include some relevant information about the user.

Will require adding a FK field from the user model. Not sure if the field should be nullable or not, ideally every user should be related to an admission, but might complicate data migration?

Is blocked by #156

Allow creating client API secret keys

We should have a model that allows us to generate and keep track of secret keys for all clients we want to connect to the KSG API.

The key can for instance be saved inside the XApp and used for all authentication purposes when starting a soci session. If the key is compromised, we remove it from the backend and generate a new one.

Comments on Deposits

We got an e-mail with a feature suggestion: Having the possibility to add comments on Deposits. This is useful in cases where deposits are for some reason not valid (bad receipts, etc.).

Missing bio field in User model

In our design of the profile page, there seems to be a small bio the user can write about him/herself. We are currently lacking this in the User model. Should we perhaps add a TextField bio or similar to the User model?

This is perhaps something you can add @alexaor, as you are already working on the User model somewhat?

Remove 'Nyheter' block

Whole block should simply be removed from the landing page. Might be replaced with something else later down the line

Pagination of X-lists/soci-sessions

At some point X-lists/soci-sessions will grow to a large number such that we cannot display everything in a single view, thus requiring some sort of pagination.

Admission detail view

A view to look at detailed information regarding an admission process.

No design spec but should be a list view of registered applicants

Blocked by #156

Coveralls not building

Currently no pull requests manage to run the coveralls test. Last working build was run on the 4th of December and new PR are stuck on 'Expecting result' from the build.

Referencing lemurheavy/coveralls-public#905 which seems to have had the same problem and could be a possible solution.

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.