Compare commits
2 Commits
v1.0.0-bet
...
v1.0.0-bet
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8201a2f310 | ||
|
|
b2686ea602 |
@@ -104,10 +104,34 @@ func (t *CodingTask) Setup(ctx context.Context) error {
|
||||
return err
|
||||
}
|
||||
|
||||
go func() {
|
||||
ticker := time.NewTicker(1 * time.Second)
|
||||
defer ticker.Stop()
|
||||
lastMod := t.lastModified
|
||||
|
||||
for {
|
||||
select {
|
||||
case <-ticker.C:
|
||||
if stat, err := os.Stat("./code.txt"); err == nil {
|
||||
if stat.ModTime().After(lastMod) {
|
||||
lastMod = stat.ModTime()
|
||||
if t.app.SubmitChan != nil {
|
||||
select {
|
||||
case t.app.SubmitChan <- models.ValidationTrigger{Source: models.ValidationTriggerAutoPoll}:
|
||||
default:
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
case <-ctx.Done():
|
||||
return
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
func (t *CodingTask) Validate(ctx context.Context) ValidationFeedback {
|
||||
expect := check.NewExpector()
|
||||
|
||||
|
||||
@@ -104,6 +104,35 @@ func (t *GitTask) Setup(ctx context.Context) error {
|
||||
return err
|
||||
}
|
||||
|
||||
go func() {
|
||||
ticker := time.NewTicker(1 * time.Second)
|
||||
defer ticker.Stop()
|
||||
var lastMod time.Time
|
||||
|
||||
if stat, err := os.Stat("./task/.git/index"); err == nil {
|
||||
lastMod = stat.ModTime()
|
||||
}
|
||||
|
||||
for {
|
||||
select {
|
||||
case <-ticker.C:
|
||||
if stat, err := os.Stat("./task/.git/index"); err == nil {
|
||||
if stat.ModTime().After(lastMod) {
|
||||
lastMod = stat.ModTime()
|
||||
if t.app.SubmitChan != nil {
|
||||
select {
|
||||
case t.app.SubmitChan <- models.ValidationTrigger{Source: models.ValidationTriggerAutoPoll}:
|
||||
default:
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
case <-ctx.Done():
|
||||
return
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -203,7 +203,7 @@ templ DashboardContent(props DashboardProps) {
|
||||
name="issue_type"
|
||||
x-model="issue.issue_type"
|
||||
class="select select-sm select-bordered"
|
||||
@change="fetch('/issues/' + issue.id, { method: 'PATCH', body: new URLSearchParams({issue_type: issue.issue_type}) }).then(() => editing = null)"
|
||||
@change="fetch('/issues/' + issue.id, { method: 'PATCH', body: new URLSearchParams({issue_type: issue.issue_type}), headers: { 'HX-Request': 'true' } }).then(() => { editing = null; setTimeout(() => { document.body.dispatchEvent(new CustomEvent('check-status')); }, 1000); })"
|
||||
x-init="$nextTick(() => $el.focus())"
|
||||
>
|
||||
<option value="task">Task</option>
|
||||
@@ -227,7 +227,7 @@ templ DashboardContent(props DashboardProps) {
|
||||
name="priority"
|
||||
x-model="issue.priority"
|
||||
class="select select-sm select-bordered"
|
||||
@change="fetch('/issues/' + issue.id, { method: 'PATCH', body: new URLSearchParams({priority: issue.priority}) }).then(() => editing = null)"
|
||||
@change="fetch('/issues/' + issue.id, { method: 'PATCH', body: new URLSearchParams({priority: issue.priority}), headers: { 'HX-Request': 'true' } }).then(() => { editing = null; setTimeout(() => { document.body.dispatchEvent(new CustomEvent('check-status')); }, 1000); })"
|
||||
x-init="$nextTick(() => $el.focus())"
|
||||
>
|
||||
<option value="0">Irrelevant (P0)</option>
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user