Ekipa tab restructuring, downloaded file names are now codes.

leon-redesign
msinkec 2 years ago
parent 743ebba052
commit 31c2d294fe

@ -305,6 +305,8 @@ def solar(text):
show_upload_form = True
contract_school = portal.solar.get_institution_contract(current_user_institution.id)
cooperation_history = portal.solar.get_institution_cooperation_history(current_user_institution.id)
logging.info('TEEEEEEEEEEEEEEEEEEEEEEEsst')
logging.info(cooperation_history[0].name)
if portal.solar.is_institution_coordinator(current_user_obj.id, current_user_institution.id):
contracts_students = portal.solar.get_institution_student_contracts(current_user_institution.id)
enable_upload_school_contract = True
@ -761,19 +763,23 @@ def get_upload_file(upload_id, file_hash):
if file_hash not in upload_obj.upload_file_hashes:
return '', 404
prefix = file_hash[:2]
suffix = file_hash[2:]
safe_path = safe_join(str(upload_handler_solar.get_uploads_subdir('files')), prefix, suffix)
f_name = os.listdir(safe_path)[0]
f_name = os.listdir(safe_path)[0]
safe_path = safe_join(safe_path, f_name)
f_suffix = f_name.split('.')[-1]
f_dlname = upload_obj.upload_file_codes[file_hashes.index(file_hash)]
if f_suffix in portal.solar.UploadHandlerSolar.ENABLED_FILETYPES:
f_dlname += '.' + f_suffix
try:
return send_file(safe_path, attachment_filename=f_name, as_attachment=True)
return send_file(safe_path, attachment_filename=f_dlname, as_attachment=True)
except FileNotFoundError:
return '', 404
if __name__ == '__main__':
app.run(debug=True)

@ -508,22 +508,18 @@ def get_institution_contract(institution_id):
def get_institution_cooperation_history(institution_id):
#return CooperationToken.query.join(UserCooperationTokenMapping,
# UserCooperationTokenMapping.cooperation_token == CooperationToken.id).filter(UserCooperationTokenMapping.user == user_id).all()
#
res = dict()
uch_rows = UserCooperationHistory.query.filter_by(institution=institution_id).order_by(UserCooperationHistory.school_year.desc()).all()
for row in uch_rows:
if row.user not in res:
res[row.user] = {
'coordinator': [],
'mentor': [],
'other': []
}
res[row.user][row.role].append((row.school_year, row.badge_text))
return res
return db.session.query(UserCooperationHistory.role,
UserCooperationHistory.school_year,
UserCooperationHistory.badge_text,
RegisteredUser.name,
).select_from(
UserCooperationHistory,
).join(
RegisteredUser,
UserCooperationHistory.user == RegisteredUser.id,
).filter(
UserCooperationHistory.institution == institution_id,
).order_by(UserCooperationHistory.school_year.desc()).all()
def get_cooperation_history():

@ -128,8 +128,26 @@
</div>
</div>-->
<div class="row">
PLACEHOLDER - GRAF SODELOVANJA
</div>
{% set vars = {'prev_schoolyear': ''} %}
{% for item in cooperation_history %}
{% if item.school_year != vars.prev_schoolyear %}
<div class="row">
<b>Šolsko leto {{item.school_year}}</b>
</div>
{% if vars.update({'prev_schoolyear': item.school_year}) %} {% endif %}
{% endif %}
<div class="row">
{{item.name}}
{{item.badge_text}}
</div>
{% endfor %}
<!--<div class="row">
<div class="col-6">
{% for collaborator in collaborators %}
{#{% for collaborator in collaborators %}
<div class="team-item">
<div class="team-item-name">{{collaborator.name}}</div>
<div class="team-item-collaborations">
@ -159,7 +177,7 @@
{% endfor %}
</div>
</div>
</div>
</div>-->
@ -168,7 +186,7 @@
<!--
<!--{#
<a href="../logout">Odjavi se</a>
{% if is_institution_coordinator %}
<br><a href="../manage-institution">Upravljaj z institucijo</a>
@ -320,7 +338,7 @@
</div>
</div>
</div>
</div>-->
</div>#}-->
</body>
<script src="https://d3js.org/d3.v6.js"></script>
<script>

Loading…
Cancel
Save