Skip to content

Commit

Permalink
Pre-demo prepwork. Format dates nicely, add two example submissions (#85
Browse files Browse the repository at this point in the history
)
  • Loading branch information
krashanoff authored Mar 8, 2022
1 parent 23555f6 commit 7906d7a
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 5 deletions.
Binary file added example/bad/bad.tar.gz
Binary file not shown.
36 changes: 36 additions & 0 deletions example/bad/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package main

// Example of a submission to our class!

import (
"fmt"
"os"
"strconv"
"strings"
)

func main() {
test_str := "1, Doxa, Theo, gia, ola, ta, pragmata, incorrect"
fmt.Println(strings.Split(test_str, ",")[0:])

argnum := 0
if len(os.Args) > 1 {
argnum, _ = strconv.Atoi(os.Args[1])
_, err := strconv.Atoi(os.Args[1])
if err != nil {
print(err)
return
}
}

if a := argnum; a == 100 {
fmt.Println("2 Definition worked")
} else {
fmt.Println("2 Definition failed")
}

text := "NAME"
if text[4:] == "" {
fmt.Println("3 Empty")
}
}
Binary file added example/good/good.tar.gz
Binary file not shown.
File renamed without changes.
6 changes: 5 additions & 1 deletion example/grade_assignment_one.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ else
fi

# Pretending to do more work...
sleep 5
sleep 1

OUTPUT_1="[1 Doxa ston Theo gia ola ta pragmata]"
OUTPUT_2_WORKED="2 Definition worked"
Expand All @@ -55,6 +55,8 @@ else
echo "SCORE 0.2 0\n"
fi

sleep 1

echo "4"
echo "HIDDEN"
echo "NAME Correct output on failure"
Expand All @@ -76,6 +78,8 @@ else
echo "SCORE 0.2 0\n"
fi

sleep 1

echo "6"
echo "NAME Empty substring"
if [ "$(go run main.go | grep 3)" = "$OUTPUT_3" ]; then
Expand Down
14 changes: 11 additions & 3 deletions frontend/src/Assignment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,9 @@ export default function Assignment() {
<tr onClick={() => setShowUploadSubmissionModal(true)}>
<td>➕ Add a submission</td>
<td></td>
<td></td>
</tr>
) : (
<tr onClick={() => console.log("download")}>
<tr>
<td>
<a
href={blob ? blob : ""}
Expand All @@ -98,7 +97,16 @@ export default function Assignment() {
{data?.submissions?.map((k, idx) => (
<tr key={idx} onClick={() => navigate(`/results/${k.id}`)}>
{data?.professor && <td>{k.owner}</td>}
<td>{k.date}</td>
<td>
{new Date(Date.parse(k.date)).toLocaleString("en-us", {
year: "numeric",
weekday: "long",
day: "2-digit",
month: "2-digit",
hour: "2-digit",
minute: "2-digit",
})}
</td>
<td>{k.pointsEarned}</td>
</tr>
))}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ export interface AssignmentData {
submissions: Array<{
id: string;
owner: string;
date: Date;
date: string;
pointsEarned: number;
}>;

Expand Down

0 comments on commit 7906d7a

Please sign in to comment.