Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Discover
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
3
Merge Requests
3
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Plasma
Discover
Commits
36643a92
Commit
36643a92
authored
May 02, 2018
by
Aleix Pol Gonzalez
🐧
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix updates count when listing resources that point to the same package
parent
34a91690
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
1 deletion
+23
-1
libdiscover/UpdateModel/UpdateModel.cpp
libdiscover/UpdateModel/UpdateModel.cpp
+22
-0
libdiscover/UpdateModel/UpdateModel.h
libdiscover/UpdateModel/UpdateModel.h
+1
-1
No files found.
libdiscover/UpdateModel/UpdateModel.cpp
View file @
36643a92
...
...
@@ -248,12 +248,34 @@ ResourcesUpdatesModel* UpdateModel::backend() const
int
UpdateModel
::
toUpdateCount
()
const
{
int
ret
=
0
;
QSet
<
QString
>
packages
;
foreach
(
UpdateItem
*
item
,
m_updateItems
)
{
const
auto
packageName
=
item
->
resource
()
->
packageName
();
if
(
packages
.
contains
(
packageName
))
{
continue
;
}
packages
.
insert
(
packageName
);
ret
+=
item
->
checked
()
!=
Qt
::
Unchecked
?
1
:
0
;
}
return
ret
;
}
int
UpdateModel
::
totalUpdatesCount
()
const
{
int
ret
=
0
;
QSet
<
QString
>
packages
;
foreach
(
UpdateItem
*
item
,
m_updateItems
)
{
const
auto
packageName
=
item
->
resource
()
->
packageName
();
if
(
packages
.
contains
(
packageName
))
{
continue
;
}
packages
.
insert
(
packageName
);
ret
+=
1
;
}
return
ret
;
}
UpdateItem
*
UpdateModel
::
itemFromResource
(
AbstractResource
*
res
)
{
foreach
(
UpdateItem
*
item
,
m_updateItems
)
{
...
...
libdiscover/UpdateModel/UpdateModel.h
View file @
36643a92
...
...
@@ -64,7 +64,7 @@ public:
bool
hasUpdates
()
const
;
///all upgradeable packages
int
totalUpdatesCount
()
const
{
return
m_updateItems
.
count
();
}
int
totalUpdatesCount
()
const
;
///packages marked to upgrade
int
toUpdateCount
()
const
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment