Commit 617d54e2 authored by ras19's avatar ras19
Browse files

Completed backend frontend connection for assigning project to users [RS, EW]

parent 722f925c
Pipeline #202661 passed with stage
in 44 seconds
......@@ -16,7 +16,7 @@ def get_all_assignments():
@user_project.route('/user_project/<assignment_id>', methods=['GET'])
def assign_project(assignment_id):
def get_single_assignment(assignment_id):
entry = User_project.query.get(assignment_id)
return jsonify(
username=entry.username,
......
......@@ -10,9 +10,7 @@ const CreateProject = () => {
const [location, setLocation] = useState("");
const [files, setFiles] = useState("");
const [selectUsers, setSelectUsers] = useState([]);
const [username, setUsername] = useState("");
const [pid, setPid] = useState("");
const [selectUsernames, setSelectUsernames] = useState([]);
const history = useHistory();
......@@ -34,8 +32,7 @@ const CreateProject = () => {
const project_id = responseJSON.id;
selectUsers.map(user => {
setUsername(user.username);
selectUsernames.map(username => {
const assign_project = { username, project_id };
fetch("/user_project", {
......@@ -85,7 +82,7 @@ const CreateProject = () => {
<option value="Other">Other</option>
</select>
<label>Volunteers assigned to this project</label>
<select multiple={true} onChange={(e) => setSelectUsers(selectUsers.concat(e.target.value))} value={selectUsers} >
<select multiple={true} onChange={(e) => setSelectUsernames(selectUsernames.concat(e.target.value))} value={selectUsernames} >
{users.map(user => <option value={user.username}>{user.firstname} {user.surname}</option>)}
</select>
<label>Google Drive folder</label>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment