From 0facbcb04fcd2d02f7514ad6f936edac1ce1a858 Mon Sep 17 00:00:00 2001
From: Felix Eckhofer <felix@eckhofer.com>
Date: Mon, 30 Dec 2024 15:35:21 +0100
Subject: [PATCH] Add some preliminary documentation

---
 README.md | 92 +++++++++++++++++++++++++++++++++++++++++++++++--------
 1 file changed, 79 insertions(+), 13 deletions(-)

diff --git a/README.md b/README.md
index 7db80e4..ab0038f 100644
--- a/README.md
+++ b/README.md
@@ -1,24 +1,90 @@
-# README
+# C3Lingo rescheduled
 
-This README would normally document whatever steps are necessary to get the
-application up and running.
+> Rapid assignment of shifts for chaos events
 
-Things you may want to cover:
+## Overview
 
-* Ruby version
+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
 
-* System dependencies
+## Dev environment
 
-* Configuration
+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.
 
-* Database creation
+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.
 
-* Database initialization
+## Secrets
 
-* How to run the test suite
+The application requires some secrets, as of writing these include:
 
-* Services (job queues, cache servers, search engines, etc.)
+- `filedrop_user`
+- `filedrop_password`
+- `heartbeat_deen`
+- `heartbeat_more`
+- `telegram_bot_token`
 
-* Deployment instructions
+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.
+
+## 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 generate` Powerful tool to generate boilerplate, see 
+
+### In `rails console`
+
+- Manually trigger sync job
+  ~~~ruby
+  FetchConferenceDataJob.perform_now("38c3")
+  ~~~
+
+- Reset user password
+  ~~~ruby
+  pw = SecureRandom.alphanumeric(12)
+  u = User.find_by(name:"username_here")
+  u.update(password: pw, password_confirmation: pw)
+  u.save!
+  ~~~
+
+- 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)
+  ~~~
-- 
GitLab