Skip to content

Labs #320

@sofya191107-dot

Description

@sofya191107-dot

import HashMap "mo:base/HashMap";
import Text "mo:base/Text";

actor Labs {
public func AddStudent(Name : Text) : async Bool {
return true;
};

public func SubmitLab(Name : Text) : async Bool {
	return true;
};

public func getStatus(Name : Text) : async Bool {
	return true;
};

public func setTotalLabs(count : Nat) : async Bool {
	return false;
};

public func getStats() : async Nat {
	return 0;
};

var students : HashMap.HashMap<Text, Bool> = HashMap.HashMap<Text, Bool>(0, Text.equal, Text.hash);

var TotalLabs : Nat = 0;

var submittedcount : Nat = 0;

if (Map.containsKey(students, name)) {
	return false;
}
students := Map.insert(students, name, false);
return true;

if (not Map.containsKey(students, name)) {
	return false;
}
let status = Map.get(students, name);
if (status ?) {
	return false;
}
students := Map.insert(students, name, true);
submittedCount := submittedCount + 1;
return true;

if (count == 0) {
	return false;
}
totalLabs := count;
return true;

return Map.get(students, name);

let totalStudents = Map.size(students);
return (totalStudents, submittedCount, totalLabs);

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions