-
Notifications
You must be signed in to change notification settings - Fork 24
Open
Description
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
Labels
No labels