aboutsummaryrefslogtreecommitdiff
path: root/captain
diff options
context:
space:
mode:
Diffstat (limited to 'captain')
-rw-r--r--captain/db.f902
-rw-r--r--captain/external.f9050
2 files changed, 43 insertions, 9 deletions
diff --git a/captain/db.f90 b/captain/db.f90
index a661fd4..7937383 100644
--- a/captain/db.f90
+++ b/captain/db.f90
@@ -512,7 +512,7 @@ contains
if(stmt%step() == SQLITE_ROW) then
get_job%instruction = stmt%column_int(0)
get_job%player = stmt%column_int(1)
- get_job%player = stmt%column_int(2)
+ get_job%status = stmt%column_int(2)
if(stmt%column_type(3) == SQLITE_NULL) then
get_job%time = "Not started"
else
diff --git a/captain/external.f90 b/captain/external.f90
index db34a11..d9e2a7e 100644
--- a/captain/external.f90
+++ b/captain/external.f90
@@ -175,22 +175,22 @@ contains
character(1)::nl = new_line(' ')
type(task), dimension(:), pointer::tasks
- character(16)::task_text, job_text
+ character(32)::task_text, job_text
res => null()
-
- i = index(req%location, "/", back=.true.)
- j = index(req%location, ".", back=.true.)
-
- job_text = req%location(i+1:j-1)
- read(job_text, *) job_id
+
+ ! Ugh, all this nonsense
+ call req%last_component(job_text)
+ j = index(job_text, ".", back=.true.)
+ job_text(j:len(job_text)) = " "
+ read(job_text, '(I8)') job_id
one_job = get_job(job_id)
if(one_job%id >= 0) then
allocate(character(len=1024) :: res)
status = get_status_utf8(one_job%status)
- res = "## Job "//job_text//" - "//status
+ res = "## Status - "//status
call get_player_name(one_job%player, player)
res = trim(res)//nl//nl//"Running on "//trim(player)//nl//"Last update at: "//one_job%time
@@ -221,6 +221,32 @@ contains
end function generate_one_job_gemini
+
+ subroutine get_job_page_title(req, title)
+ use captain_db
+ use server_response
+ implicit none
+
+ type(request), intent(in)::req
+ character(*), intent(out)::title
+
+ integer::job_id, i
+ character(32)::job_text
+ character(PLAYER_NAME_LENGTH)::instruction_name
+
+ ! All this to get the job id
+ call req%last_component(job_text)
+ i = index(job_text, ".")
+ job_text(i:len(job_text)) = " "
+ read(job_text, '(I8)') job_id
+
+ ! Request instruction name
+ i = get_job_instruction(job_id)
+ call get_instruction_name(i, instruction_name)
+
+ title = "Job "//trim(job_text)//" - "//trim(instruction_name)
+
+ end subroutine get_job_page_title
function generate_players_gemini() result(res)
use captain_db
@@ -654,6 +680,7 @@ contains
type(template)::page
character(len=:), pointer::contents
character(64)::first
+ character(128)::job_page_title
! Open the base template
call template_filepath("index.gmi", template_file)
@@ -702,6 +729,13 @@ contains
call page%assign('title', 'Build Instructions')
contents => generate_one_instuction_gemini(req)
call page%assign('contents', contents)
+
+ else if(trim(first) == "jobs") then
+
+ call get_job_page_title(req, job_page_title)
+ call page%assign('title', trim(job_page_title))
+ contents => generate_one_job_gemini(req)
+ call page%assign('contents', contents)
else