Commit 2e79d6ac authored by erreur401's avatar erreur401

Badge system pyMongo fix / learn page tweek

parent d1549df8
......@@ -131,8 +131,8 @@ def check_quiz(id):
ordering = json.loads(request.form['ord'])
quiz = copy.deepcopy(quizzes[id])
badge = quiz['badge']
badge = str('"' + badge + '"' )
print(badge)
badge =str(badge)
# print(request.form)
quiz['questions'] = sorted(quiz['questions'], key=lambda q: ordering.index(quiz['questions'].index(q)))
#print(quiz['questions'])
......@@ -157,8 +157,9 @@ def check_quiz(id):
if number_correct >= badge_ok:
#award badge
print('award badge ' + badge)
bdd.user.update({"user._id": ObjectId(user), "badges.name": badge}, {"$set": {"badges.$.lvl": 1}}, multi=True)
#db.exhibitions.update({"artists._id": ObjectId(artist_id)}, {"$set": {"artists.$": artist}}, multi=True)
bdd.user.update({"_id": ObjectId(user), "badges.name": badge}, {"$set": {"badges.$.lvl": 2}}, multi=True)
print({ "badges.name": badge,"_id": ObjectId(user)}, {"$set": {"badges.$.lvl": 2}})
#({'badges.name': 'electronique', '_id': ObjectId('5b3f847e5087266741cf1fef')}, {'$set': {'badges.$.lvl': 1}})
else:
print('user got less than required amount')
......
{
"name": "Reddiquette Quiz",
"description": "How well versed are you in the rules of Reddit? Quiz yoself before you run afoul!",
"badge": "electronique",
"badge": "impression3d",
"questions": [
{
"text": "Reddiquette is the ettiquette of which site?",
......
......@@ -27,57 +27,6 @@ input[type=radio]:checked {
border: RED;
}
.container input {
position: absolute;
opacity: 0;
cursor: pointer;
}
/* Create a custom checkbox */
.checkmark {
position: absolute;
top: 0;
left: 0;
height: 25px;
width: 25px;
background-color: #eee;
}
/* On mouse-over, add a grey background color */
.container:hover input ~ .checkmark {
background-color: #ccc;
}
/* When the checkbox is checked, add a blue background */
.container input:checked ~ .checkmark {
background-color: #2196F3;
}
/* Create the checkmark/indicator (hidden when not checked) */
.checkmark:after {
content: "";
position: absolute;
display: none;
}
/* Show the checkmark when checked */
.container input:checked ~ .checkmark:after {
display: block;
}
/* Style the checkmark/indicator */
.container .checkmark:after {
left: 9px;
top: 5px;
width: 5px;
height: 10px;
border: solid white;
border-width: 0 3px 3px 0;
-webkit-transform: rotate(45deg);
-ms-transform: rotate(45deg);
transform: rotate(45deg);
}
.no-gutter {
margin: 0;
padding: 0;
......@@ -265,6 +214,7 @@ ul#menuSecond li a:hover {
margin-bottom: 30px;
border-radius: 2%;
text-align: center;
max-height: 300px;
}
.tutoItem .tutoBox img {
max-width: 110%;
......@@ -291,26 +241,26 @@ ul#menuSecond li a:hover {
margin-left: -10px;
transition: all 0.2s ease;
}
.tutoItem .tutoBox .green.overTuto:before {
.tutoItem .tutoBox .elec.overTuto:before {
background: #90ee90;
}
.tutoItem .tutoBox .blue.overTuto:before {
.tutoItem .tutoBox .prog.overTuto:before {
background: blue;
}
.tutoItem .tutoBox .red.overTuto:before {
.tutoItem .tutoBox .usinage.overTuto:before {
background: red;
}
.tutoItem .tutoBox:hover .green.overTuto:before {
background: url(../img/chip.png) no-repeat #90ee90;
.tutoItem .tutoBox:hover .elec.overTuto:before {
background: url(../img/electronique.png) no-repeat #90ee90;
background-position: center !important;
background-size: 40%;
}
.tutoItem .tutoBox:hover .blue.overTuto:before {
.tutoItem .tutoBox:hover .prog.overTuto:before {
background: url(../img/cncico.png) no-repeat blue;
background-position: center;
background-size: 40%;
}
.tutoItem .tutoBox:hover .red.overTuto:before {
.tutoItem .tutoBox:hover .usinage.overTuto:before {
background: url(../img/3dprint.png) no-repeat red;
background-position: center;
background-size: 40%;
......
......@@ -30,57 +30,6 @@ input[type="radio"]:checked{
border: RED;
}
.container input {
position: absolute;
opacity: 0;
cursor: pointer;
}
/* Create a custom checkbox */
.checkmark {
position: absolute;
top: 0;
left: 0;
height: 25px;
width: 25px;
background-color: #eee;
}
/* On mouse-over, add a grey background color */
.container:hover input ~ .checkmark {
background-color: #ccc;
}
/* When the checkbox is checked, add a blue background */
.container input:checked ~ .checkmark {
background-color: #2196F3;
}
/* Create the checkmark/indicator (hidden when not checked) */
.checkmark:after {
content: "";
position: absolute;
display: none;
}
/* Show the checkmark when checked */
.container input:checked ~ .checkmark:after {
display: block;
}
/* Style the checkmark/indicator */
.container .checkmark:after {
left: 9px;
top: 5px;
width: 5px;
height: 10px;
border: solid white;
border-width: 0 3px 3px 0;
-webkit-transform: rotate(45deg);
-ms-transform: rotate(45deg);
transform: rotate(45deg);
}
.no-gutter {
......@@ -276,6 +225,7 @@ ul {
margin-bottom: 30px;
border-radius: 2%;
text-align: center;
max-height: 300px;
img {
max-width: 110%;
min-height: 100%;
......@@ -301,27 +251,27 @@ ul {
transition: all 0.2s ease;
}
}
.green.overTuto:before {
.elec.overTuto:before {
background: #90ee90;
}
.blue.overTuto:before {
.prog.overTuto:before {
background: blue;
}
.red.overTuto:before {
.usinage.overTuto:before {
background: red;
}
&:hover {
.green.overTuto:before {
background: url(../img/chip.png) no-repeat #90ee90;
.elec.overTuto:before {
background: url(../img/electronique.png) no-repeat #90ee90;
background-position: center !important;
background-size: 40%;
}
.blue.overTuto:before {
.prog.overTuto:before {
background: url(../img/cncico.png) no-repeat blue;
background-position: center;
background-size: 40%;
}
.red.overTuto:before {
.usinage.overTuto:before {
background: url(../img/3dprint.png) no-repeat red;
background-position: center;
background-size: 40%;
......
......@@ -2,9 +2,9 @@
{% block content %}
<h1>DASHBOARD de {{current_user.email}}</h1>
<div class="container">
<div class="container">
<h1>DASHBOARD de {{current_user.first_name}}</h1>
{% with messages = get_flashed_messages() %}
{% if messages %}
<ul class=flashes>
......@@ -23,7 +23,7 @@
<!-- {{ current_user.badges }} -->
<div class="badgesList">
<h2>TES BADGES</h2>
......@@ -38,8 +38,8 @@
<div class="badgeImg {{badge.name}} fail">
{% else %}
<div class="badgeImg {{badge.name}}">
{% endif %}
{% endif %}
</div>
<span>{{ badge.name }}</span>
</div>
......@@ -50,17 +50,17 @@
<div class="col-2">
<div class="badgeItem">
<div class="badgeImg">
</div>
<span> maker </span>
</div>
</div>
</div>
</div>
</div>
<style type="text/css">
</style>
{% endblock %}
Markdown is supported
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