brodsa / findmereadme Goto Github PK
View Code? Open in Web Editor NEWPortfolio Project 4 | Code Institute
Home Page: https://findme-readme-10d0bfb3ba28.herokuapp.com/
Portfolio Project 4 | Code Institute
Home Page: https://findme-readme-10d0bfb3ba28.herokuapp.com/
There is a server error 500 on production database after submitting the form to register the book
EPIC: Book registration
As a developer, I want to validate the user input, so that the inputs for database are correct and the page is not broken
ACCEPTANCE CRITERIA
TASKS
EPIC: Registered User
As a user, I want to search on the page a book according to the book name.
ACCEPTANCE CRITERIA
** TASKS**
There is a bug in the logic which of setting up the use status. The logic as well as filter buttons were removed so that the code stays clean.
Related Issue: #25
Effected scripts, where the code was removed.
template/base.html
<script type="module" src="{% static 'js/script.js' %}"></script>
books/template/includes/search_book.html
<div class="search__container ps-4 pe-4 ms-2 d-flex flex-column flex-lg-row align-items-center gap-lg-2">
<p class="m-0 p-0 text-center">Filters</p>
<div class="filter__buttons">
<button class="btn book__button hero__button--primary book__button--active" id="btnAll" aria-label="Filter all books">
All
</button>
<button class="btn book__button hero__button--primary" id="btnCreator" aria-label="Filer books by creator">
Created
</button>
<button class="btn book__button hero__button--primary" id="btnContributor" aria-label="Filter books by my contribution">
Contributed
</button>
</div>
</div>
books/template/books_list.html
<!-- data-book: creator or contributor -->
{% for item in book.get_user_status %}
{{ item }}
{% if request.user|stringformat:"s" == item.user__username and book.title == item.title and item.book_contribution__user__username == item.user__username %}
<a href="{% url 'book_detail' book.id %}" class="book" data-book="creator" aria-label="Click to see more details for {{ book.title }}">
{% else %}
{% if request.user|stringformat:"s" == item.book_contribution__user__username and book.title == item.title and item.book_contribution__user__username != item.user__username %}
<a href="{% url 'book_detail' book.id %}" class="book" data-book="contributor" aria-label="Click to see more details for {{ book.title }}">
{% endif %}
{% endif %}
{% endfor %}
<!-- data-book: visitor -->
{% if request.user|stringformat:"s" not in book.get_contribution_users %}
<a href="{% url 'book_detail' book.id %}" class="book" data-book="visitor" aria-label="Click to see more details for {{ book.title }}">
books/models.py
def get_user_status(self):
q = (
Book
.objects
.select_related('user')
.prefetch_related('book_contribution')
.values(
'title',
'user__username',
'book_contribution__user__username')
)
print(q)
return q
statitic/js/script.js
const btnAll = document.querySelector('#btnAll');
const addListenerOnButtons = () => {
// Function to filter the books based on the button which is clicked on
// options are all, created, contributed
const bookAll = document.querySelectorAll('.book');
const bookContributor = document.querySelectorAll('[data-book="contributor"]');
const bookCreator = document.querySelector('[data-book="creator"]');
const bookVisitor = document.querySelector('[data-book="visitor"]');
const btnContributor = document.querySelector('#btnContributor');
const btnCreator = document.querySelector('#btnCreator');
// Button All
btnAll.addEventListener('click', (e)=>{
// if all is active
btnAll.classList.toggle('book__button--active');
if (btnAll.classList.contains('book__button--active')){
// display all books
bookAll.forEach((book) => book.classList.remove('hidden'));
// deactivate buttons for created and contributed
btnContributor.classList.remove('book__button--active');
btnCreator.classList.remove('book__button--active');
} else{
bookAll.forEach((book) => book.classList.add('hidden'));
}
});
// Button Contributor
btnContributor.addEventListener('click', (e)=>{
btnContributor.classList.toggle('book__button--active');
// if the button Contributed is active
if (btnContributor.classList.contains('book__button--active')){
// display all contributed books
if(bookContributor !=null ){
if (Array.isArray(bookCreator)){
bookContributor.forEach((book) => book.classList.remove('hidden'));
}else{
if (bookContributor.classList != null ){
bookContributor.classList.remove('hidden');
}
}
}else{
bookAll.forEach((book) => book.classList.add('hidden'));
}
if (bookCreator != null){
// hide creator
if(Array.isArray(bookCreator)){
bookCreator.forEach((book) => book.classList.add('hidden'));
}else{
if (! bookCreator.classList.contains('hidden')){
bookCreator.classList.add('hidden');
}
}
}
if (bookVisitor != null){
// hide visitor
if(Array.isArray(bookVisitor)){
bookVisitor.forEach((book) => book.classList.add('hidden'));
}else{
if (! bookVisitor.classList.contains('hidden')){
bookVisitor.classList.add('hidden');
}
}
}
}else{
// show all
bookAll.forEach((book) => book.classList.remove('hidden'));
}
});
// Button Creator
btnCreator.addEventListener('click', (e)=>{
btnCreator.classList.toggle('book__button--active');
// if the button Creator is active
if (btnCreator.classList.contains('book__button--active')){
// display all creator books
if (bookCreator != null){
if (Array.isArray(bookCreator)){
bookCreator.forEach((book) => book.classList.remove('hidden'));
}else{
if(bookCreator.classList.contains('hidden')){
bookCreator.classList.remove('hidden');
}
}
}else{
bookAll.forEach((book) => book.classList.add('hidden'));
}
if (bookContributor != null){
// hide contributor
if (Array.isArray(bookContributor)){
bookContributor.forEach((book) => book.classList.add('hidden'));
}else{
if (bookContributor.classList != null){
bookContributor.classList.add('hidden');
}
}
}
if (bookVisitor != null){
// hide visitor
if(Array.isArray(bookVisitor)){
bookVisitor.forEach((book) => book.classList.add('hidden'));
}else{
if (bookVisitor.classList != null){
bookVisitor.classList.add('hidden');
}
}
}
}else{
//show all
bookAll.forEach((book) => book.classList.remove('hidden'));
}
});
};
if (btnAll != null){
addListenerOnButtons();
}
EPIC: Book contribution
As a user, I want to have the possibility to delete my contribution, so that I can have a full control about the published details.
ACCEPTANCE CRITERIA
** TASKS**
EPIC: Book contribution
As a admin, I want that a book is identified based on its key which is inserted in the input field, so that the whole process is secured.
ACCEPTANCE CRITERIA
TASKS
EPIC: Deployment
As a developer, I wan to the final page is deployed, so that user can use all implemented features
ACCEPTANCE CRITERIA
** TASKS**
EPIC: User Registration
As a user, I want to delete my user account information, so that I can unregister.
ACCEPTANCE CRITERIA
** TASKS**
EPIC: Registered users
As a user I want to get a feedback when doing CRUD so that I know the changes were successfully made.
ACCEPTANCE CRITERIA
** TASKS**
EPIC: Contact
As a developer, I want to provide users and visitors with a contact form, so that I can control what information they provide.
ACCEPTANCE CRITERIA
** TASKS**
EPIC: Book Registrations
As a user, I want to know the book information so that I can have a better information about the book.
ACCEPTANCE CRITERIA
TASKS
EPIC: Contact
As a user, I want to have a possibility to contact a developer, so that I can provide my feedback
ACCEPTANCE CRITERIA
** TASKS**
EPIC: General Information
As a developer, I need to create the base.html page and structure so that other pages can reuse the layout.
ACCEPTANCE CRITERIA
** TASKS**
EPIC: General Information
As a user, I want to know the social media links, so that I can follow the latest update
ACCEPTANCE CRITERIA
TASKS
EPIC: Book View
As a user I want see the details about the book, so that I can make a better picture about the book and its journey
ACCEPTANCE CRITERIA
** TASKS**
EPIC: Registered User
As a user, I want to see the latest registered books, so that I am always up to date.
ACCEPTANCE CRITERIA
** TASKS**
EPIC: Registered User
As a user, I want to see all books which are registered by me or others.
ACCEPTANCE CRITERIA
** TASKS**
EPIC: Book registration
As a developer, I want to have a full control of registered books, so that I can control the provided information
ACCEPTANCE CRITERIA
** TASKS**
EPIC: Error Pages
As a developer, I need to implement a 403 error page to redirect unauthorized users to so that I can secure my views
ACCEPTANCE CRITERIA
** TASKS**
EPIC: General Information
As a (first) user, I want to read some information on website, so that I can make a good picture about the platform.
ACCEPTANCE CRITERIA
TASKS
A unique constraint on user, book field in BookContribution field causes problems when calling updateView. A user cannot edit the contribution, the error Page is shown, saying that the user has already contributed to the book.
Related to #23
EPIC: Preparation & Planning
As a side owner, I want to setup my workspace so that I can develop and deploy the web app easily.
ACCEPTANCE CRITERIA
** TASKS**
EPIC: Registered User
As a user I want to have all navigation links specific for registered user under Member Area, so that I have better overview.
ACCEPTANCE CRITERIA
TASKS
EPIC: Book registration
As a user, I want to have the possibility to edit the provided information about my books anytime, so that I can have a full control of what I published.
ACCEPTANCE CRITERIA
** TASKS**
EPIC: Book registration
As a developer, I want to generate a unique code so that the book can be easily identified.
ACCEPTANCE CRITERIA
TASKS
EPIC: Book Registration
As a user, I want to add a new book, so that it can start its journey.
ACCEPTANCE CRITERIA
TASKS
EPIC: Error Pages
As a developer, I need to implement a 500 error page to alert users when an internal server error occurs.
ACCEPTANCE CRITERIA
** TASKS**
EPIC: Book Contribution
As a registered user I want to know where the book is so that I can find it if it is nearby
ACCEPTANCE CRITERIA
** TASKS**
EPIC: Documentation and Testing
As a developer, I want to test the webpage, so that the webpage reacts appropriately on users request.
ACCEPTANCE CRITERIA
** TASKS**
EPIC: Book registration
As a user, I want to have the possibility to delete the registered book, so that I can stop the book journey anytime I want
ACCEPTANCE CRITERIA
** ASKS**
EPIC: Book contribution
As a developer, I want to have a full control of book contributions so that I can control the provided information.
ACCEPTANCE CRITERIA
** TASKS**
EPIC: Book contribution
As a user, I want to edit my contribution, so that I can change or correct the provided information.
ACCEPTANCE CRITERIA
** TASKS**
EPIC: Registered User
As a user, I want to rate the book, so that I can give others a better impression about the book.
ACCEPTANCE CRITERIA
** TASKS**
EPIC: User Registration
The developer has an access to all users, so that he can modify or delete them via admin panel
ACCEPTANCE CRITERIA
** TASKS**
EPIC: Preparation & Planning
As a side owner, I want to plan the project carefully, so that the web app meets MVP.
ACCEPTANCE CRITERIA
** TASKS**
EPIC: Book registration
As a user, I want to have the possibility to go back during the book registration step, so that I can change or read the provided details.
ACCEPTANCE CRITERIA
TASKS
EPIC: General Information
As a developer, I want that the first (not registered) user has limited access to the webpage content, so that I can encourage them to register
ACCEPTANCE CRITERIA
TASKS
EPIC: General Information
As a user, I want to easily navigate through the web pages, so that I can find the information fast and intuitively.
ACCEPTANCE CRITERIA
** TASKS**
EPIC: Documentation and Testing
As a developer, I want to document the development of the webpage.
ACCEPTANCE CRITERIA
** TASKS**
EPIC: Error Pages
As a developer, I need to implement a 404 error page to alert users when they have accessed a page that doesn't exist
ACCEPTANCE CRITERIA
** TASKS**
EPIC: Book Contribution
As a user, I want to contribute the registered book, so that I can share my state with others.
ACCEPTANCE CRITERIA
** TASKS**
EPIC: User Registration
As a user, I want to be notified when I logged in so that I know my login was successful.
ACCEPTANCE CRITERIA
TASKS
EPIC: User Registration
As a user, I want to edit my user account information, so that I can change some of it.
ACCEPTANCE CRITERIA
** TASKS**
EPIC: User Registration
As a user, I want to login with my username, so that I don't have to provide my private information.
ACCEPTANCE CRITERIA
TASKS
EPIC:Registered User
As a user, I want to easily see my registered, contributed and all books, so that I have a good overview
ACCEPTANCE CRITERIA
** TASKS**
EPIC: Documentation and Testing
As a developer, I want to validate the code, so that it meets standard coding rules.
ACCEPTANCE CRITERIA
TASKS
EPIC: General Information
As a first user, I want to read general information about the procedure.
ACCEPTANCE CRITERIA
** TASKS**
EPIC: User Registration
As a user, I want to register with a username so that I can have a full access to the webpage content and be part of the community.
ACCEPTANCE CRITERIA
TASKS
EPIC: Book Contribution
As a want to find my city in the Contribution Form so that I can fill it.
ACCEPTANCE CRITERIA
TASKS
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.