# C3Lingo rescheduled

> Rapid assignment of shifts for chaos events

## Overview

### Features

- **Automatic schedule import** for re:publica, Pretalx/Hub
- **Integrations** with [C3Lingo Filedrop](https://github.com/c3lingo/c3t-drop), [Engelsystem](https://github.com/engelsystem/engelsystem) and more
- **Collaborate live** on session changes using websockets
- **One-click assignment** of angels
- **Express interest** (with optional note) for sessions
- **Stay on top of assignments** with *My Assignments* view and personalized calendar (.ics) feeds
- **Add globally visible notes to sessions**
- **Multiple conferences** supported
- **Conflict detection** even across conferences
- **Self-service account creation** with optional invite-token
- **Manage source and target languages** per angel and per session
- **Dark mode** and (mostly) responsive web app
- **Statistics and leaderboards**
- ... and more 🎁

### Technologies:

- [Ruby on Rails](https://rubyonrails.org/) with [SQLite](https://sqlite.org/) DB
- [Tailwind CSS](https://tailwindcss.com/)
- [Turbo](https://turbo.hotwired.dev/) + [Stimulus](https://stimulus.hotwired.dev/)
- [ActionCables](https://guides.rubyonrails.org/action_cable_overview.html) with [Redis](https://redis.io/) backend

## Dev environment

The project comes with a devcontainer for VSCode and compatible editors. Simply open the project folder in Code (or using `devcontainer open <path>`) and after a few seconds, a suitable container should be ready.

Run `bin/dev` in the integrated terminal to start the dev webserver and the tailwind watch job (see `Procfile.dev` for details). Access your local rescheduled at http://127.0.0.1:3000.

## Secrets

The application requires some secrets, as of writing these include:

- `filedrop_user`
- `filedrop_password`
- `heartbeat_deen`
- `heartbeat_more`
- `telegram_bot_token`

You can supply the secrets by running `rails credentials:edit` or pass them as environment variable in upper case (e.g. `FILEDROP_USER`).

## Preparation for an event

tbd.

- talks about seeds
- set "relevant stages"
  ~~~ruby
  relevant = ["Saal 1", "Saal ZIGZAG", "Saal GLITCH", "Stage HUFF", "Stage YELL", "Canceled talk"]
  conf=Conference.find_by(slug: "38c3")
  conf.relevant_stages=conf.stages.select { |val| relevant.include?(val[:name]) }
  ~~~
- sort stages
  ~~~ruby
  Stage.where(name: "Saal 1").update(weight: 10)
  Stage.where(name: "Saal GLITCH").update(weight: 20)
  Stage.where(name: "Saal ZIGZAG").update(weight: 30)
  Stage.where(name: "Stage HUFF").update(weight: 40)
  Stage.where(name: "Stage YELL").update(weight: 50)
  ~~~

## In production

See [rescheduled-deploy](https://git.cccv.de/c3lingo/rescheduled-deploy) for a full docker-compose stack and more explanations.

# Colors (darkmode)

- **text**: text-slate-300
- **text (overlay)**: text-slate-200
- **text light**: text-slate-400

- **logo**: text-white
- **highlight**: text-red-500

- **dark background**: bg-zinc-700
- **light background**: bg-gray-900
- **overlay**: bg-gray-600
- **input**: bg-zinc-900
- **shadow**: gray-400

## Tips and Tricks

### Helpful `rails` tasks

By running `bin/rails <command>` you can trigger some helpful actions, such as

- `rails c[onsole]`: Start interactive ruby shell
- `rails db`: Start sqlite shell with the currently used DB
- `rails db:migrate`: Run pending DB migrations, automatically done by docker image on start
- `rails db:seed` (Re-)import DB seeds from `db/seeds.rb`
- `rails secret` generate a random secret, e.g. for `secret_key_base`
- `rails generate` Powerful tool to generate boilerplate, run it to see list of options

### In `rails console`

- Manually trigger sync job
  ~~~ruby
  FetchConferenceDataJob.perform_now("38c3")
  ~~~

- Promote user to shiftcoordinator
  ~~~ruby
  User.find_by(name:"username_here").update(shiftcoordinator: true)
  ~~~

- Reset user password
  ~~~ruby
  pw = SecureRandom.alphanumeric(12)
  User.find_by(name:"username_here").update(password: pw, password_confirmation: pw)
  ~~~

- Print differences between local assignments and those in the engelsystem (taking into account assignments in the "variant conferences")
  ~~~ruby
  Conference.find_by(slug:"38c3").compare_engelsystem_shifts([Conference.find_by(slug:"38c3-more"), Conference.find_by(slug: "38c3-orga")])
  ~~~

- Send a test message to Telegram
  ~~~ruby
  TelegramGroupChatNotificationJob.perform_now(text: "der habicht sieht die gegenwart")
  ~~~

- List all notes angels put in their candidacies:
  ~~~ruby
  Candidate.includes(:user, :session).where.not(note: [nil, ""]).pluck('sessions.title','users.name', :note)
  ~~~

## License

re:scheduled is licensed under the GNU Affero General Public License, Version 3.