mirror of
https://gitlab.com/buildfeed/BuildFeed.git
synced 2024-03-22 21:10:34 +08:00
Filter out duplicated results on Bulk Addition
This commit is contained in:
parent
a74137cd66
commit
e1f98079a9
|
@ -225,6 +225,12 @@ public async Task<List<Build>> SelectBuildsByStringSearch(string term, int limit
|
|||
return await query.ToListAsync();
|
||||
}
|
||||
|
||||
[DataObjectMethod(DataObjectMethodType.Select, false)]
|
||||
public async Task<Build> SelectBuildByFullBuildString(string build)
|
||||
{
|
||||
return await _buildCollection.Find(Builders<Build>.Filter.Eq(b => b.FullBuildString, build)).SingleOrDefaultAsync();
|
||||
}
|
||||
|
||||
[DataObjectMethod(DataObjectMethodType.Select, false)]
|
||||
public async Task<List<Build>> SelectBuildsByCompileDate(int limit = -1, int skip = 0)
|
||||
{
|
||||
|
|
|
@ -292,6 +292,7 @@
|
|||
<None Include="package.json" />
|
||||
<Content Include="res\Web.config" />
|
||||
<Content Include="res\css\light.scss" />
|
||||
<None Include="Properties\PublishProfiles\Milestone 1 WebDeploy %28Private%29.pubxml" />
|
||||
<None Include="Properties\PublishProfiles\Milestone 1 WebDeploy.pubxml" />
|
||||
<None Include="Scripts\jquery-3.1.1.intellisense.js" />
|
||||
<Content Include="Scripts\jquery-3.1.1.js" />
|
||||
|
|
|
@ -474,14 +474,24 @@ public async Task<ActionResult> AddBulk(FormCollection values)
|
|||
SourceType = TypeOfSource.PrivateLeak
|
||||
};
|
||||
|
||||
await _bModel.Insert(b);
|
||||
string buildString = b.GenerateFullBuildString();
|
||||
Build existing = await _bModel.SelectBuildByFullBuildString(buildString);
|
||||
|
||||
if (notify)
|
||||
if (existing == null)
|
||||
{
|
||||
osc.PushNewBuild(b, $"https://buildfeed.net{Url.Action(nameof(ViewBuild), new { id = b.Id })}?utm_source=notification&utm_campaign=new_build");
|
||||
}
|
||||
await _bModel.Insert(b);
|
||||
|
||||
success.Add(b);
|
||||
if (notify)
|
||||
{
|
||||
osc.PushNewBuild(b, $"https://buildfeed.net{Url.Action(nameof(ViewBuild), new { id = b.Id })}?utm_source=notification&utm_campaign=new_build");
|
||||
}
|
||||
|
||||
success.Add(b);
|
||||
}
|
||||
else
|
||||
{
|
||||
failed.Add(line);
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue
Block a user