From: Brendan Hansen Date: Thu, 26 Sep 2019 02:59:26 +0000 (-0500) Subject: Added bytes to job result X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=ed3a9e543b7b4db4f56a5dbe3c760878a0e567f1;p=codebox.git Added bytes to job result --- diff --git a/codebox/migrations.moon b/codebox/migrations.moon index 0e23230..c3980d7 100644 --- a/codebox/migrations.moon +++ b/codebox/migrations.moon @@ -1,5 +1,5 @@ import create_table, add_column, types from require "lapis.db.schema" -import insert from require "lapis.db" +import insert, query from require "lapis.db" { [1]: => @@ -104,4 +104,7 @@ import insert from require "lapis.db" add_column "competitions", "word_points", (types.integer default: 500) add_column "competitions", "time_offset", (types.integer default: 0) + + [11]: => + query "alter table jobs add column bytes int generated always as (char_length(code)) stored" } diff --git a/codebox/views/ssr/job_result.moon b/codebox/views/ssr/job_result.moon index 5279864..a279809 100644 --- a/codebox/views/ssr/job_result.moon +++ b/codebox/views/ssr/job_result.moon @@ -12,6 +12,7 @@ class JobResultView extends html.Widget @username = @job\get_user!.username @problem = @job\get_problem! + @bytes = @job.bytes @time_started = @job.time_initiated if @job.data @json_data = from_json @job.data @@ -64,6 +65,9 @@ class JobResultView extends html.Widget div class: "highlight pad-12 pad-b-4 split-lr", -> div "Status:" div "#{@status_str}" + div class: "highlight pad-l-12 pad-r-12 pad-b-4 split-lr", -> + div "Bytes:" + div "#{@bytes}" div class: "highlight pad-l-12 pad-r-12 pad-t-4 pad-b-4 split-lr", -> div "User:" div "#{@username}"