Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ PQR is built upon Flask, a lightweight MVC in Python. PQR also uses MongoDB. We

To run PQR locally, do the following:
1. Clone this repository
2. Make sure you have Python 2.7.6 or Python 2.7.9
2. Make sure you have Python 2.7.18.
3. Install `virtualenv`. On Debian systems, run `sudo pip install virtualenv`. On Windows, `pip install virtualenv`
4. Make sure you are in the root of the repo, aka the same level as this README. Then, run `virtualenv venv`. This will create a virtual environment named `venv` in the root of the repo.
5. On Linux systems, run `. venv/bin/activate` to activate the virtual enviroment. On Windows, run `.\venv\Scripts\activate`.
Expand Down
5 changes: 2 additions & 3 deletions assets/js/bindevents.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,14 +176,13 @@ module.exports = (function() {
if ($(selector).length) {
$(selector).on("click vclick", function(event) {
event.preventDefault();
if $(this).text()=="Remove Surface"{
if ($(this).text()==="Remove Surface") {
threeDMole.toggleSurface();
$(this).addClass('btn-success');
$(this).removeClass('btn-danger');
$(this).html('Add Surface');
//"feedback", "fa-desktop");
}
else {
} else {
threeDMole.toggleSurface2();
$(this).addClass('btn-danger');
$(this).removeClass('btn-success');
Expand Down
2 changes: 1 addition & 1 deletion assets/style/main.less
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//Import bootstrap variables and mixins to use variables
@import '../../bower_components/lesshat/build/lesshat.less';
@import "node_modules/lesshat/lesshat.less";
@import (reference) "bootstrap/bootstrap.less";
@import "bootstrap/variables.less";
@import "bootstrap/mixins.less";
Expand Down
13 changes: 7 additions & 6 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

var gulp = require('gulp'),
const gulp = require('gulp'),
path = require('path'),
concat = require('gulp-concat'),
autoprefixer = require('gulp-autoprefixer'),
Expand All @@ -16,9 +16,10 @@ var gulp = require('gulp'),
uglify = require('gulp-uglify'),
tape = require('gulp-tape'),
watch = require('gulp-watch');
var paths = {
source : path.join(__dirname, 'assets/'),
dist : path.join(__dirname, 'pqr/static/'),

const paths = {
source: path.join(__dirname, 'assets/'),
dist: path.join(__dirname, 'pqr/static/'),
style: 'style/',
js: 'js/',
test: 'test/'
Expand Down Expand Up @@ -72,11 +73,11 @@ gulp.task('js', function () {
.pipe(gulp.dest(paths.dist + paths.js));
});
});
gulp.task('compile', ['less', 'js']);
gulp.task('compile', gulp.series('less', 'js'));
//test
gulp.task('test', function() {
return gulp.src(paths.source + paths.test + 'main.test.js')
.pipe(tape());
});
//default
gulp.task('default', ['compile']);
gulp.task('default', gulp.series('compile'));
19 changes: 10 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,29 @@
"dependencies": {
"bootstrap": "^3.3.6",
"browsernizr": "^2.1.0",
"lesshat": "^4.1.0",
"qrcode-npm": "0.0.3"
},
"devDependencies": {
"babel-preset-es2015": "^6.5.0",
"babelify": "^7.2.0",
"browserify": "^13.0.0",
"glob": "^6.0.4",
"gulp": "^3.9.0",
"gulp-autoprefixer": "^3.1.0",
"gulp-concat": "^2.6.0",
"gulp-cssnano": "^2.1.0",
"gulp-jshint": "^2.0.0",
"gulp": "4.0.2",
"gulp-autoprefixer": "^8.0.0",
"gulp-concat": "2.6.1",
"gulp-cssnano": "^2.1.3",
"gulp-jshint": "^2.1.0",
"gulp-less": "^3.0.5",
"gulp-sourcemaps": "^1.6.0",
"gulp-tape": "0.0.7",
"gulp-uglify": "^1.5.1",
"gulp-tape": "1.0.0",
"gulp-uglify": "3.0.2",
"gulp-util": "^3.0.7",
"gulp-watch": "^4.3.5",
"jshint": "^2.9.1",
"tape": "^4.4.0",
"vinyl-buffer": "^1.0.0",
"vinyl-source-stream": "^1.1.0"
"vinyl-buffer": "^1.0.1",
"vinyl-source-stream": "^2.0.0"
},
"scripts": {
"postinstall": "bower install",
Expand Down
6 changes: 2 additions & 4 deletions pqr/static/js/pqr.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions pqr/static/style/pqr.min.css

Large diffs are not rendered by default.

15 changes: 9 additions & 6 deletions pqr/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from pymongo import MongoClient

# PQR specific imports
from pqr import pqr, secret_config
from pqr import pqr

from settings import APP_JSON, APP_MOL2, APP_ARTICLES

Expand Down Expand Up @@ -658,6 +658,7 @@ def get_weekly_molecule_list():
sunday = today - (today % 7)
sunday = datetime.date.fromordinal(sunday)
sunday = datetime.date.isoformat(sunday)
last = None
with open("./pqr/server_start/mol_of_the_week", "r") as molfile:
for line in molfile:

Expand All @@ -668,13 +669,15 @@ def get_weekly_molecule_list():
tokens = line.strip().split(",")
if len(tokens) < 3:
continue

# inchikey, title, date
last = tokens[1] + "," + tokens[2].title() + "," + tokens[0][0:4] + '-' + tokens[0][4:6] + '-' + tokens[0][6:]
if tokens[0] <= datetime.datetime.isoformat(datetime.datetime.now()).replace('-', ''):
return_list.append( # inchikey, title, date
tokens[1] + "," + tokens[2].title() + "," + tokens[0][0:4] + '-' + tokens[0][4:6] + '-' + tokens[0][6:]
)
return_list.append(last)
else: # We are now past the current date, don't show them yet
continue
return return_list or [last]

else: # We are now past the current date, don't show them yet
return return_list

def get_json_data_file(key_first_two, key):
try:
Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Flask
Flask==0.11.0
Werkzeug==0.16.1
pymongo
Flask-Cache
flask-mandrill
Expand Down
2 changes: 1 addition & 1 deletion server.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!./venv/bin/python
#!/usr/bin/env python
from pymongo import MongoClient
import datetime
import threading
Expand Down
2 changes: 1 addition & 1 deletion unit_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

class PQRTestCase(unittest.TestCase):

mol = "GNBHRKFJIUUOQI-UHFFFAOYSA-N"
mol = "ULGZDMOVFRHVEP-RWJQBGPGSA-N"

def setUp(self):
pqr.pqr.config['TESTING'] = True
Expand Down