Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed backlog issues #128, #127, #118 #152

Merged
merged 3 commits into from
Aug 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 28 additions & 8 deletions src/components/Assignments/AssignUser.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import {
bibleBookNewTestments,
bibleBookOldTestments,
} from "../Common/BibleOldNewTestment";
import swal from "sweetalert";

const styles = (theme) => ({
root: {
Expand Down Expand Up @@ -317,18 +318,37 @@ class AssignUser extends Component {

assignBooksToUser = () => {
const { userId, availableBooksData } = this.state;
const { dispatch, location } = this.props;
const { dispatch, location, assignedUsers } = this.props;
const projectId = location.pathname.split("/").pop();
let assignedUsersBooks = [];
for (var i in assignedUsers) {
//Listing the books of users
if (assignedUsers[i].user.userId === this.state.userId) {
//Checking if not current user then push the books
assignedUsersBooks = assignedUsers[i].books;
}
}
const checkedBooks = Object.keys(availableBooksData).filter(
(book) => availableBooksData[book]["assigned"] === true
);
const apiData = {
projectId: projectId,
userId: userId,
books: checkedBooks,
action: "assign",
};
dispatch(assignUserToProject(apiData, this.closeBookListing));
if (
assignedUsersBooks.sort().toString() ===
checkedBooks.sort().toString()
) {
swal({
title: "Book assignment",
text: "No change in assigned books",
icon: "warning",
});
} else {
const apiData = {
projectId: projectId,
userId: userId,
books: checkedBooks,
action: "assign",
};
dispatch(assignUserToProject(apiData, this.closeBookListing));
}
};

render() {
Expand Down
5 changes: 3 additions & 2 deletions src/components/UploadTexts.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import ComponentHeading from "./ComponentHeading";
import {
uploadBibleTexts,
setCompletedUpload,
setUploadError,
clearUploadError,
} from "../store/actions/sourceActions";
import { connect } from "react-redux";
Expand Down Expand Up @@ -50,7 +49,9 @@ class UploadTexts extends Component {
if (uploadErrorBooks.length > 0) {
swal({
title: "Upload Bible",
text: `Some books failed to upload :-\n${uploadErrorBooks.join(
text: `${
uploadErrorBooks.length
} book(s) failed to upload :-\n${uploadErrorBooks.join(
", "
)}`,
icon: "warning",
Expand Down
Loading