[][src]Struct rubric::dropbox::submission::Submission

pub struct Submission {
    pub time: DateTime<Local>,
    pub grade: isize,
    pub data: TestData,
    pub late: bool,
    pub passed: Vec<String>,
    pub failed: Vec<String>,
    // some fields omitted
}

A submission is a bundle of data that represents one student's submission. They will do some sort of work for a lab, then run a rust script that builds some criteria, runs those criteria with some data from the student, and submits a Submission to a central webserver where the instructor can collect the graded submissions.

Fields

time: DateTime<Local>

A local timestamp when the submission was created

grade: isize

Numerical grade for the submission. Each criterion will add to this grade if it passes.

data: TestData

Extra data attached to the submission. Leave it empty if you don't need it

late: bool

If the submission is late or not

passed: Vec<String>

The criteria (name) that this submission passed

failed: Vec<String>

The citeria (name) that this submission failed

Implementations

impl Submission[src]

pub fn new() -> Submission[src]

Creates a new submission.

Example

use rubric::Submission;

// You probably want it to be mutable so
// you can attach data and change the grade
let mut sub = Submission::new();

assert_eq!(sub.grade, 0);
assert_eq!(sub.data.len(), 0);

pub fn use_data(&mut self, data: TestData)[src]

Attaches data to a submission

The data must be a TestData. You may want to use the data! macro to make it easier to establish your data.

You may be interested in Submission::from_data.

Example

let data = data! {
    "key" => "value",
    "key2" => "value2"
};

let mut sub = Submission::new();
sub.use_data(data);

assert_eq!(sub.data["key"], "value");
assert_eq!(sub.data["key2"], "value2");

pub fn from_data(data: TestData) -> Self[src]

Creates a new submission and attaches data to it in one step

Example


let sub = Submission::from_data(data! {
    "name" => "luke i guess",
    "id" => "1234"
});

assert_eq!(sub.data["id"], "1234");

pub fn set_fingerprint(&mut self, secret: &str)[src]

Creates a fingerprint based on the provided secret key.

The fingerprint will contain the secret key and some automatically collected platform information.

let mut sub = Submission::new();
sub.set_fingerprint("My secret key");

pub fn fingerprint(&self) -> &Option<Fingerprint>[src]

Returns the submissions fingerprint. It may not be set.

pub fn grade_against(&mut self, rubric: &mut Rubric)[src]

Tests a submission against a list of criterion

pub fn submit(&self, url: &str) -> Result<Response, Error>[src]

Posts the submission to the URL in JSON format. Meant to be sent to a dropbox. Really just calls helpers::web::post_json.

pub fn set_timestamp_format(&mut self, new_format: &str)[src]

Overrides the default timestamp format. The default is %F %a %T %:z which gives

2001-08-04 Thu 00:34:60 +09:30

This timestamp format is human readable and also sortable in a spreadsheet.

Trait Implementations

impl AsCsv for Submission[src]

fn as_csv(&self) -> String[src]

Returns the submission's values in csv format. The TestData atttached will be sorted alphabetically by key.

fn filename(&self) -> String[src]

Returns the filename to use when writing submissions to disk

fn header(&self) -> String[src]

Returns a header of all the fields, matching the data in as_csv

impl Debug for Submission[src]

impl<'de> Deserialize<'de> for Submission[src]

impl PartialEq<Submission> for Submission[src]

impl Serialize for Submission[src]

impl StructuralPartialEq for Submission[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T, I> AsResult<T, I> for T where
    I: Input, 

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> IntoCollection<T> for T

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Typeable for T where
    T: Any

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,