<commit_before>import os

from django.core.exceptions import ValidationError, ObjectDoesNotExist
from django.contrib.auth.decorators import login_required
from django.http import Http404
from django.shortcuts import render, redirect
from django_tables2 import RequestConfig

from . import tasks
from .forms import ProjectForm
from .models import Project, \
    GenesipprResults, \
    SendsketchResults, \
    GenesipprResultsSixteens, \
    GenesipprResultsGDCS, \
    GenesipprResultsSerosippr

from .table import ProjectTable, \
    GenesipprTable, \
    SendsketchTable, \
    GDCSTable, \
    SixteensTable, \
    SerosipprTable


@login_required
def projects(request):
    project_list = Project.objects.all()
    form = ProjectForm(request.POST, request.FILES)

    # Create new project
    if request.method == 'POST':
        if form.is_valid():
            print('Form is valid.\n')

            # Have to do this in order to set the user to current logged in user
            new_entry = form.save(commit=False)

            # Pull active user
            new_entry.user = request.user

            # Save the form
            new_entry = form.save()

            # Debug
            print('PK: {}, User: {}'.format(new_entry.pk, new_entry.user))
            print('File 1: {}\nFile 2: {}'.format(new_entry.file_R1, new_entry.file_R2))
            print('Requested jobs: {} for project {}'.format(new_entry.requested_jobs, new_entry.pk))

            # Check jobs
            if 'genesipprv2' in new_entry.requested_jobs:
                print('\nGenesipprV2 job detected.')
<commit_msg>Bug fix - projects for every user were being displayed before<commit_after>import os

from django.core.exceptions import ValidationError, ObjectDoesNotExist
from django.contrib.auth.decorators import login_required
from django.http import Http404
from django.shortcuts import render, redirect
from django_tables2 import RequestConfig

from . import tasks
from .forms import ProjectForm
from .models import Project, \
    GenesipprResults, \
    SendsketchResults, \
    GenesipprResultsSixteens, \
    GenesipprResultsGDCS, \
    GenesipprResultsSerosippr

from .table import ProjectTable, \
    GenesipprTable, \
    SendsketchTable, \
    GDCSTable, \
    SixteensTable, \
    SerosipprTable


@login_required
def projects(request):
    project_list = Project.objects.filter(user=request.user)
    form = ProjectForm(request.POST, request.FILES)

    # Create new project
    if request.method == 'POST':
        if form.is_valid():
            print('Form is valid.\n')

            # Have to do this in order to set the user to current logged in user
            new_entry = form.save(commit=False)

            # Pull active user
            new_entry.user = request.user

            # Save the form
            new_entry = form.save()

            # Debug
            print('PK: {}, User: {}'.format(new_entry.pk, new_entry.user))
            print('File 1: {}\nFile 2: {}'.format(new_entry.file_R1, new_entry.file_R2))
            print('Requested jobs: {} for project {}'.format(new_entry.requested_jobs, new_entry.pk))

            # Check jobs
            if 'genesipprv2' in new_entry.requested_jobs:
                print('\nGenesipprV2 job detected.')

{'fraction_non_alphanumeric': 0.08915441176470588, 'fraction_numerical': 0.006127450980392157, 'mean_word_length': 2.664421997755331, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1536427', 'n_tokens_mistral': 986, 'n_tokens_neox': 946, 'n_words': 251}