aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--captain/db.f9010
-rw-r--r--captain/external.f9023
-rw-r--r--captain/sql/create.sql6
3 files changed, 35 insertions, 4 deletions
diff --git a/captain/db.f90 b/captain/db.f90
index b607c39..c61ffc7 100644
--- a/captain/db.f90
+++ b/captain/db.f90
@@ -8,6 +8,16 @@ implicit none
character(1024)::database_file
type(c_ptr)::db
+ type :: job
+
+ integer::id
+ integer::instruction
+ integer::player
+ integer::status
+ character(32)::time
+
+ end type
+
contains
subroutine initialize_db(filename)
diff --git a/captain/external.f90 b/captain/external.f90
index 78195f8..1a27be0 100644
--- a/captain/external.f90
+++ b/captain/external.f90
@@ -3,6 +3,27 @@ implicit none
contains
+ function generate_jobs_gemini() result(res)
+ use captain_db
+ implicit none
+
+ character(len=:), pointer::res
+ type(job), dimension(:), pointer::jobs
+ integer::n, i, nsize
+
+ n = get_player_count()
+ if(n == 0) then
+
+ allocate(character(len=1024) :: res)
+
+ res = "None Yet"
+
+ else
+
+ end if
+
+ end function generate_jobs_gemini
+
function generate_players_gemini() result(res)
use captain_db
implicit none
@@ -300,6 +321,8 @@ contains
else if(trim(req%location) == "/jobs.gmi") then
call page%assign('title', 'Jobs')
+ contents => generate_jobs_gemini()
+ call page%assign('contents', contents)
else if(trim(req%location) == "/players.gmi") then
diff --git a/captain/sql/create.sql b/captain/sql/create.sql
index e8198e4..745c536 100644
--- a/captain/sql/create.sql
+++ b/captain/sql/create.sql
@@ -1,12 +1,10 @@
CREATE TABLE players(id INTEGER PRIMARY KEY, name TEXT NOT NULL, token TEXT NOT NULL);
-CREATE TABLE jobs(id INTEGER PRIMARY KEY, player INTEGER DEFAULT NULL, status INTEGER, FOREIGN KEY(player) REFERENCES players(id));
+CREATE TABLE jobs(id INTEGER PRIMARY KEY, player INTEGER, instruction INTEGER, status INTEGER, time TEXT DEFAULT NULL, FOREIGN KEY(player) REFERENCES players(id), FOREIGN KEY(instruction) REFERENCES instructions(id));
CREATE TABLE tasks(job INTEGER, task INTEGER, status INTEGER, FOREIGN KEY(job) REFERENCES jobs(id));
CREATE TABLE instructions(id INTEGER PRIMARY KEY, name TEXT UNIQUE NOT NULL);
-CREATE_TABLE available(instruction INTEGER, player INTEGER, \
- FOREIGN KEY(instruction) REFERENCES instructions(id), \
- FOREIGN KEY(player) REFERENCES players(id));
+CREATE TABLE available(instruction INTEGER, player INTEGER, FOREIGN KEY(instruction) REFERENCES instructions(id), FOREIGN KEY(player) REFERENCES players(id));