Compare commits

...

8 Commits

Author SHA1 Message Date
b67eb2d778 add insta task
All checks were successful
Check / tests (push) Successful in 12m44s
2025-10-20 19:38:04 +02:00
511bfb8f73 add poster task
Some checks failed
Check / tests (push) Has been cancelled
2025-10-20 19:34:55 +02:00
b61466549e add mailbox task
All checks were successful
Check / tests (push) Successful in 10m24s
2025-04-01 00:08:09 +02:00
c5fff78c83 tasks update
All checks were successful
Check / tests (push) Successful in 10m4s
2025-01-22 13:20:21 +01:00
9cdab949f4 add Fridge task
All checks were successful
Check / tests (push) Successful in 9m41s
2025-01-06 18:21:41 +01:00
610269a142 Merge pull request 'Actions Runner test' (#1) from runner_test into master
All checks were successful
Check / tests (push) Successful in 8m49s
Reviewed-on: #1
2024-10-23 23:05:17 +02:00
886feef65a fix task::Trash descr again
All checks were successful
Check / tests (push) Successful in 8m48s
Check / tests (pull_request) Successful in 9m3s
2024-10-23 22:42:41 +02:00
e9bd8610fe fix task::Trash description
All checks were successful
Check / tests (push) Successful in 8m57s
Check / tests (pull_request) Successful in 8m55s
2024-10-23 22:19:30 +02:00

67
main.go
View File

@@ -2,51 +2,24 @@ package main
import (
"database/sql"
"encoding/json"
"flag"
"fmt"
"html/template"
"log"
"net/http"
"time"
"encoding/json"
_ "github.com/mattn/go-sqlite3"
)
func GetDefaultTasks() []Task {
return []Task{
//{
// Name: "Title",
// Description: ``,
// IsOptional: true,
//},
//{
// Name: "Promotion",
// Description: `
// (make a post on the website to promote openings times and for each film event, posting description and announcement on telegram channel, forwarding it to telegram groups, making a fb event, making a post about fb event on the fb page, sharing the event to fb groups)
// `,
// IsOptional: false,
//},
{
Name: "Opening",
Description: `(checking toilet if there is toilet paper and fresh towel, refill fridge, sorting deposit bottles, quickly tidy up the place)`,
IsOptional: false,
},
//{
// Name: "Entering",
// Description: `(checking if there are new books to be entered into the library catalogue, categorizing them, stamping them, putting them into the book shelf)`,
// IsOptional: true,
//},
//{
// Name: "PrepareKuefa",
// Description: `(includes preparing the cutting boards and knives and all devices needed to prepare food. Including potential visitors in this action, preparing chairs, tables and benches outside of malo for people to eat and chill outside)`,
// IsOptional: true,
//},
//{
// Name: "CookingKuefa",
// Description: `(choosing a dish/recipe, doing shopping or arranging somebody to do shopping, cooking, serving)`,
// IsOptional: true,
//},
{
Name: "Closing",
Description: `(includes cleaning up, tidying up, rearranging chairs, closing or arranging somebody to lock the front and back doors)`,
@@ -54,7 +27,7 @@ func GetDefaultTasks() []Task {
},
{
Name: "WeeklyToilet",
Description: `(whiping the floor in the bathroom, clean toilet, clean sink, check soap and menstruation supplies)`,
Description: `(whiping the floor in the bathroom, empty trash, clean toilet, clean sink, check soap and menstruation supplies)`,
IsOptional: false,
},
{
@@ -64,7 +37,7 @@ func GetDefaultTasks() []Task {
},
{
Name: "Trash",
Description: `(empty the trash and take care the boxes are not super duper disgusting)`,
Description: `(empty the trash and take care the boxes are not ultra disgusting)`,
IsOptional: false,
},
{
@@ -72,6 +45,26 @@ func GetDefaultTasks() []Task {
Description: `(take care of the plants. they need water, but not too much!)`,
IsOptional: false,
},
{
Name: "Fridge",
Description: `(Check the fridges (kitchen and main room) for nasty stuff and try to remove it.)`,
IsOptional: false,
},
{
Name: "Check Mailbox",
Description: `(Go to mailbox, open it, look if there are letters inside, if yes bring them into malo)`,
IsOptional: false,
},
{
Name: "Poster Check",
Description: `(Check current Posters in the main window, make sure they look nice and are not outdated)`,
IsOptional: false,
},
{
Name: "Weekly Insta Post",
Description: `(Post something on instagram, like a newly printed zine, kuefa or whatever)`,
IsOptional: false,
},
}
}
@@ -132,13 +125,13 @@ func CreateTasklist(date string, db *sql.DB) Tasklist {
}
return Tasklist{
Date: date,
Date: date,
Tasks: tasks,
Updated: false,
}
}
func InsertToDB(tasklist Tasklist, db *sql.DB) {
func InsertToDB(tasklist Tasklist, db *sql.DB) {
stmt, err := db.Prepare("select name from tasklists where name = ?")
if err != nil {
@@ -151,14 +144,14 @@ func InsertToDB(tasklist Tasklist, db *sql.DB) {
err = stmt.QueryRow(tasklist.Date).Scan(&name)
if err != nil {
_, err := db.Exec("insert into tasklists(name, "+ "Data" +") values(?, ?)", tasklist.Date, TasksToJson(tasklist.Tasks))
_, err := db.Exec("insert into tasklists(name, "+"Data"+") values(?, ?)", tasklist.Date, TasksToJson(tasklist.Tasks))
if err != nil {
fmt.Println("Error during insert: ", err)
}
} else {
_, err := db.Exec("update tasklists set " + "Data" +" = ? where name = ?", TasksToJson(tasklist.Tasks), tasklist.Date)
_, err := db.Exec("update tasklists set "+"Data"+" = ? where name = ?", TasksToJson(tasklist.Tasks), tasklist.Date)
fmt.Println(TasksToJson(tasklist.Tasks))
if err != nil {
@@ -171,11 +164,11 @@ type Task struct {
Name string `json:"Name"`
Description string `json:"Description"`
Value string `json:"Value"`
IsOptional bool `json:"IsOptional"`
IsOptional bool `json:"IsOptional"`
}
type Tasklist struct {
Date string
Date string
Tasks []Task
Updated bool
}
@@ -187,7 +180,7 @@ func TasksFromJson(tasks string) []Task {
if err != nil {
fmt.Println("Error during TasksFromJson")
fmt.Println(err)
return nil
return nil
}
return result