Compare commits
5 Commits
a9de33dfb8
...
c57cd62fdf
Author | SHA1 | Date |
---|---|---|
Kostanjevec | c57cd62fdf | |
Kostanjevec | afbab30f6d | |
Kostanjevec | 8e08930b90 | |
Kostanjevec | 21afefafa4 | |
Kostanjevec | dac7fe61a0 |
19
menu.py
19
menu.py
|
@ -2,9 +2,7 @@ from flask import (
|
||||||
Blueprint, flash, redirect, render_template, request, session, url_for
|
Blueprint, flash, redirect, render_template, request, session, url_for
|
||||||
)
|
)
|
||||||
|
|
||||||
from config import CONFIG
|
|
||||||
from create_db import Deck, Card, get_session
|
from create_db import Deck, Card, get_session
|
||||||
|
|
||||||
from deck import get_deck, probabilistic_deck_generator
|
from deck import get_deck, probabilistic_deck_generator
|
||||||
from settings import get_settings
|
from settings import get_settings
|
||||||
from auth import login
|
from auth import login
|
||||||
|
@ -31,7 +29,6 @@ def index():
|
||||||
action = request.form.get("menu", False) #internetna rešitev, nevem kako, ampak dela, tj. dobi info iz meni buttonov
|
action = request.form.get("menu", False) #internetna rešitev, nevem kako, ampak dela, tj. dobi info iz meni buttonov
|
||||||
print(action)
|
print(action)
|
||||||
if action == "new_session":
|
if action == "new_session":
|
||||||
# @TODO tu bi moral preveriti če je kak unfinished deck, potem bi pisalo continiue, namesto new
|
|
||||||
old_deck = dbsession.query(Deck).filter(Deck.completed == 0, Deck.owner_id == user_id).all()
|
old_deck = dbsession.query(Deck).filter(Deck.completed == 0, Deck.owner_id == user_id).all()
|
||||||
if old_deck != []:
|
if old_deck != []:
|
||||||
return redirect(url_for("deck"))
|
return redirect(url_for("deck"))
|
||||||
|
@ -39,20 +36,22 @@ def index():
|
||||||
#preverimo če so sploh karte v collectionu
|
#preverimo če so sploh karte v collectionu
|
||||||
print("userID", user_id)
|
print("userID", user_id)
|
||||||
c = dbsession.query(Card).filter(Card.owner_id == user_id).all()
|
c = dbsession.query(Card).filter(Card.owner_id == user_id).all()
|
||||||
#print(dbsession.query(Card).all())
|
|
||||||
#print(c)
|
|
||||||
if c == []:
|
if c == []:
|
||||||
print("ne najdem collectiona")
|
print("ne najdem collectiona")
|
||||||
return render_template("error/no_cards_in_collection.html", username=username)
|
return render_template("error/no_cards_in_collection.html", username=username)
|
||||||
|
|
||||||
#ustvari novi vnos v Deck
|
#ustvari novi vnos v Deck
|
||||||
user_settings = get_settings(user_id)
|
user_settings = get_settings(user_id)
|
||||||
deck = probabilistic_deck_generator(user_id, int(user_settings['max_new']), int(user_settings['max_due']))
|
if user_settings['max_new'] == "0" and user_settings['max_due'] == "0":
|
||||||
|
flash("Error: Attempted to make deck with 0 cards.")
|
||||||
cards_by_id = get_deck(deck)
|
|
||||||
if cards_by_id == "":
|
|
||||||
flash("Error: Attempted to make deck with 0 cards. Maybe check settings :)")
|
|
||||||
return render_template("menu/menu.html")
|
return render_template("menu/menu.html")
|
||||||
|
|
||||||
|
deck = probabilistic_deck_generator(user_id, int(user_settings['max_new']), int(user_settings['max_due']))
|
||||||
|
cards_by_id = get_deck(deck)
|
||||||
|
|
||||||
|
if cards_by_id == "":
|
||||||
|
return render_template("error/no_cards_in_collection.html", username=username)
|
||||||
else:
|
else:
|
||||||
number_of_cards = len(cards_by_id.split(","))
|
number_of_cards = len(cards_by_id.split(","))
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,16 @@
|
||||||
{% extends 'base.html' %}
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
{% block header %}
|
{% block header %}
|
||||||
<head>About</head>
|
<h1>About</h1>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<p>Contentmatcher is a <a href="https://gia.kompot.si/about.php">General Intelligence Agency of Ljubljana</a> prototype.</p>
|
<p>Contentmatcher is a <a href="https://gia.kompot.si/about.php">General Intelligence Agency of Ljubljana</a> prototype.</p>
|
||||||
|
|
||||||
|
<p>You can find the its code <a href="https://git.kompot.si/gia/contentmatcher">here</a>.</p>
|
||||||
|
|
||||||
|
<p>Contentmatcher is hosted by <a href="https://kompot.si/wi">kompot</a>, a local librehosters community.</p>
|
||||||
|
|
||||||
|
If you have any questions, feedback or if you would like contribute, please contact us at <a href="mailto:gia@kompot.si">gia@kompot.si</a>.
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
<form method="post" style="max-width: 960px; margin: auto; padding: 0 1rem 1rem;">
|
<form method="post" style="max-width: 960px; margin: auto; padding: 0 1rem 1rem;">
|
||||||
<input type="hidden" name="card_id" value="{{ card['id'] }}">
|
<input type="hidden" name="card_id" value="{{ card['id'] }}">
|
||||||
<span style="display: flex; justify-content: space-around;">
|
<span style="display: flex; justify-content: space-around;">
|
||||||
<button style="background-color: #736B1E" id="rbutton" type="submit" name="rate" value="Yes" accesskey="1">Yes</button> <!--ti keyi so alt+shit+key...-->
|
<button style="background-color: #736B1E;" id="rbutton" type="submit" name="rate" value="Yes" accesskey="1">Yes</button> <!--ti keyi so alt+shit+key...-->
|
||||||
<button style="background-color: #ED8008;" id="rbutton" type="submit" name="rate" value="Maybe" accesskey="2">Maybe</button>
|
<button style="background-color: #ED8008;" id="rbutton" type="submit" name="rate" value="Maybe" accesskey="2">Maybe</button>
|
||||||
<button style="background-color: #ED3f1C;" id="rbutton" type="submit" name="rate" value="No" accesskey="3">No</button>
|
<button style="background-color: #ED3f1C;" id="rbutton" type="submit" name="rate" value="No" accesskey="3">No</button>
|
||||||
<button style="background-color: #BF1B1B;" id="rbutton" type="submit" name="rate" value="Delete" accesskey="d">Delete</button>
|
<button style="background-color: #BF1B1B;" id="rbutton" type="submit" name="rate" value="Delete" accesskey="d">Delete</button>
|
||||||
|
|
|
@ -1,10 +1,59 @@
|
||||||
{% extends 'base.html' %}
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
{% block header %}
|
{% block header %}
|
||||||
<head>Matches</head>
|
<h1>Instructions</h1>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<p>Comming soon...</p>
|
<p>
|
||||||
|
Contentmatcher is a GIA prototype that tries to help you engage with your content and share it with other users. It assumes that you have a heap of content that you would like to reconsider. This heap can take many forms such vast libraries of PDFs on your computer or a long lists of bookmarks.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
The app will help you get through this content step by step and continue to show you your content again based on the interest you express as well present you with shared contnet. If you and at least one more person express a high interest in an <strong>item</strong> a match will appear on your <a href="{{ url_for('matches.index') }}">matches</a> page. There you can send them an email to talk about the <strong>item</strong> your interested in.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
Some definitions:
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
An <strong>item</strong> is a unit of content (like a PDF you upload).
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<strong>Items</strong> are private by default but they can be shared.
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
A <strong>collection</strong> made up of all your private items and the items shared with you.
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
When you start a new session Contentmatcher will create a <strong>deck</strong>, which is a small part of the <strong>collection</strong>.
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<h2>Importing your content</h2>
|
||||||
|
<p>
|
||||||
|
For now you they only way to import content is to <a href='{{ url_for('upload.index')}}'>upload</a> your PDFs. We're figuring out how to add diffent lists of links like browser bookmarks, liked tweets and "watch later" youtube videos.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<h2>Sessions</h2>
|
||||||
|
<p>
|
||||||
|
Going through sessions is the main activity in using Contentmatcher.
|
||||||
|
|
||||||
|
A session consists of rating and potentially shareing items in a <strong>deck</strong>. You can adjust the size of your <strong>deck</strong> in the settings.
|
||||||
|
|
||||||
|
In sessions you rate them with <mark style="color: black; background-color: #736B1E;">yes</mark>, <mark style="color: black; background-color: #ED8008;">maybe</mark>, <mark style="color: black; background-color: #ED3f1C;">no</mark> and <mark style="color: black; background-color: #BF1B1B;">delete</mark> buttons. It's weird because there is no question, maybe the question posed is: "are you really interested in this <strong>item</strong>?"
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
There is also the <mark style="color: black; background-color: #D9D2C6;">share</mark> button. This will create a new <strong>item</strong> with this content for all other users, so it will appear in their decks from now on.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<h2>Matches</h2>
|
||||||
|
<p>
|
||||||
|
If you and at least one other user rate an item with a <mark style="color: black; background-color: #736B1E;">yes</mark> then a match will appear on your <a href="{{ url_for('match') }}">matches</a> page. There you can send a email to talk.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<h2>Feedback</h2>
|
||||||
|
<p>
|
||||||
|
If you have any questions, feedback, ideas or if you would like contribute, please contact us at <a href="mailto:gia@kompot.si">gia@kompot.si</a>.
|
||||||
|
</p>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
Loading…
Reference in New Issue