##// END OF EJS Templates
Pull request !2362 Created on Thu, 01 Jul 2021 12:06:29, by
 # import all the libraries

import numpy as np
import re
import nltk
from sklearn.datasets import load_files
nltk.download('stopwords')
import pickle
import pandas as pd
from sklearn.multioutput import MultiOutputClassifier
from sklearn.preprocessing import LabelEncoder
from nltk.corpus import stopwords
from collections import defaultdict
from sklearn.model_selection import RepeatedStratifiedKFold
from sklearn.model_selection import GridSearchCV
from sklearn.pipeline import make_pipeline
import joblib 


pd.options.display.float_format = "{:,.2f}".format

df = pd.read_csv(r'/Users/tabetibrahim/Desktop/Vona/vef/facture_mobile_mars_avril_2021.csv', sep=";")

data_set = df[['Tem section 1', 'Tem section 2','Tem section 3','Description facture operateur']]
data_set.head()

tem_section= data_set[['Tem section 1', 'Tem section 2','Tem section 3']]

tem_en= data_set[['Tem section 1', 'Tem section 2','Tem section 3']]

labelencoder = LabelEncoder()
le = LabelEncoder()
encoder_dict = defaultdict(LabelEncoder)

df_encode = tem_en.apply(lambda x: encoder_dict[x.name].fit_transform(x))

inverse_transform_lambda = df_encode.apply(lambda x: encoder_dict[x.name].inverse_transform(x))

X, y =  data_set[['Description facture operateur']], tem_section


import nltk
import pandas as pd
import numpy as np
from nltk.stem import PorterStemmer
from nltk.corpus import stopwords

# If not previously performed:
# nltk.download('stopwords')

stemming = PorterStemmer()
stops = set(stopwords.words("french"))

def apply_cleaning_function_to_list(X):
    cleaned_X = []
    for element in X:
        cleaned_X.append(clean_text(element))
    return cleaned_X


def clean_text(raw_text):
    """This function works on a raw text string, and:
        1) changes to lower case
        2) tokenizes (breaks down into words
        3) removes punctuation and non-word text
        4) finds word stems
        5) removes stop words
        6) rejoins meaningful stem words"""

    # Convert to lower case
    text = raw_text.lower()

    # Tokenize
    tokens = nltk.word_tokenize(text)

    # Keep only words (removes punctuation + numbers)
    # use .isalnum to keep also numbers
    token_words = [w for w in tokens if w.isalpha()]

    # Stemming
    stemmed_words = [stemming.stem(w) for w in token_words]

    # Remove stop words
    meaningful_words = [w for w in stemmed_words if not w in stops]

    # Rejoin meaningful stemmed words
    joined_words = ( " ".join(meaningful_words))

    # Return cleaned data
    return joined_words




# Get text to clean
text_to_clean = list(data_set['Description facture operateur'])

# Clean text
cleaned_text = apply_cleaning_function_to_list(text_to_clean)

# Add cleaned data back into DataFrame
data_set['cleaned_review'] = cleaned_text

# Remove temporary cleaned_text list (after transfer to DataFrame)
del cleaned_text


from sklearn.model_selection import train_test_split
X = list(data_set['cleaned_review'])
y = df_encode
X_train, X_test, y_train, y_test = train_test_split(
    X,y, test_size = 0.25)

def create_bag_of_words(X):
    from sklearn.feature_extraction.text import CountVectorizer

    print ('Creating bag of words...')
    # Initialize the "CountVectorizer" object, which is scikit-learn's
    # bag of words tool.  

    # In this example features may be single words or two consecutive words
    # (as shown by ngram_range = 1,2)
    vectorizer = CountVectorizer(analyzer = "word",   \
                                 tokenizer = None,    \
                                 preprocessor = None, \
                                 stop_words = None,   \
                                 ngram_range = (1,2), \
                                 max_features = 10000
                                ) 

    # fit_transform() does two functions: First, it fits the model
    # and learns the vocabulary; second, it transforms our training data
    # into feature vectors. The input to fit_transform should be a list of 
    # strings. The output is a sparse array
    train_data_features = vectorizer.fit_transform(X)

    # Convert to a NumPy array for easy of handling
    train_data_features = train_data_features.toarray()

    # tfidf transform
    from sklearn.feature_extraction.text import TfidfTransformer
    tfidf = TfidfTransformer()
    tfidf_features = tfidf.fit_transform(train_data_features).toarray()

    # Get words in the vocabulary
    vocab = vectorizer.get_feature_names()

    return vectorizer, vocab, train_data_features, tfidf_features, tfidf


vectorizer, vocab, train_data_features, tfidf_features, tfidf  = \
    create_bag_of_words(X_train)

def train_logistic_regression(features, label):
    print ("Training the logistic regression model...")
    from sklearn.linear_model import LogisticRegression

    ml_model =  MultiOutputClassifier(LogisticRegression(C = 0.1, solver = 'newton-cg', penalty = 'l2',multi_class = 'multinomial'))


    ml_model.fit(features, label)

    print ('Finished')
    return  ml_model 

ml_model = train_logistic_regression(tfidf_features, y_train)


test_data_features = vectorizer.transform(X_test)
# Convert to numpy array
test_data_features = test_data_features.toarray()


test_data_tfidf_features = tfidf.fit_transform(test_data_features)
# Convert to numpy array
test_data_tfidf_features = test_data_tfidf_features.toarray()


predicted_y = ml_model.predict(test_data_tfidf_features)
correctly_identified_y = predicted_y == y_test
accuracy = np.mean(correctly_identified_y) * 100
1 version available for this pull request, show versions.
ver Time Author Commit Description
24 commits hidden, click expand to show them.
@@ -0,0 +1,40
1 |RCE| 4.25.1 |RNS|
2 ------------------
3
4 Release Date
5 ^^^^^^^^^^^^
6
7 - 2021-04-06
8
9
10 New Features
11 ^^^^^^^^^^^^
12
13
14
15 General
16 ^^^^^^^
17
18
19
20 Security
21 ^^^^^^^^
22
23
24
25 Performance
26 ^^^^^^^^^^^
27
28
29
30 Fixes
31 ^^^^^
32
33 - Artifacts: fixed admin panel bad urls generated for the new artifacts admin view in CE edition.
34
35
36
37 Upgrade notes
38 ^^^^^^^^^^^^^
39
40 - Un-scheduled release addressing problems in 4.25.X releases.
@@ -0,0 +1,53
1 |RCE| 4.25.2 |RNS|
2 ------------------
3
4 Release Date
5 ^^^^^^^^^^^^
6
7 - 2021-04-14
8
9
10 New Features
11 ^^^^^^^^^^^^
12
13
14
15 General
16 ^^^^^^^
17
18 - Comments: refresh on draft sidebar on draft submit.
19 - Vcsserver: log exceptions into the logs
20 - Archiving: make it explicit archiving a repo is irreversible.
21 - My-account: updated bookmarks UX
22 - Pull requests: added awaiting my review filter for users pull-requests.
23 Additionally the awaiting my review now properly filters pull requests that have no review votes on them.
24
25
26 Security
27 ^^^^^^^^
28
29
30
31 Performance
32 ^^^^^^^^^^^
33
34
35
36 Fixes
37 ^^^^^
38
39 - Draft comments: fixed logic in toggle all draft for submit.
40 - Draft comments: when submitting edited drafts also clear the history to prevent DB problems.
41 - Mercurial: fixed a case of lookup branches that had 40 characters in length.
42 - Gists: block id input for public gists.
43 - Pull requests: fixed problems with unicode characters in branches.
44 - Pull requests: small ui fix for grid.
45 - Summary: fixed ui on summary page for non-admins.
46 The setup instructions were broken if user had no write permissions.
47 - Users: make user data loading more resilient to errors.
48
49
50 Upgrade notes
51 ^^^^^^^^^^^^^
52
53 - Scheduled release addressing problems in 4.25.X releases.
@@ -0,0 +1,40
1 # -*- coding: utf-8 -*-
2
3 # Copyright (C) 2016-2020 RhodeCode GmbH
4 #
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU Affero General Public License, version 3
7 # (only), as published by the Free Software Foundation.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU Affero General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16 #
17 # This program is dual-licensed. If you wish to learn more about the
18 # RhodeCode Enterprise Edition, including its added features, Support services,
19 # and proprietary license terms, please see https://rhodecode.com/licenses/
20
21 import logging
22
23 from rhodecode.apps._base import BaseAppView, DataGridAppView
24 from rhodecode.lib.auth import LoginRequired, HasPermissionAllDecorator
25
26 log = logging.getLogger(__name__)
27
28
29 class AdminArtifactsView(BaseAppView, DataGridAppView):
30
31 def load_default_context(self):
32 c = self._get_local_tmpl_context()
33 return c
34
35 @LoginRequired()
36 @HasPermissionAllDecorator('hg.admin')
37 def artifacts(self):
38 c = self.load_default_context()
39 c.active = 'artifacts'
40 return self._get_template_context(c)
@@ -0,0 +1,39
1 ## -*- coding: utf-8 -*-
2 <%inherit file="/base/base.mako"/>
3
4 <%def name="title()">
5 ${_('Artifacts Admin')}
6 %if c.rhodecode_name:
7 &middot; ${h.branding(c.rhodecode_name)}
8 %endif
9 </%def>
10
11 <%def name="breadcrumbs_links()"></%def>
12
13 <%def name="menu_bar_nav()">
14 ${self.menu_items(active='admin')}
15 </%def>
16
17 <%def name="menu_bar_subnav()">
18 ${self.admin_menu(active='artifacts')}
19 </%def>
20
21 <%def name="main()">
22
23 <div class="box">
24
25 <div class="panel panel-default">
26 <div class="panel-heading">
27 <h3 class="panel-title">${_('Artifacts Administration.')}</h3>
28 </div>
29 <div class="panel-body">
30 <h4>${_('This feature is available in RhodeCode EE edition only. Contact {sales_email} to obtain a trial license.').format(sales_email='<a href="mailto:sales@rhodecode.com">sales@rhodecode.com</a>')|n}</h4>
31
32 </div>
33 </div>
34
35 </div>
36
37
38 </%def>
39
@@ -1,5 +1,6
1 [bumpversion]
1 [bumpversion]
2 current_version = 4.25.0
2 current_version = 4.25.2
3 message = release: Bump version {current_version} to {new_version}
3 message = release: Bump version {current_version} to {new_version}
4
4
5 [bumpversion:file:rhodecode/VERSION]
5 [bumpversion:file:rhodecode/VERSION]
6
@@ -75,3 +75,5 56310d93b33b97535908ef9c7b0985b89bb7fad2
75 7637c38528fa38c1eabc1fde6a869c20995a0da7 v4.23.2
75 7637c38528fa38c1eabc1fde6a869c20995a0da7 v4.23.2
76 6aeb4ac3ef7f0ac699c914740dad3688c9495e83 v4.24.0
76 6aeb4ac3ef7f0ac699c914740dad3688c9495e83 v4.24.0
77 6eaf953da06e468a4c4e5239d3d0e700bda6b163 v4.24.1
77 6eaf953da06e468a4c4e5239d3d0e700bda6b163 v4.24.1
78 f8161cbc2d94a935d3c395a0e758d9a094287169 v4.25.0
79 77fe47b5b39338e71b2c040de2c0359b529b6251 v4.25.1
@@ -21,7 +21,7 done = true
21
21
22 [release]
22 [release]
23 state = prepared
23 state = prepared
24 version = 4.11.6
24 version = 4.25.2
25
25
26 [task:updated_translation]
26 [task:updated_translation]
27
27
@@ -9,6 +9,8 Release Notes
9 .. toctree::
9 .. toctree::
10 :maxdepth: 1
10 :maxdepth: 1
11
11
12 release-notes-4.25.2.rst
13 release-notes-4.25.1.rst
12 release-notes-4.25.0.rst
14 release-notes-4.25.0.rst
13 release-notes-4.24.1.rst
15 release-notes-4.24.1.rst
14 release-notes-4.24.0.rst
16 release-notes-4.24.0.rst
@@ -1883,7 +1883,7 self: super: {
1883 };
1883 };
1884 };
1884 };
1885 "rhodecode-enterprise-ce" = super.buildPythonPackage {
1885 "rhodecode-enterprise-ce" = super.buildPythonPackage {
1886 name = "rhodecode-enterprise-ce-4.25.0";
1886 name = "rhodecode-enterprise-ce-4.25.2";
1887 buildInputs = [
1887 buildInputs = [
1888 self."pytest"
1888 self."pytest"
1889 self."py"
1889 self."py"
@@ -1,1 +1,1
1 4.25.0 No newline at end of file
1 4.25.2 No newline at end of file
@@ -27,6 +27,7 def admin_routes(config):
27 Admin prefixed routes
27 Admin prefixed routes
28 """
28 """
29 from rhodecode.apps.admin.views.audit_logs import AdminAuditLogsView
29 from rhodecode.apps.admin.views.audit_logs import AdminAuditLogsView
30 from rhodecode.apps.admin.views.artifacts import AdminArtifactsView
30 from rhodecode.apps.admin.views.defaults import AdminDefaultSettingsView
31 from rhodecode.apps.admin.views.defaults import AdminDefaultSettingsView
31 from rhodecode.apps.admin.views.exception_tracker import ExceptionsTrackerView
32 from rhodecode.apps.admin.views.exception_tracker import ExceptionsTrackerView
32 from rhodecode.apps.admin.views.main_views import AdminMainView
33 from rhodecode.apps.admin.views.main_views import AdminMainView
@@ -60,6 +61,34 def admin_routes(config):
60 route_name='admin_audit_log_entry', request_method='GET',
61 route_name='admin_audit_log_entry', request_method='GET',
61 renderer='rhodecode:templates/admin/admin_audit_log_entry.mako')
62 renderer='rhodecode:templates/admin/admin_audit_log_entry.mako')
62
63
64 # Artifacts EE feature
65 config.add_route(
66 'admin_artifacts',
67 pattern=ADMIN_PREFIX + '/artifacts')
68 config.add_route(
69 'admin_artifacts_show_all',
70 pattern=ADMIN_PREFIX + '/artifacts')
71 config.add_view(
72 AdminArtifactsView,
73 attr='artifacts',
74 route_name='admin_artifacts', request_method='GET',
75 renderer='rhodecode:templates/admin/artifacts/artifacts.mako')
76 config.add_view(
77 AdminArtifactsView,
78 attr='artifacts',
79 route_name='admin_artifacts_show_all', request_method='GET',
80 renderer='rhodecode:templates/admin/artifacts/artifacts.mako')
81 # EE views
82 config.add_route(
83 name='admin_artifacts_show_info',
84 pattern=ADMIN_PREFIX + '/artifacts/{uid}')
85 config.add_route(
86 name='admin_artifacts_delete',
87 pattern=ADMIN_PREFIX + '/artifacts/{uid}/delete')
88 config.add_route(
89 name='admin_artifacts_update',
90 pattern=ADMIN_PREFIX + '/artifacts/{uid}/update')
91
63 config.add_route(
92 config.add_route(
64 name='admin_settings_open_source',
93 name='admin_settings_open_source',
65 pattern='/settings/open_source')
94 pattern='/settings/open_source')
@@ -76,7 +76,11 class TestMyAccountEdit(TestController):
76 'requests requiring your participation.')
76 'requests requiring your participation.')
77
77
78 @pytest.mark.backends("git", "hg")
78 @pytest.mark.backends("git", "hg")
79 def test_my_account_my_pullrequests_data(self, pr_util, xhr_header):
79 @pytest.mark.parametrize('params, expected_title', [
80 ({'closed': 1}, 'Closed'),
81 ({'awaiting_my_review': 1}, 'Awaiting my review'),
82 ])
83 def test_my_account_my_pullrequests_data(self, pr_util, xhr_header, params, expected_title):
80 self.log_user()
84 self.log_user()
81 response = self.app.get(route_path('my_account_pullrequests_data'),
85 response = self.app.get(route_path('my_account_pullrequests_data'),
82 extra_environ=xhr_header)
86 extra_environ=xhr_header)
@@ -43,7 +43,7 from rhodecode.model.comment import Comm
43 from rhodecode.model.db import (
43 from rhodecode.model.db import (
44 IntegrityError, or_, in_filter_generator,
44 IntegrityError, or_, in_filter_generator,
45 Repository, UserEmailMap, UserApiKeys, UserFollowing,
45 Repository, UserEmailMap, UserApiKeys, UserFollowing,
46 PullRequest, UserBookmark, RepoGroup)
46 PullRequest, UserBookmark, RepoGroup, ChangesetStatus)
47 from rhodecode.model.meta import Session
47 from rhodecode.model.meta import Session
48 from rhodecode.model.pull_request import PullRequestModel
48 from rhodecode.model.pull_request import PullRequestModel
49 from rhodecode.model.user import UserModel
49 from rhodecode.model.user import UserModel
@@ -654,21 +654,31 class MyAccountView(BaseAppView, DataGri
654 Session().commit()
654 Session().commit()
655 return user.user_data['notification_status']
655 return user.user_data['notification_status']
656
656
657 def _get_pull_requests_list(self, statuses):
657 def _get_pull_requests_list(self, statuses, filter_type=None):
658 draw, start, limit = self._extract_chunk(self.request)
658 draw, start, limit = self._extract_chunk(self.request)
659 search_q, order_by, order_dir = self._extract_ordering(self.request)
659 search_q, order_by, order_dir = self._extract_ordering(self.request)
660
660
661 _render = self.request.get_partial_renderer(
661 _render = self.request.get_partial_renderer(
662 'rhodecode:templates/data_table/_dt_elements.mako')
662 'rhodecode:templates/data_table/_dt_elements.mako')
663
663
664 pull_requests = PullRequestModel().get_im_participating_in(
664 if filter_type == 'awaiting_my_review':
665 user_id=self._rhodecode_user.user_id,
665 pull_requests = PullRequestModel().get_im_participating_in_for_review(
666 statuses=statuses, query=search_q,
666 user_id=self._rhodecode_user.user_id,
667 offset=start, length=limit, order_by=order_by,
667 statuses=statuses, query=search_q,
668 order_dir=order_dir)
668 offset=start, length=limit, order_by=order_by,
669 order_dir=order_dir)
669
670
670 pull_requests_total_count = PullRequestModel().count_im_participating_in(
671 pull_requests_total_count = PullRequestModel().count_im_participating_in_for_review(
671 user_id=self._rhodecode_user.user_id, statuses=statuses, query=search_q)
672 user_id=self._rhodecode_user.user_id, statuses=statuses, query=search_q)
673 else:
674 pull_requests = PullRequestModel().get_im_participating_in(
675 user_id=self._rhodecode_user.user_id,
676 statuses=statuses, query=search_q,
677 offset=start, length=limit, order_by=order_by,
678 order_dir=order_dir)
679
680 pull_requests_total_count = PullRequestModel().count_im_participating_in(
681 user_id=self._rhodecode_user.user_id, statuses=statuses, query=search_q)
672
682
673 data = []
683 data = []
674 comments_model = CommentsModel()
684 comments_model = CommentsModel()
@@ -678,6 +688,12 class MyAccountView(BaseAppView, DataGri
678 repo_id, pull_request=pr, include_drafts=False, count_only=True)
688 repo_id, pull_request=pr, include_drafts=False, count_only=True)
679 owned = pr.user_id == self._rhodecode_user.user_id
689 owned = pr.user_id == self._rhodecode_user.user_id
680
690
691 review_statuses = pr.reviewers_statuses(user=self._rhodecode_db_user)
692 my_review_status = ChangesetStatus.STATUS_NOT_REVIEWED
693 if review_statuses and review_statuses[4]:
694 _review_obj, _user, _reasons, _mandatory, statuses = review_statuses
695 my_review_status = statuses[0][1].status
696
681 data.append({
697 data.append({
682 'target_repo': _render('pullrequest_target_repo',
698 'target_repo': _render('pullrequest_target_repo',
683 pr.target_repo.repo_name),
699 pr.target_repo.repo_name),
@@ -688,6 +704,8 class MyAccountView(BaseAppView, DataGri
688 'name_raw': pr.pull_request_id,
704 'name_raw': pr.pull_request_id,
689 'status': _render('pullrequest_status',
705 'status': _render('pullrequest_status',
690 pr.calculated_review_status()),
706 pr.calculated_review_status()),
707 'my_status': _render('pullrequest_status',
708 my_review_status),
691 'title': _render('pullrequest_title', pr.title, pr.description),
709 'title': _render('pullrequest_title', pr.title, pr.description),
692 'description': h.escape(pr.description),
710 'description': h.escape(pr.description),
693 'updated_on': _render('pullrequest_updated_on',
711 'updated_on': _render('pullrequest_updated_on',
@@ -723,7 +741,14 class MyAccountView(BaseAppView, DataGri
723 c.active = 'pullrequests'
741 c.active = 'pullrequests'
724 req_get = self.request.GET
742 req_get = self.request.GET
725
743
726 c.closed = str2bool(req_get.get('pr_show_closed'))
744 c.closed = str2bool(req_get.get('closed'))
745 c.awaiting_my_review = str2bool(req_get.get('awaiting_my_review'))
746
747 c.selected_filter = 'all'
748 if c.closed:
749 c.selected_filter = 'all_closed'
750 if c.awaiting_my_review:
751 c.selected_filter = 'awaiting_my_review'
727
752
728 return self._get_template_context(c)
753 return self._get_template_context(c)
729
754
@@ -732,13 +757,19 class MyAccountView(BaseAppView, DataGri
732 def my_account_pullrequests_data(self):
757 def my_account_pullrequests_data(self):
733 self.load_default_context()
758 self.load_default_context()
734 req_get = self.request.GET
759 req_get = self.request.GET
760
761 awaiting_my_review = str2bool(req_get.get('awaiting_my_review'))
735 closed = str2bool(req_get.get('closed'))
762 closed = str2bool(req_get.get('closed'))
736
763
737 statuses = [PullRequest.STATUS_NEW, PullRequest.STATUS_OPEN]
764 statuses = [PullRequest.STATUS_NEW, PullRequest.STATUS_OPEN]
738 if closed:
765 if closed:
739 statuses += [PullRequest.STATUS_CLOSED]
766 statuses += [PullRequest.STATUS_CLOSED]
740
767
741 data = self._get_pull_requests_list(statuses=statuses)
768 filter_type = \
769 'awaiting_my_review' if awaiting_my_review \
770 else None
771
772 data = self._get_pull_requests_list(statuses=statuses, filter_type=filter_type)
742 return data
773 return data
743
774
744 @LoginRequired()
775 @LoginRequired()
@@ -41,7 +41,7 class TestPullRequestList(object):
41
41
42 @pytest.mark.parametrize('params, expected_title', [
42 @pytest.mark.parametrize('params, expected_title', [
43 ({'source': 0, 'closed': 1}, 'Closed'),
43 ({'source': 0, 'closed': 1}, 'Closed'),
44 ({'source': 0, 'my': 1}, 'Opened by me'),
44 ({'source': 0, 'my': 1}, 'Created by me'),
45 ({'source': 0, 'awaiting_review': 1}, 'Awaiting review'),
45 ({'source': 0, 'awaiting_review': 1}, 'Awaiting review'),
46 ({'source': 0, 'awaiting_my_review': 1}, 'Awaiting my review'),
46 ({'source': 0, 'awaiting_my_review': 1}, 'Awaiting my review'),
47 ({'source': 1}, 'From this repo'),
47 ({'source': 1}, 'From this repo'),
@@ -79,21 +79,20 class RepoPullRequestsView(RepoAppView,
79
79
80 if filter_type == 'awaiting_review':
80 if filter_type == 'awaiting_review':
81 pull_requests = PullRequestModel().get_awaiting_review(
81 pull_requests = PullRequestModel().get_awaiting_review(
82 repo_name, search_q=search_q, source=source, opened_by=opened_by,
82 repo_name,
83 statuses=statuses, offset=start, length=limit,
83 search_q=search_q, statuses=statuses,
84 order_by=order_by, order_dir=order_dir)
84 offset=start, length=limit, order_by=order_by, order_dir=order_dir)
85 pull_requests_total_count = PullRequestModel().count_awaiting_review(
85 pull_requests_total_count = PullRequestModel().count_awaiting_review(
86 repo_name, search_q=search_q, source=source, statuses=statuses,
86 repo_name,
87 opened_by=opened_by)
87 search_q=search_q, statuses=statuses)
88 elif filter_type == 'awaiting_my_review':
88 elif filter_type == 'awaiting_my_review':
89 pull_requests = PullRequestModel().get_awaiting_my_review(
89 pull_requests = PullRequestModel().get_awaiting_my_review(
90 repo_name, search_q=search_q, source=source, opened_by=opened_by,
90 repo_name, self._rhodecode_user.user_id,
91 user_id=self._rhodecode_user.user_id, statuses=statuses,
91 search_q=search_q, statuses=statuses,
92 offset=start, length=limit, order_by=order_by,
92 offset=start, length=limit, order_by=order_by, order_dir=order_dir)
93 order_dir=order_dir)
94 pull_requests_total_count = PullRequestModel().count_awaiting_my_review(
93 pull_requests_total_count = PullRequestModel().count_awaiting_my_review(
95 repo_name, search_q=search_q, source=source, user_id=self._rhodecode_user.user_id,
94 repo_name, self._rhodecode_user.user_id,
96 statuses=statuses, opened_by=opened_by)
95 search_q=search_q, statuses=statuses)
97 else:
96 else:
98 pull_requests = PullRequestModel().get_all(
97 pull_requests = PullRequestModel().get_all(
99 repo_name, search_q=search_q, source=source, opened_by=opened_by,
98 repo_name, search_q=search_q, source=source, opened_by=opened_by,
@@ -110,6 +109,12 class RepoPullRequestsView(RepoAppView,
110 self.db_repo.repo_id, pull_request=pr,
109 self.db_repo.repo_id, pull_request=pr,
111 include_drafts=False, count_only=True)
110 include_drafts=False, count_only=True)
112
111
112 review_statuses = pr.reviewers_statuses(user=self._rhodecode_db_user)
113 my_review_status = ChangesetStatus.STATUS_NOT_REVIEWED
114 if review_statuses and review_statuses[4]:
115 _review_obj, _user, _reasons, _mandatory, statuses = review_statuses
116 my_review_status = statuses[0][1].status
117
113 data.append({
118 data.append({
114 'name': _render('pullrequest_name',
119 'name': _render('pullrequest_name',
115 pr.pull_request_id, pr.pull_request_state,
120 pr.pull_request_id, pr.pull_request_state,
@@ -118,6 +123,8 class RepoPullRequestsView(RepoAppView,
118 'name_raw': pr.pull_request_id,
123 'name_raw': pr.pull_request_id,
119 'status': _render('pullrequest_status',
124 'status': _render('pullrequest_status',
120 pr.calculated_review_status()),
125 pr.calculated_review_status()),
126 'my_status': _render('pullrequest_status',
127 my_review_status),
121 'title': _render('pullrequest_title', pr.title, pr.description),
128 'title': _render('pullrequest_title', pr.title, pr.description),
122 'description': h.escape(pr.description),
129 'description': h.escape(pr.description),
123 'updated_on': _render('pullrequest_updated_on',
130 'updated_on': _render('pullrequest_updated_on',
This diff has been collapsed as it changes many lines, (635 lines changed) Show them Hide them
@@ -6,9 +6,9
6 #, fuzzy
6 #, fuzzy
7 msgid ""
7 msgid ""
8 msgstr ""
8 msgstr ""
9 "Project-Id-Version: rhodecode-enterprise-ce 4.24.0\n"
9 "Project-Id-Version: rhodecode-enterprise-ce 4.25.0\n"
10 "Report-Msgid-Bugs-To: marcin@rhodecode.com\n"
10 "Report-Msgid-Bugs-To: marcin@rhodecode.com\n"
11 "POT-Creation-Date: 2021-01-14 15:36+0000\n"
11 "POT-Creation-Date: 2021-04-05 19:29+0000\n"
12 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
12 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14 "Language-Team: LANGUAGE <LL@li.org>\n"
14 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -111,7 +111,7 msgstr ""
111 #: rhodecode/apps/admin/views/settings.py:156
111 #: rhodecode/apps/admin/views/settings.py:156
112 #: rhodecode/apps/admin/views/settings.py:291
112 #: rhodecode/apps/admin/views/settings.py:291
113 #: rhodecode/apps/admin/views/settings.py:360
113 #: rhodecode/apps/admin/views/settings.py:360
114 #: rhodecode/apps/admin/views/settings.py:663
114 #: rhodecode/apps/admin/views/settings.py:664
115 #: rhodecode/apps/repository/views/repo_settings_vcs.py:116
115 #: rhodecode/apps/repository/views/repo_settings_vcs.py:116
116 msgid "Some form inputs contain invalid data."
116 msgid "Some form inputs contain invalid data."
117 msgstr ""
117 msgstr ""
@@ -135,54 +135,54 msgstr ""
135 msgid "Updated application settings"
135 msgid "Updated application settings"
136 msgstr ""
136 msgstr ""
137
137
138 #: rhodecode/apps/admin/views/settings.py:399
138 #: rhodecode/apps/admin/views/settings.py:400
139 msgid "Updated visualisation settings"
139 msgid "Updated visualisation settings"
140 msgstr ""
140 msgstr ""
141
141
142 #: rhodecode/apps/admin/views/settings.py:402
142 #: rhodecode/apps/admin/views/settings.py:403
143 msgid "Error occurred during updating visualisation settings"
143 msgid "Error occurred during updating visualisation settings"
144 msgstr ""
144 msgstr ""
145
145
146 #: rhodecode/apps/admin/views/settings.py:464
146 #: rhodecode/apps/admin/views/settings.py:465
147 #: rhodecode/apps/repository/views/repo_settings_issue_trackers.py:115
147 #: rhodecode/apps/repository/views/repo_settings_issue_trackers.py:115
148 msgid "Invalid issue tracker pattern: {}"
148 msgid "Invalid issue tracker pattern: {}"
149 msgstr ""
149 msgstr ""
150
150
151 #: rhodecode/apps/admin/views/settings.py:481
151 #: rhodecode/apps/admin/views/settings.py:482
152 #: rhodecode/apps/repository/views/repo_settings_issue_trackers.py:124
152 #: rhodecode/apps/repository/views/repo_settings_issue_trackers.py:124
153 msgid "Updated issue tracker entries"
153 msgid "Updated issue tracker entries"
154 msgstr ""
154 msgstr ""
155
155
156 #: rhodecode/apps/admin/views/settings.py:498
156 #: rhodecode/apps/admin/views/settings.py:499
157 #: rhodecode/apps/repository/views/repo_settings_issue_trackers.py:82
157 #: rhodecode/apps/repository/views/repo_settings_issue_trackers.py:82
158 msgid "Removed issue tracker entry."
158 msgid "Removed issue tracker entry."
159 msgstr ""
159 msgstr ""
160
160
161 #: rhodecode/apps/admin/views/settings.py:530
161 #: rhodecode/apps/admin/views/settings.py:531
162 msgid "Please enter email address"
162 msgid "Please enter email address"
163 msgstr ""
163 msgstr ""
164
164
165 #: rhodecode/apps/admin/views/settings.py:546
165 #: rhodecode/apps/admin/views/settings.py:547
166 msgid "Send email task created"
166 msgid "Send email task created"
167 msgstr ""
167 msgstr ""
168
168
169 #: rhodecode/apps/admin/views/settings.py:587
169 #: rhodecode/apps/admin/views/settings.py:588
170 msgid "Added new hook"
170 msgid "Added new hook"
171 msgstr ""
171 msgstr ""
172
172
173 #: rhodecode/apps/admin/views/settings.py:602
173 #: rhodecode/apps/admin/views/settings.py:603
174 msgid "Updated hooks"
174 msgid "Updated hooks"
175 msgstr ""
175 msgstr ""
176
176
177 #: rhodecode/apps/admin/views/settings.py:606
177 #: rhodecode/apps/admin/views/settings.py:607
178 msgid "Error occurred during hook creation"
178 msgid "Error occurred during hook creation"
179 msgstr ""
179 msgstr ""
180
180
181 #: rhodecode/apps/admin/views/settings.py:687
181 #: rhodecode/apps/admin/views/settings.py:688
182 msgid "Error occurred during updating labs settings"
182 msgid "Error occurred during updating labs settings"
183 msgstr ""
183 msgstr ""
184
184
185 #: rhodecode/apps/admin/views/settings.py:692
185 #: rhodecode/apps/admin/views/settings.py:693
186 msgid "Updated Labs settings"
186 msgid "Updated Labs settings"
187 msgstr ""
187 msgstr ""
188
188
@@ -592,7 +592,7 msgstr ""
592 msgid "1 month"
592 msgid "1 month"
593 msgstr ""
593 msgstr ""
594
594
595 #: rhodecode/apps/gist/views.py:63 rhodecode/public/js/scripts.js:48529
595 #: rhodecode/apps/gist/views.py:63 rhodecode/public/js/scripts.js:48670
596 #: rhodecode/public/js/scripts.min.js:1
596 #: rhodecode/public/js/scripts.min.js:1
597 #: rhodecode/public/js/rhodecode/i18n/js_translations.js:48
597 #: rhodecode/public/js/rhodecode/i18n/js_translations.js:48
598 #: rhodecode/public/js/src/rhodecode.js:634
598 #: rhodecode/public/js/src/rhodecode.js:634
@@ -653,8 +653,8 msgstr ""
653 #: rhodecode/templates/admin/repos/repo_add.mako:19
653 #: rhodecode/templates/admin/repos/repo_add.mako:19
654 #: rhodecode/templates/admin/users/user_edit_advanced.mako:12
654 #: rhodecode/templates/admin/users/user_edit_advanced.mako:12
655 #: rhodecode/templates/base/base.mako:114
655 #: rhodecode/templates/base/base.mako:114
656 #: rhodecode/templates/base/base.mako:133
656 #: rhodecode/templates/base/base.mako:134
657 #: rhodecode/templates/base/base.mako:1191
657 #: rhodecode/templates/base/base.mako:1192
658 msgid "Repositories"
658 msgid "Repositories"
659 msgstr ""
659 msgstr ""
660
660
@@ -894,104 +894,104 msgstr ""
894 msgid "No such commit exists for this repository. Commit: {}"
894 msgid "No such commit exists for this repository. Commit: {}"
895 msgstr ""
895 msgstr ""
896
896
897 #: rhodecode/apps/repository/views/repo_files.py:358
897 #: rhodecode/apps/repository/views/repo_files.py:359
898 msgid "Downloads disabled"
898 msgid "Downloads disabled"
899 msgstr ""
899 msgstr ""
900
900
901 #: rhodecode/apps/repository/views/repo_files.py:364
901 #: rhodecode/apps/repository/views/repo_files.py:365
902 msgid "Unknown archive type for: `{}`"
902 msgid "Unknown archive type for: `{}`"
903 msgstr ""
903 msgstr ""
904
904
905 #: rhodecode/apps/repository/views/repo_files.py:370
905 #: rhodecode/apps/repository/views/repo_files.py:371
906 msgid "Unknown commit_id {}"
906 msgid "Unknown commit_id {}"
907 msgstr ""
907 msgstr ""
908
908
909 #: rhodecode/apps/repository/views/repo_files.py:373
909 #: rhodecode/apps/repository/views/repo_files.py:374
910 msgid "Empty repository"
910 msgid "Empty repository"
911 msgstr ""
911 msgstr ""
912
912
913 #: rhodecode/apps/repository/views/repo_files.py:378
913 #: rhodecode/apps/repository/views/repo_files.py:384
914 msgid "No node at path {} for this repository"
914 msgid "No node at path {} for this repository"
915 msgstr ""
915 msgstr ""
916
916
917 #: rhodecode/apps/repository/views/repo_files.py:429
917 #: rhodecode/apps/repository/views/repo_files.py:436
918 msgid "Unknown archive type"
918 msgid "Unknown archive type"
919 msgstr ""
919 msgstr ""
920
920
921 #: rhodecode/apps/repository/views/repo_files.py:986
921 #: rhodecode/apps/repository/views/repo_files.py:993
922 msgid "Changesets"
922 msgid "Changesets"
923 msgstr ""
923 msgstr ""
924
924
925 #: rhodecode/apps/repository/views/repo_files.py:1007
925 #: rhodecode/apps/repository/views/repo_files.py:1014
926 #: rhodecode/apps/repository/views/repo_summary.py:243
926 #: rhodecode/apps/repository/views/repo_summary.py:239
927 #: rhodecode/model/pull_request.py:1910 rhodecode/model/scm.py:999
927 #: rhodecode/model/pull_request.py:1912 rhodecode/model/scm.py:999
928 #: rhodecode/templates/base/vcs_settings.mako:235
928 #: rhodecode/templates/base/vcs_settings.mako:235
929 #: rhodecode/templates/summary/components.mako:10
929 #: rhodecode/templates/summary/components.mako:10
930 msgid "Branches"
930 msgid "Branches"
931 msgstr ""
931 msgstr ""
932
932
933 #: rhodecode/apps/repository/views/repo_files.py:1011
933 #: rhodecode/apps/repository/views/repo_files.py:1018
934 #: rhodecode/model/scm.py:1016 rhodecode/templates/base/vcs_settings.mako:260
934 #: rhodecode/model/scm.py:1016 rhodecode/templates/base/vcs_settings.mako:260
935 #: rhodecode/templates/summary/components.mako:34
935 #: rhodecode/templates/summary/components.mako:34
936 msgid "Tags"
936 msgid "Tags"
937 msgstr ""
937 msgstr ""
938
938
939 #: rhodecode/apps/repository/views/repo_files.py:1155
939 #: rhodecode/apps/repository/views/repo_files.py:1162
940 #: rhodecode/apps/repository/views/repo_files.py:1181
940 #: rhodecode/apps/repository/views/repo_files.py:1188
941 msgid "Deleted file {} via RhodeCode Enterprise"
941 msgid "Deleted file {} via RhodeCode Enterprise"
942 msgstr ""
942 msgstr ""
943
943
944 #: rhodecode/apps/repository/views/repo_files.py:1202
944 #: rhodecode/apps/repository/views/repo_files.py:1209
945 msgid "Successfully deleted file `{}`"
945 msgid "Successfully deleted file `{}`"
946 msgstr ""
946 msgstr ""
947
947
948 #: rhodecode/apps/repository/views/repo_files.py:1206
948 #: rhodecode/apps/repository/views/repo_files.py:1213
949 #: rhodecode/apps/repository/views/repo_files.py:1326
950 #: rhodecode/apps/repository/views/repo_files.py:1450
951 #: rhodecode/apps/repository/views/repo_files.py:1571
952 msgid "Error occurred during commit"
953 msgstr ""
954
955 #: rhodecode/apps/repository/views/repo_files.py:1243
956 #: rhodecode/apps/repository/views/repo_files.py:1272
957 msgid "Edited file {} via RhodeCode Enterprise"
958 msgstr ""
959
960 #: rhodecode/apps/repository/views/repo_files.py:1295
961 msgid "No changes detected on {}"
962 msgstr ""
963
949 #: rhodecode/apps/repository/views/repo_files.py:1319
964 #: rhodecode/apps/repository/views/repo_files.py:1319
950 #: rhodecode/apps/repository/views/repo_files.py:1443
951 #: rhodecode/apps/repository/views/repo_files.py:1564
952 msgid "Error occurred during commit"
953 msgstr ""
954
955 #: rhodecode/apps/repository/views/repo_files.py:1236
956 #: rhodecode/apps/repository/views/repo_files.py:1265
957 msgid "Edited file {} via RhodeCode Enterprise"
958 msgstr ""
959
960 #: rhodecode/apps/repository/views/repo_files.py:1288
961 msgid "No changes detected on {}"
962 msgstr ""
963
964 #: rhodecode/apps/repository/views/repo_files.py:1312
965 msgid "Successfully committed changes to file `{}`"
965 msgid "Successfully committed changes to file `{}`"
966 msgstr ""
966 msgstr ""
967
967
968 #: rhodecode/apps/repository/views/repo_files.py:1348
968 #: rhodecode/apps/repository/views/repo_files.py:1355
969 #: rhodecode/apps/repository/views/repo_files.py:1387
969 #: rhodecode/apps/repository/views/repo_files.py:1394
970 msgid "Added file via RhodeCode Enterprise"
970 msgid "Added file via RhodeCode Enterprise"
971 msgstr ""
971 msgstr ""
972
972
973 #: rhodecode/apps/repository/views/repo_files.py:1403
973 #: rhodecode/apps/repository/views/repo_files.py:1410
974 msgid "No filename specified"
974 msgid "No filename specified"
975 msgstr ""
975 msgstr ""
976
976
977 #: rhodecode/apps/repository/views/repo_files.py:1428
977 #: rhodecode/apps/repository/views/repo_files.py:1435
978 msgid "Successfully committed new file `{}`"
978 msgid "Successfully committed new file `{}`"
979 msgstr ""
979 msgstr ""
980
980
981 #: rhodecode/apps/repository/views/repo_files.py:1436
981 #: rhodecode/apps/repository/views/repo_files.py:1443
982 #: rhodecode/apps/repository/views/repo_files.py:1546
982 #: rhodecode/apps/repository/views/repo_files.py:1553
983 msgid "The location specified must be a relative path and must not contain .. in the path"
983 msgid "The location specified must be a relative path and must not contain .. in the path"
984 msgstr ""
984 msgstr ""
985
985
986 #: rhodecode/apps/repository/views/repo_files.py:1491
986 #: rhodecode/apps/repository/views/repo_files.py:1498
987 msgid "Uploaded file via RhodeCode Enterprise"
987 msgid "Uploaded file via RhodeCode Enterprise"
988 msgstr ""
988 msgstr ""