Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
776 changed files
with
207,715 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
!coverage.py: This is a private format, don't read it directly!{"lines":{"/home/kasule/Desktop/levelUp/Tests/test_register.py":[64,1,2,4,7,8,9,10,11,13,17,19,23,24,26,27,28,30,31,32,34,38,39,40,42,65,46,47,48,50,54,56,57,59,60,61,63],"/home/kasule/Desktop/levelUp/Tests/__init__.py":[1],"/home/kasule/Desktop/levelUp/Tests/register.py":[1,2,3,4,5,7,8,9,11,13,15,16,17,19,21,23,24,25,27]}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
repo_token: vNbuPyDup5tZFw5xqhMoVmPfWOzel2PeH |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
__pycache__/ | ||
challenge.txt | ||
env/ | ||
.vscode/ | ||
.vscode/ | ||
*.pyc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
language: python | ||
|
||
python: | ||
- "3.6" | ||
|
||
# install dependency | ||
install: | ||
- pip install -r requirement.txt | ||
- pip install coveralls | ||
|
||
script: | ||
- coverage run -m unittest Tests/test_register.py -v | ||
- coverage report -m | ||
after_success: | ||
- coveralls |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,11 @@ | ||
<<<<<<< HEAD | ||
## KiVULU EVENT TICKETS (KETs) | ||
# KiVULU EVENT TICKETS (KETs) | ||
is an online application for granting digital tickets to people who are | ||
eligible to attend the scheduled event. | ||
|
||
======= | ||
Challenge: | ||
------------ | ||
Imagine you are at an event reception desk; when someone arrives to attend, | ||
you are charged with checking if a user registered for the event and in | ||
which category.Given two text files, one containing names of people | ||
who registered for the event in the VIP category and the second contains | ||
those that signed up for ORDINARY tickets.Your program should: | ||
- Read the files, and store the contents in lists. | ||
- Ask a user to enter one of their names and check through the lists to see | ||
> if a user paid for a ticket | ||
> if the ticket paid for, is an Ordinary or Vip ticketSpecs: | ||
## Build Status | ||
|
||
Name your main function registration_checker, its argument/input should | ||
be a single name | ||
For example; For the name Maria, it should return a Full name, Category | ||
i.e Maria Nanfuka, VIP | ||
For the name Edison, it should return Not Registered | ||
Put your file (reception.py) in an importable folder named reception | ||
within the project directory. | ||
[![Build Status](https://travis-ci.com/Kasulejoseph/Ticket-App.svg?branch=develop) | ||
[![Coverage Status](https://coveralls.io/repos/github/Kasulejoseph/Ticket-App/badge.svg?branch=develop)](https://coveralls.io/github/Kasulejoseph/Ticket-App?branch=develop) | ||
|
||
view the home page UI on the [gh-pages](https://kasulejoseph.github.io/Ticket-App/) | ||
|
||
** Your Git and Pivotal Tracker usage is of a high priority (edited) | ||
vip_list.txt | ||
>>>>>>> reception |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
Challenge: | ||
------------ | ||
Imagine you are at an event reception desk; when someone arrives to attend, | ||
you are charged with checking if a user registered for the event and in | ||
which category.Given two text files, one containing names of people | ||
who registered for the event in the VIP category and the second contains | ||
those that signed up for ORDINARY tickets.Your program should: | ||
- Read the files, and store the contents in lists. | ||
- Ask a user to enter one of their names and check through the lists to see | ||
> if a user paid for a ticket | ||
> if the ticket paid for, is an Ordinary or Vip ticketSpecs: | ||
|
||
Name your main function registration_checker, its argument/input should | ||
be a single name | ||
For example; For the name Maria, it should return a Full name, Category | ||
i.e Maria Nanfuka, VIP | ||
For the name Edison, it should return Not Registered | ||
Put your file (reception.py) in an importable folder named reception | ||
within the project directory. | ||
|
||
** Your Git and Pivotal Tracker usage is of a high priority (edited) | ||
vip_list.txt | ||
|
||
|
||
ordinary_list.txt | ||
|
||
|
||
|
||
from reception.reception import vip,ordinary | ||
m = vip() | ||
print(m) | ||
|
||
|
||
|
||
|
||
|
||
# def registrationCkecker(fnames,vip,ordinary): | ||
# print() | ||
# # if fnames.lower() == fname.lower(): | ||
# # print ("Name : " + fnames + ' ' + lname +", Category: VIP") | ||
# # if fnames.lower() == fname.lower(): | ||
# # print ("Name : " + fnames + ' ' + lname +", Category: Ordinary") | ||
# # print("not found") | ||
# registrationCkecker(fnames = input("Enter name: ")) | ||
|
||
|
||
# f = open("vip.txt", "r") | ||
# r = f.readlines() | ||
# for n in r: | ||
# list.append(n.split()) | ||
# print(n.split()[0]) | ||
|
||
|
||
# print(list) | ||
# for element in list: | ||
# print(element[0]) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="keywords" lang="en-us" content="events, plot, night life"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, | ||
maximum-scale=1, user-scalable=no"> | ||
<meta http-equiv="X-UA-Compatible" content="ie=edge, chrome=1"> | ||
<meta name="HandheldFriendly" content ="true"> | ||
<link rel="stylesheet" type="text/css" href="style.css"> | ||
<title>Events App</title> | ||
</head> | ||
<body> | ||
<div id="nav"><h1>BATALO EAST EVENT TICKET</h1></div> | ||
<div id="register"> | ||
<form action="" method="POST"> | ||
<span>First Name:</span> | ||
<input type="text" name="name" placeholder="Name"><br> | ||
<span>Last Name:</span> | ||
<input type="text" name="name" placeholder="Name"><br> | ||
<span>Email:</span> | ||
<input type="email" name="email" placeholder="Email"> | ||
<br> | ||
<input type="submit" value="Book Ticket"> | ||
</form> | ||
</div> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
class SignUp(): | ||
def __init__(self): | ||
self.user_bio = dict() | ||
def add(self, username, password): | ||
self.user_bio[username] = password | ||
|
||
def get_password(self, username): | ||
return self.user_bio[username] | ||
|
||
def length_of_bio(self, username,password): | ||
self.user_bio[username] = password | ||
return |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import unittest | ||
from signUp import SignUp | ||
class SignUpTest(unittest.TestCase): | ||
|
||
def test_signup_creation(self): | ||
signup = SignUp() | ||
self.assertIsInstance(signup, SignUp) | ||
def test_add_user(self): | ||
signup = SignUp() | ||
signup.add("john doe", "john@gmail.com") | ||
self.assertEquals(len(signup.user_bio),1) | ||
|
||
def test_return_password(self): | ||
signup = SignUp() | ||
signup.add("john", "12345") | ||
self.assertEqual(signup.get_password("john"), "12345") | ||
|
||
def test_missing_key(self): | ||
signup = SignUp() | ||
with self.assertRaises(KeyError): | ||
signup.get_password("jo") | ||
|
||
def test_length_of_bio(self): | ||
signup = SignUp() | ||
signup.user_bio("john doe", "john@gmail.com") | ||
self.assertEqual(len(signup.user_bio), 7) | ||
|
||
# skip test | ||
# @unittest.skip(WIP) | ||
# def test_unknown() |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from reception.reception import vip,ordinary | ||
def registrationCkecker(fnames): | ||
ordin = ordinary() | ||
VIP = vip() | ||
try: | ||
for name in VIP: | ||
fname = name[0] | ||
lname = name[1] | ||
if fnames.lower() == fname.lower(): | ||
print ("Name : " + fnames + ' ' + lname +", Category: VIP") | ||
|
||
except expression as identifier: | ||
for name in ordin: | ||
fname = name[0] | ||
lname = name[1] | ||
if fnames.lower() == fname.lower(): | ||
print ("Name : " + fnames + ' ' + lname +", Category: Ordinary") | ||
print("dsf") | ||
print("in") | ||
|
||
registrationCkecker(fnames = input("Enter name: ")) | ||
|
||
|
||
line = [line.strip() for line in f] | ||
names = [[word.lower() for word in test.split()]for test in line] |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
from flask import Flask | ||
from app2.main.views import main | ||
app = Flask(__name__) | ||
app.register_blueprint(main) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
from flask import Blueprint,Flask | ||
app = Flask(__name__) | ||
main = Blueprint('main', __name__) | ||
from . import views |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
from flask import Flask, request, jsonify, Blueprint | ||
main = Blueprint('main', __name__) | ||
def all_users(): | ||
user_list = [ | ||
{'musoke': | ||
[{"user_id":1,"Fullnames":"musoke innocent", 'password':'male'}]}, | ||
|
||
{'ivan': | ||
[{"user_id":2,"Fullnames":"ivan kivumbi", 'password':'password'}]}, | ||
{'hassan': | ||
[{"user_id":3,"Fullnames":"hassan innocent", 'password':'computer'}]}, | ||
{'mary': | ||
[{"user_id":4,"Fullnames":"mary Gorret", 'password':'mary'}]} | ||
] | ||
return user_list | ||
|
||
user_list = all_users() | ||
@main.route('/api/user/add', methods = ['POST']) | ||
def add_users(): | ||
data = request.get_json() | ||
details = data.get('details') | ||
if details in user_list: | ||
return jsonify({"error": "User already added"}), 400 | ||
user_list.append(details) | ||
return jsonify({'new_user': user_list}), 201 | ||
|
||
@main.route('/api/user/get', methods =['GET']) | ||
def get_users(): | ||
if len(user_list)==0: | ||
return jsonify({"message": "no learners available"}),404 | ||
return jsonify ({"Users":user_list, "number":len(user_list)}),200 | ||
|
||
@main.route('/api/user/delete', methods=['DELETE']) | ||
def delete_user(): | ||
data = request.get_json() | ||
details= data.get('details') | ||
if details in user_list: | ||
user_list.remove(details) | ||
return jsonify({'new_user': user_list}), 200 | ||
return jsonify({"error":"user not found in the list "}), 400 |
Oops, something went wrong.